Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

java send html mail problem

Thread view: 
killjoy - 24 May 2005 14:22 GMT
Hi,

I have a web app. that runs on weblogic 8.1 sp4 on windows XP.
Normally, it sends e-mails (text and html) with no trouble. However, I
need to put a hyperlink in a mail message using below code snipped;

Session session = (Session) ic.lookup("mySession");
MimeMessage msg = new MimeMessage(session);               
msg.setFrom();       

msg.setHeader("X-Mailer", "sendhtml");       
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(email,
false));
msg.setSentDate(new Date());
msg.setSubject(subject,"ISO-8859-9");       
       
MimeBodyPart mbp = new MimeBodyPart();

String tst = "<html><body><table border='1'><tr><td><a
href='http:\\www.yahoo.com'>xxxxx</a></td></tr><tr><td>yyy</td></tr></table></body></html>";

mbp.setDataHandler(new DataHandler(tst, "text/html;
charset=ISO-8859-9"));
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);

Transport.send(msg);

My app. doesn't send this e-mail. But, when I change
href='http://www.yahoo.com' to href=''  mail is sent successfully.

How can I make it work?

Thanks in advance

Murat
Andrew Thompson - 24 May 2005 14:35 GMT
> String tst = "<html><body><table border='1'><tr><td><a
> href='http:\\www.yahoo.com'>xxxxx</a></td></tr><tr><td>yyy</td></tr></table></body></html>";

AFAIU, this string should be..

String tst = "<html><body><table border='1'><tr><td><a
href='http://www.yahoo.com'>xxxxx</a></td></tr><tr><td>yyy</td></tr></table></body></html>";

Note the \\ -> //

HTH

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

alexandre cartapanis - 24 May 2005 16:15 GMT
Andrew Thompson a écrit :

>>String tst = "<html><body><table border='1'><tr><td><a
>>href='http:\\www.yahoo.com'>xxxxx</a></td></tr><tr><td>yyy</td></tr></table></body></html>";
[quoted text clipped - 5 lines]
>
> Note the \\ -> //
Maybe \\\\ will also works fine.

> HTH
killjoy - 24 May 2005 21:09 GMT
Andrew,

I tried both \\ and //. Unfortunately, no message appears in my inbox.
On the other hand, stantard output of the weblogic says that the
message sent :-|

thanks

> > String tst = "<html><body><table border='1'><tr><td><a
> > href='http:\\www.yahoo.com'>xxxxx</a></td></tr><tr><td>yyy</td></tr></table></body></html>";
[quoted text clipped - 7 lines]
>
> HTH
GaryM - 26 May 2005 00:17 GMT
> msg.setContent(mp);

msg.saveChanges();

> Transport.send(msg);

Try that!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.