JavaMail in HTML Format
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Prince_Robinson
Posted On:   Monday, August 6, 2001 12:06 PM

Hi Friends,


I have a problem in sending JavaMail in html format. Can anybody help me to write a program or send me a source code for this.



Thanks & Regards


PRINCE ROBINSON

Re: JavaMail in HTML Format

Posted By:   Achintya_Bakre  
Posted On:   Tuesday, August 7, 2001 02:50 AM

See the following code, it is fully sucessful code:


String to=null, subject = null, from = null,text=null;

String mailhost ="mail.xyz.com";

try{

Properties props=System.getProperties();

props.put("mail.smtp.host", mailhost );

Session ses=Session.getInstance(props,null);

ses.setDebug(false);

MimeMessage msg=new MimeMessage(ses);

msg.setFrom(new InternetAddress("from"));

msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("to@add.com",false));

msg.setSubject("subject");

String str="test Mail";

msg.setContent(str, "text/html");

Transport.send(msg);

}

catch(Exception e)

{

}
About | Sitemap | Contact