Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax.mail attachment not correctly encoded

Peter van Nes
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(moved this question to Other JSE/JEE APIs)


I have developed an online auction system which, has a function to generate invoices using the iText libraries.
The invoices are stored as a ByteArray in a database and are mailed to the customer. This works find when running
the application within my IDE (Netbeans) on Mac OS X and Apache Tomcat 6.0.29 and javamail 1.4.3. When running the application on
Windows 2003 Server with same tomcat and javamail version the attachment is not readable on the client.

The attachment is added to the e-mail using the following code;

The raw e-mail of the attachment when it is correctly encoded (running from my IDE)

And again when encoded from the server

Both attachments have the same length, and are similar (but are exactly the same).
In the third line of the correctly encoded attachment the characters are; "gf" which are
encoded in the not correctly encoded attachment to "P/".

Also setting "-Dmail.mime.multipart.bmparse=false" did not make any difference.
Any ideas, suggestions, solutions ?


  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic