here's a short method...
import java.io.PrintStream;
import java.io.IOException;
import sun.net.smtp.SmtpClient;
public static void sendMail(String strHostName, // email host server who
will send the mail; e.g., "myhost.com"
String strFromWhom, // the return address;
e.g., "[EMAIL PROTECTED]"
String strToWhom, // receipient; e.g.,
"[EMAIL PROTECTED]"
String strSubject, // subject of the message
String strMessage // the message itself
) {
PrintStream OutMail;
SmtpClient sendmail;
try{
sendmail = new SmtpClient(strHostName); //"email.cind.ornl.gov");
//mail.somewhere.com");
sendmail.from(strFromWhom);
sendmail.to(strToWhom);
OutMail = sendmail.startMessage();
OutMail.println("From: " + strFromWhom );
OutMail.println("To: " + strToWhom );
OutMail.println("Subject: " + strSubject );
OutMail.println( "\n*********************\n" );
OutMail.println(strMessage);
//--- Complete the mail, and send it
OutMail.print("\r\n");
OutMail.println( "\n*********************\n" );
OutMail.flush();
OutMail.close();
sendmail.closeServer();
}
catch ( IOException E ){E.printStackTrace();}
}
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html