We help IT Professionals succeed at work.
Get Started

How to differentiate between html content and non-html content of javamail?

sitijaafar
sitijaafar asked
on
366 Views
Last Modified: 2013-11-24
Hi experts,
My application now can send an email. In that application sender can send both html format and non-html format. But right now I'm facing a problem when I want to send a non html format, for example the sender send an email the content like below:

The List

ITEM A
ITEM B
ITEM C

But, the recipient will receive it like this, it supposely like above :

The List ITEM A ITEM B ITEM C

It not receive like the original content.

Please help me..
The below code work for html format but look like not for non-html. What I should do, for differentiate between html and non-html when I want send the content?
To send content here is the code:
 
Multipart mp = new MimeMultipart();	 	   
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent(messageTxt, "text/html"); 			
mp.addBodyPart(htmlPart);				
msg.setContent(mp);

Open in new window

Comment
Watch Question
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 4 Answers and 22 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE