I use a helper library from oreilly to send smtp mail.  Here's how to use
it:

<%@ page import="com.oreilly.servlet*, java.io.*" %>
<%
String mailHost = "Name of a nice SMTP host who will send email from
anyone";
String from = "[EMAIL PROTECTED]";
String to = perhaps_a_dynamic_email_address;

try {
   MailMessage msg = new MailMessage(mailHost);
   msg.from(from);
   msg.to(to);
   msg.setSubject("Email is fun!");
   PrintStream message = msg.getPrintStream();
   message.println("One line a time");
   message.println(or_a_concatenated_string_variable);
   msg.sendAndClose();
} catch {UnknownHostException e) { }

%>

Download it from Oreilly's website www.oreilly.com the file is called
"cos.jar"

-CM

-----Original Message-----
From: Paul Enriquez [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 02, 2000 10:06 AM
To: [EMAIL PROTECTED]
Subject: Sending e-mail through JSP


Could someone show me (or direct me to) some sample code that sends an
e-mail programitically through JSP?

Thank you.

- Paul Enriquez

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to