• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Want to include html in my email message...

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be sure to set the content type to "text/html".
hth,
bear
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic