Monday, July 18, 2011

Postfix Seen (Read mail) Flag

To the billions of developers trying to migrate Postfix to a database email solutions:

Q: How does Postfx mark a mail message as "Seen" (the email has been read)?
A: It appends ",S" to the name of the email message file on the file system.

If you just try to parse the postfix mail file into a javax.mail.Message by doing something along the lines of:

MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), FileUtils.openInputStream(email));

and then try to see if the message was read or not, by calling:


isSet(Flags.Flag.SEEN) will always return false, 
since you are not retrieving the message through Postfix.

The way I got around to determining if the message was read or not:

emailFile.getName().endsWith(",S") - true: read; false - NOT read.

Hope this helps someone!

Credit to the best DBA around: Charles Estel aka CJ!

Thursday, July 7, 2011

Latest quote

Reading "HTML5: Up and Running" by Google's Mark Pilgrim.
Here is a quote of the the day:
"The canPlayType() function doesn’t return true or false. In recognition of how complex video formats are, the function returns a string:
  • "probably" if the browser is fairly confident it can play this format
  • "maybe" if the browser thinks it might be able to play this format
  • "" (an empty string) if the browser is certain it can’t play this format "
My response to this: 

"Since when John Madden is involved with developing the HTML5 API???" :D

Excellent read so far though...