if (bodyObj instanceof String) {
String body = (String) bodyObj;
body = applyPatterns(rConfig.bodyPatterns, rConfig.bodySubstitutions, rConfig.bodyFlags, body, debug, this);
String contentType = mail.getMessage().getContentType();
if (charset != null) {
ContentType ct = new ContentType(contentType);
ct.setParameter("charset", charset);
contentType = ct.toString();
}
mail.getMessage().setContent(body, contentType);
mod = true;
contentChanged = true;
}
}
if (charset != null && !contentChanged) {
ContentType ct = new ContentType(mail.getMessage().getContentType());
ct.setParameter("charset", charset);
String contentType = mail.getMessage().getContentType();
mail.getMessage().setContent(mail.getMessage().getContent(), contentType);
}
if (mod) mail.getMessage().saveChanges();