Satscreate Satscreate - 1 month ago 11
Java Question

How to Flag for Follow Up using Java Mail

I have a java mail sender which I wanted to set a follow-up reminder rules.. Like how we wil set in outlook.Please help is there any way I can set in java mail??

Answer

Add the Reply-By MIME header as the date of the deadline and the non-standard X-Message-Flag to signal the reason as Follow up. Here is an example code fragment:

final long REPLY_BY_MS = 24L * 60L * 60L * 1000L; //One day.
MimeMessage msg = new MimeMessage(session);
msg.setHeader("X-Message-Flag", "Follow up");
javax.mail.internet.MailDateFormat md 
        = new javax.mail.internet.MailDateFormat();
final long now = System.currentTimeMillis();
msg.setHeader("Reply-By", md.format(new Date(now + REPLY_BY_MS)));
msg.setSentDate(new Date(now));
Comments