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

Setting headers correctly in Javamail

Iain Emsley
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to convert a file into base64 to be attached to a mail sent via JavaMail and I'm really trying to get the header set as using Content-Transfer-Encoding base64 as the file is an .ics file and sending it via 7bit leaves it up to the whims of the client to read it correctly (according to my reading of RFC 2045). I suppse I'm trying to do what Google does succesfully and set the following header:

but I'm getting:

The code that I've been using is:

I don't seem to be able to get the FileOutputStream to encode at all. I did try:

to get the string containing the data encoded but again, I've failed to be able to set the base64 header as the email turns up as Content-Transfer-Encoding: quotable-printed and the content-type stays as application/octet stream, despite trying to set the header in the DataSource line.
I'd be grateful for any pointers in solving this issue so that I can take luck out of our email equation.

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic