Improved: EmailServices.sendMailFromScreen improved to take multiple
attachments with appropriate type along with several email fixes. (OFBIZ-9395) This patch fixes a number of issues combined in a patch because of the code dependencies. 1. it enables to add BCC adress(es) to service OrderServices.sendOrderNotificationScreens to oversteer ProductStoreEmailSetting of BCC the same was as for CC. 2. a method UtilValidate.isEmailList(String) is added to check a comma separated list of email addresses, used for example to check the String passed to the new BCC field for an Order-Notification. 3. there are improvements in EmailServices.sendMailFromScreen. The attachment type of MailAttachments is now not only .pdf but depends on the specific file. This has not been the case before - the mime type was always hard coded as .pdf. The same goes for the bodyPart content-type which is now set to the passed content type or the default text/html type. Before this was also always set to text/html. Additionally, an attachment that has the mime-type text/plain is not rendered with the fop-renderer anymore but with a simple text-renderer. Therefore it is possible to send an CSV file as attachment now. The patch also refactors some catch-Blocks in the EmailServices.sendMailFromScreen by using multi-catch since the e xception handling is always the same. Thanks Martin Becker for reporting and providing the patch. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1805459 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -691,6 +691,20 @@ public final class UtilValidate {
|
||||
if (isEmpty(s)) return defaultEmptyOK;
|
||||
return EmailValidator.getInstance().isValid(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks a String for a valid Email-List seperated by ",".
|
||||
*/
|
||||
public static boolean isEmailList(String s) {
|
||||
if (isEmpty(s)) return defaultEmptyOK;
|
||||
String[] emails = s.split(",");
|
||||
for (String email : emails) {
|
||||
if (!EmailValidator.getInstance().isValid(email)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** isUrl returns true if the string contains ://
|
||||
* @param s String to validate
|
||||
|
||||
Reference in New Issue
Block a user