Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send HTML email with javax?

 
Thomas Soul
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, I'm trying to send html email, but I can't seem to do it.

My code:


I also tried this variation of the code:


I tried testing it with:

(and some others too).

Yet I receive plain text like this:

The latter was automatically added by mailer deamon of the server.

How to send html email?
Is me receiving plain text fault of mail server or my code?




----
Since javax.mail.Message is part of j2ee I decided to post the topic here.
 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Odd. The code looks OK to me, but the content is placed above the headers. It looks like the mail server is messing up the message.

Can you turn on debugging by calling session.setDebug(true)? You can then see what is sent to the mail server.
 
Thomas Soul
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Found it!!!

Did quick:

and it was clear the splitter function earlier on set whole body to the subject..... I am so stupid

*fixed*
 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad I could help you find the cause of the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic