This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to send HTML email with javax?  RSS feed

 
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
Posts: 21088
85
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
Posts: 21088
85
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!