• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Want to include html in my email message...

 
Mandy Smith
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using JAVA MAIL to send Email. I am able to send plain text messages properly but i want to send html contents in my message. How to do this?
I am able to send hyper links in my messages, but not html tags. what i mean by this is, let's say i send <H1>Hello</H1>, received email must be able to view this text in large font, rather than viewing like this(<H1>Hello</H1> . How to achive this. Could some body please help me on this.
Appreciate your help,
Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be sure to set the content type to "text/html".
hth,
bear
 
Mandy Smith
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to allow attachments as well in my email message, so for this to happen i have set the contentType to multipart. Is there a way i can set to some contentType so that i can send both attachments as well as html contents. Also sometimes there could be only attachments, only html contents or both. So, how to achieve this?
Appreciate any further help on this.
Thanks for your response.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each part of a multipart message has a content type. Be sure to set each as appropriate to the content in that part.
Here's a link to a resource I found useful when I was toying with this very subject.
hth,
bear
[ June 19, 2002: Message edited by: Bear Bibeault ]
 
Mandy Smith
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response. Some how, i am not able to set the contentType to both multipart as well as text/html.
Is there a way to set the MimeMessage's contentType to both multipart as well as text/html?
If i set the mimeMessage's contentType to multipart, then i am able to send attachments in my email successfully, if i set the mimeMessage's contentType to text/html, then i am able to send html tags in my email message successfully. But i am not able to send both attachments as well as html tags in my email successfully. It defaults to whatever the last contentType was set to.
I would greatly appreciate any help on this.
Thanks in advance.
 
Mandy Smith
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured this out why it wasn't working. I was setting the contentType first to text/html and then again setting the mimeMessage's text, so the text was overriding text/html content type. Just wanted to share.
Thanks for your response.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic