public static void main(String[] args) {
try {
String to;
Properties props = new Properties();
props.put("mail.smtp.host", "mail.climbingvine.ca");
Session session = Session.getDefaultInstance(props, null);
session.setDebug(false);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("support@climbingvine.ca"));
to = "web_directory@somewhere.com";
if (to == null) {
return;
}
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("Graduate Application Notification");
msg.setSentDate(new Date());
MimeBodyPart mbp1 = new MimeBodyPart();
body = createMessageBody(req, res);
mbp1.setText(body);
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
msg.setContent(mp);
Transport.send(msg);
}
}