import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
Properties property = new Properties();
property.put("smtp server", "test.com");
Session s = Session.getInstance(property,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("from@test.com");
message.setFrom(from);
InternetAddress to = new InternetAddress("to@test.com");
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("Test from JavaMail.");
message.setText("Hello from JavaMail!");
Transport.send(message);
at 2/14/2008 02:21:00 PM
沒有留言:
張貼留言