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

Adding image as attachment in JavaMail

Daren Reavis
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to add the InputStream of a gif image as an attachment in an email with JavaMail. This is in addition to html of a page that I am posting as the main body of the email. Here is what I have:

getHttpsConnection is another method I have. This code works, sending the email with the html, but the gif never gets sent. When I look at the source for the email that is sent, I see this:

Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
Content-ID: <logo>

And that is it. So, the headers are there, but not the image itself (base64 encoded binary).

Can anyone help me with this? What am I doing wrong?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic