Java Reference
In-Depth Information
props.put("mail.smtp.port", "587");
session = Session.getInstance(props, null);
}
public void sendMesage(String message, String
toAddress) {
try {
Message msg = new MimeMessage(session);
InternetAddress[] internetAddresses =new
InternetAddress[1];
internetAddresses[0] = new
InternetAddress(toAddress);
msg.setRecipients(Message.RecipientType.TO,
internetAddresses);
msg.setSubject("Pre-inscription results");
msg.setText(message);
Transport.send(msg, userName,
userPassword);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Of course, the JavaMail API provides the ability to retrieve messages, attach doc-
uments to your messages, write messages in HTML format, and do lots of other
things.
The latest improvements in action
Although it is affected by a maintenance release, the JavaMail 1.5 Specification has
undergone many changes. The most important can be grouped into three categor-
Search WWH ::




Custom Search