Map substitutions = ((JBossMonitorNotification) notification).substitutionMap();
String message = Strings.subst(messageTemplate, substitutions, "%(", ")");
String subject = Strings.subst(subjectTemplate, substitutions, "%(", ")");
try
{
Session session = (Session) new InitialContext().lookup("java:/Mail");
// create a message
//
Address replyToList[] = { replyTo };
Message newMessage = new MimeMessage(session);
newMessage.setFrom(from);
newMessage.setReplyTo(replyToList);
newMessage.setRecipients(Message.RecipientType.TO, to);
newMessage.setSubject(subject);
newMessage.setSentDate(new java.util.Date());
newMessage.setText(message);
// Send newMessage
//
Transport transport = session.getTransport();
transport.connect();
transport.sendMessage(newMessage, to);
}
catch (Exception ex)
{