wood burning stoves 2.0*
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
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: 19656
    
  18

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: 19656
    
  18

I'm glad I could help you find the cause of the problem.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to send HTML email with javax?
 
Similar Threads
Send mail from HTML
About Port number in JavaMail
Problem sending mail through Java
On posting from struts jsp form to the same page I get Cannot find bean (Form) in any scope.
Set charset for SMTP