* {@inheritDoc}
*/
public void sendAlertNotification(AlertGenerator generator, String alertType,
Message alertMessage)
{
SMTPAlertHandlerCfg cfg = currentConfig;
ArrayList<String> recipients =
new ArrayList<String>(cfg.getRecipientAddress());
String alertIDStr;
String alertMessageStr;
if (alertMessage != null) {
alertIDStr = String.valueOf(alertMessage.getDescriptor().getId());
alertMessageStr = alertMessage.toString();
} else {
alertIDStr = String.valueOf(MessageDescriptor.NULL_ID);
alertMessageStr = "none";
}
String subject = replaceTokens(cfg.getMessageSubject(), alertType,
alertIDStr, alertMessageStr);
String body = replaceTokens(cfg.getMessageBody(), alertType, alertIDStr,
alertMessageStr);
EMailMessage message = new EMailMessage(cfg.getSenderAddress(), recipients,
subject);
message.setBody(Message.raw(wrapText(body, 75)));
try