java send html mail problem

K

killjoy

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
 
A

Andrew Thompson

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
 
A

alexandre cartapanis

Andrew Thompson a écrit :
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 \\ -> //
Maybe \\\\ will also works fine.
 
K

killjoy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top