文档介绍:作者:halfhour
日期:2001-5-21 11:10:33
import .*;
import ..*;
import .*;
public class sendMail
{
public static void main(String args[]) throws Exception
{
String host = "smtp.";
String from = "javamail@";
String to = "javamail@";
String username = "javamail";
String password = "password";
// Get system properties
// Properties props = (); 很多例子中是这样的,其实下面这句更好,可以用在applet中
Properties props = new Properties();
// Setup mail server
("", host);
("", "true"); //这样才能通过验证
// Get session
Session session = (props);
// watch the mands go by to the mail server
(true);
// Define message
MimeMessage message = new MimeMessage(session);
(new Address(from));