Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

want to generate html formatted email that supports outlook?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I want to generate html formatted email using java that will be supported in outlook, actually i have tried org.apache.commons.mail.HtmlEmail still it fails for outlook.

Help me

Thanks
Rajesh
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What, exactly, do you mean by "fail"? What did you try, and how did or didn't it work? TellTheDetails
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry.

Im getting html formatted email in gmail, hotmail etc.but for outlook the mail is still text/plain.
The source code is
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope my previous post has details, so that you provide sume suggestion.

Thanks
Rajesh
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That email doesn't seem to have any HTML ...

Make sure that Outlook isn't set to ignore HTML content, or that it's not stripped out by the target mail server.
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String message ="test mail http://www.gmail.com";

the url will be treated as hyperlink when its a html email.so it works well as htnl formatted in googlemail,hot mail etc.but for out look its just a plain text
 
Sheriff
Posts: 22796
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make it explicit:
Apparently gmail is smarter than Outlook.
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestion
i tried the code you suggested still its a plain text email
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rajeshkannan sella wrote: String message ="test mail http://www.gmail.com";


That doesn't make it an HTML mail. Gmail simply renders any HTTP URLs as clickable links, that's all.

I'm not familiar with that Apache library, but this extensive tutorial with many code examples shows how to create HTML mails using JavaMail.
 
Marshal
Posts: 28288
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I use my personal web-based e-mail account to send a message like that to my work e-mail account, Outlook doesn't recognize that piece of text as a URL and doesn't render it as a link.

So like everyone already said, that's what Outlook does with text e-mails. Send an HTML e-mail if that's what you want.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more thing to try: make sure the HTML is well-formed - header, body, HTML tags etc.
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For html formatted email we have a class called org.apache.commons.mail.HtmlEmail. im using that even though im not getting a html formatted email in outlook.

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just because there's a classes called "HtmlEmail" doesn't mean that it'll work with incorrect HTML.
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This code makes message body html formatted as per API reference
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rajeshkannan sella wrote:

This code makes message body html formatted as per API reference



I would try following the example from http://commons.apache.org/email/apidocs/org/apache/commons/mail/HtmlEmail.html; which constructs an actual HTML message, tags and all before submitting to HtmlEmail.

It seems somewhat optimistic to assume to assume that HtmlEmail can actually mark up what you have submitted as HTML (sure it might be add a couple of tags around of your text; but I would be pretty surprised if there was a full on text parser in it that understood when to make <a> tags and the like).

Try downloading the source to commons email and look at the source to HtmlEmail.

L
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help.now i can able to generate html formatted email with the use Patterns
 
reply
    Bookmark Topic Watch Topic
  • New Topic