Puedes usar los paquetes:
javax.mail.*
javax.mail.internet.*
Un ejemplo aqui lo tienes:
----------------------------
public static void send(String smtpHost, int smtpPort,
String from, String to,
String subject, String content)
throws AddressException, MessagingException {
// Create a mail session
java.util.Properties props = new java.util.Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.auth","true");
auth = new MyAuthenticator("
[email protected]", "ani");
Session session = Session.getDefaultInstance(props, auth);
// Construct the message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(content);
// Send the message
Transport.send(msg);
}
public static void main(String[] args) throws Exception
{
send("mail2.miservidor.com", 25, "
[email protected]", "
[email protected]",
"re: cena", "mensaje de ani ......");
}
----------------------------