aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes How to send HTML email with javax? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How to send HTML email with javax?" Watch "How to send HTML email with javax?" New topic
Author

How to send HTML email with javax?

Thomas Soul
Greenhorn

Joined: Feb 07, 2013
Posts: 6
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

Joined: Oct 27, 2005
Posts: 19719
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Thomas Soul
Greenhorn

Joined: Feb 07, 2013
Posts: 6


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

Joined: Oct 27, 2005
Posts: 19719
    
  20

I'm glad I could help you find the cause of the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to send HTML email with javax?