this.mailsTo = mailsTo;
this.sendMailWhenException = true;
}
private void warnExceptionByEmail(Throwable e) {
SimpleEmail email = new SimpleEmail(this.mailSmtp);
try {
email.setFrom(this.mailFrom, getNameProcess());
for (int i = 0; i < this.mailsTo.size(); i++) {
email.addTo((String)mailsTo.get(i));
}
email.setSubject(getNameProcess() + " Exception: " + e.getMessage());
StringBuffer message = new StringBuffer();
message.append("Foi lan�ada uma excep��o pelo Processo ").append(getNameProcess()).append(" causando o fim da sua execu��o � seguinte data: ").append(new DateTime(new java.util.Date()).formatDateTime());
message.append("\n\nStack Trace:\n");
message.append("\t").append(StringUtil.toString(e));
email.setMsg(message.toString());
email.send();
} catch (Exception mailException) {
logger.warning("Error sending exception mail: " + mailException);
}
}