How to get important flag from Java Mail client - jakarta-mail

Is there a way to get whether a mail is marked as important or not from Java Mail API.? I'm using a Gmail account to connect. Thanks in advance.

Different mailers use different ways to indicate that a message is "important". Some use an X-Priority header. Others use an Importance header. I don't know offhand what Gmail uses, but look at the raw headers of a message and you should be able to figure it out. Then use the JavaMail getHeader method to access that header.

Related

Sending threaded email from Google App Engine

I've got an app that's sending email from AppEngine, but each email looks like it's a unique message. Instead I want related emails to be threaded in my email client. Is there a specific header/format I need to use?
These emails are not necessarily in response to another email, so I don't have a Message-ID to plug into References. I've tried using a natural key in References and In-Reply-To to no avail.
I was able to thread a list of emails just by using the In-Reply-To header with your format <msg-identifier#host>.
Supposedly, msg-identifier is the identifier to the message you're replying to, but as you're not replying to any message but sending all of them out of thin air, creating a new ID and using it in all the emails you send will also do the trick.
I got this working by using both References and In-Reply-To with the format <identifier#systemname>. Maybe it'll work with less; I made several changes at once. If someone chimes in with that kind of detail I'll happily accept their answer instead of mine.

How to request read receipt with Google App Engine

I have a GAE application which sends out email to my domain users in a Google Apps for Business environment. I am using JavaMail as described in this article. Unfortunately I can't seem to find a way to ask for a read receipt. I looked at Message methods but nothing seems to suggest that it is possible. Thanks a lot.
If you're interested in knowing if a mail bounced, then use bounce notification https://developers.google.com/appengine/docs/java/mail/bounce
For read receipts:
As far as I'm aware, you need to roll your own read receipt functionality. For example: Include an image(with a unique url) in the mail you send out. When the recipient opens the mail, the image is retrieved and you can determine whether the mail has been read. This has it's downsides; if they don't have images enabled, then you won't receive the notification.
You need to set the appropriate headers on your message, as described in Message Disposition Notification - RFC 3798. Not all mailers will honor MDNs, so you might find the tracking pixel useful as well. But then some mailers won't display remote images, so in the end there's no guaranteed way of getting notified when a message is read.

How can I read Yahoo! Mail using JavaMail?

Using JavaMail, I am able to read and download mails from Gmail, but it is not working for yahoomail.com. I've tried it in all the possible ways I know, but nothing is working. While searching, I learned that Yahoo Mail does not provide POP3 for free users, so I tried IMAP, but it is also not working.
there is a workaround for this, please see
http://www.khimhoe.net/2011/06/11/how-to-enable-pop3-in-the-new-yahoo-mail-updated-11june2011/
for No7. Use menu link Forwarding instead of POP Access

HTTP authentication and filesend in C

i have some parsed data in two files. i need to send these to a webserver of a website. i also need to be logged into the webserver first. i am new to this web interaction thing. i just need to know how might i go about doing this. i am learning the libcurl library so i guess it can send standard HTTP POST messages. i will make a simple webserver to test it myself. can anyone tell me what kind of interaction is needed. by that i mean how do i send the username and password information, know that i am logged in and then be send the files. may be some examples of Form Posts which i believe is what i shud be doing right now.
Depending on the type of authentication being performed, the libcurl library may have functionality already built into it to support what you are trying to do. Check out the curl_easy_setopt function--specifically the section dealing with authentication.
For basic authentication, you can do the following.
curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_easy_setopt( curl, CURLOPT_USERPWD, "username:password" );
You can use for example an old Wininet.dll (http://msdn.microsoft.com/en-us/library/aa385473%28VS.85%29.aspx) or more recent Winhttp.dll on the client side. The last one (WinHTTP) has two C/C++ API and COM Interface. Moreover, in WinHTTP you have more Authentication options (http://msdn.microsoft.com/en-us/library/aa383144%28VS.85%29.aspx).
On the other side old Wininet.dll has function like InternetWriteFile. In InternetConnect (Wininet.dll) you can give lpszUsername and lpszPassword.
In WinHTTP you should use WinHttpSetOption and WinHttpSetCredentials to give Username and password.
Search for both Wininet and WinHTTP and you will find enough Information to decide which one is better for your requirements.

smtp sends headers as content

I'm using remote smtp server(from my host company) and send
email from local computer.(google app development server)
But instead of getting nice emails
i get emails that contain headers as if it ware content of email
What can do to change it?
My guess is that you have a newline (\r\n or Carriage Return -Line Feed) in your subject. And, your mailing program doesn't strip newlines in the subject.
If you put a newline in the subject, and your app doesn't remove it, you just moved all following headers down to the body.
Send the email according to the SMTP RFC: https://www.rfc-editor.org/rfc/rfc5321
Getting the headers in the content sounds like you sent them twice or did separate the headers from the content in a way your mail client does not understand.
Check you don't have something wrapping what you send in another layer of email.
Perhaps look at the current (real/outer) headers to see if that gives any clues.
Can you show us your code, please? You don't say which App Engine runtime you're using; I'll assume Python. The App Engine mail API doesn't let you directly set message headers. There's a list of attributes you can set here.

Resources