I'm not really clear.
Main Topics
Browse All TopicsHi 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?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
on the other hand, you can set both the content type as object mentioned
Multipart mp = new MimeMultipart();
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent(messag
mp.addBodyPart(htmlPart);
MimeBodyPart plainPart = new MimeBodyPart();
plainPart.setContent(plain
mp.addBodyPart(plainPart);
msg.setContent(mp);
the above message has both the content html and plain, so the mail client can display html if they support or else plain.
not, ksivananth. for content below I want send it as non-html.
The List
ITEM A
ITEM B
ITEM C
Supposely, the app can send both of non-html and html. That means at one time sender can send either html and non-html. But I think must do something for identify wheter the content is html or non-html. But, I do not how. Previously I use code below for send, it not work for html.
ksivananth,
try reading this article. hopefully, it will give you a better understanding of the differences in formatting content to be sent as HTML, as opposed to text only, emails.
http://www.webcheatsheet.c
Right now I understand that for html use ---> htmlPart.setContent(messag
for plain text use ---> plainPart.setContent(plain
In the application the sender can insert the content anything So, based on the content it will go wheter (htmlPart.setContent(messa
for example
[1] -- if(content plaintext) {(plainPart.setContent(pla
[2] -- if(content html) {(htmlPart.setContent(mess
That means:
If the content like below it will go to [1] condtion:
LIST
ITEM A
ITEM B
ITEM C
Meanwhile, when the content like below, it will go to [2] condition:
<html>
<body>
ITEM A</br>
ITEM B</br>
ITEM C</br>
</body>
</html>
but I do not have an idea how to make a condition, can anyone me give an idea how to do that or is it can be solve with another solution.
as you have/generate the content, you should be know what type it is and make the condition accordingly?
and another small suggestion, even if you have the HTML content, try extracting the plain text out of it and add the plain text part too so that clients who doesn't support HTML can display the plain text in readable format.
Business Accounts
Answer for Membership
by: objectsPosted on 2009-09-02 at 00:55:25ID: 25238784
try including a separate Part in the email containing plain text