%@ page import="java.util.*" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
JavaMail Test
<%
Properties props = new Properties(); // Properties associated w/this mail session
Session mailSession; // Current mail session
Transport transport; // Mail transport protocol object
// Initialize props, mailSession, transport
props.put("mail.smtp.host", "localhost");
mailSession = Session.getInstance(props, null);
transport = mailSession.getTransport("smtp");
String fromAddress = "info@interadvantage.com";
String toAddress = "info@interadvantage.com";
String subject = "Test message subject";
String body = "Test message body";
// Construct and send e-mail message
MimeMessage msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(fromAddress));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
msg.setSentDate(new Date());
msg.setSubject(subject);
msg.setText(body);
// Send the message
transport.send(msg);
%>
If you don't see any exception reports, then the test message was just sent successfully.