Debug.logError("Email message that could not be created to [" + sendTo + "] had context: " + context, module);
return ServiceUtil.returnError(errMsg);
}
try {
Transport trans = session.getTransport("smtp");
if (!useSmtpAuth) {
trans.connect();
} else {
trans.connect(sendVia, authUser, authPass);
}
trans.sendMessage(mail, mail.getAllRecipients());
results.put("messageId", mail.getMessageID());
trans.close();
} catch (SendFailedException e) {
// message code prefix may be used by calling services to determine the cause of the failure
String errMsg = "[ADDRERR] Address error when sending message to [" + sendTo + "] from [" + sendFrom + "] cc [" + sendCc + "] bcc [" + sendBcc + "] subject [" + subject + "]";
Debug.logError(e, errMsg, module);
Debug.logError("Email message that could not be sent to [" + sendTo + "] had context: " + context, module);