if (contentType.startsWith("text")) {
mail.setText(body, "UTF-8", contentType.substring(5));
} else {
mail.setContent(body, contentType);
}
mail.saveChanges();
}
} catch (MessagingException e) {
Debug.logError(e, "MessagingException when creating message to [" + sendTo + "] from [" + sendFrom + "] cc [" + sendCc + "] bcc [" + sendBcc + "] subject [" + subject + "]", module);
Debug.logError("Email message that could not be created to [" + sendTo + "] had context: " + context, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonEmailSendMessagingException", UtilMisc.toMap("sendTo", sendTo, "sendFrom", sendFrom, "sendCc", sendCc, "sendBcc", sendBcc, "subject", subject), locale));