emailing dynamically generated html content
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jayesh_jadhav
Posted On:   Tuesday, March 26, 2002 11:38 AM

How do i email dynamically generated html content by JSP using Javamail in my JSP application?

Re: emailing dynamically generated html content

Posted By:   Jyothis_E  
Posted On:   Wednesday, March 27, 2002 02:46 AM

I dont know off JSP, but a javamail program that can send html content is here..

the variable FContent should b filled with the Dynamically generated values.

love, Je

import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class sendmail4 {
public static void main (String args[]) throws Exception {
String host = "xxx.xxx.xxx.xxx";//replace with the smtp host
String from = "you@urdomain.com";
String to = "she@herdomain.com";

String FContent="I LOVE YOU";

Properties props = System.getProperties();


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


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


Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject("I Love you");

message.setContent(FContent,"text/html");
Transport.send(message);
}
}

About | Sitemap | Contact