Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9395

EmailServices.sendMailFromScreen improved to take multiple attachments with appropriate type along with several email fixes

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Release
    • Component/s: framework
    • Labels:
      None

      Description

      This patch fixes a number of issues combined in a patch because of the code dependencies.

      Firstly it enables to add BCC adress(es) to service OrderServices.sendOrderNotificationScreens to oversteer ProductStoreEmailSetting of BCC the same was as for CC.

      Secondly 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.

      Thirdly 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 exception handling is always the same.

        Issue Links

          Activity

          Hide
          mbrohl Michael Brohl added a comment -

          Thanks Martin,

          your patch is in trunk r1805459.

          Show
          mbrohl Michael Brohl added a comment - Thanks Martin, your patch is in trunk r1805459.
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Hi Martin, Michael,

          As mentionned on dev ML, this broke the sendMailFromScreen service which is used in most of emails sending, eg:

          2017-10-01 10:11:04,878 |OFBiz-JobQueue-0     |ModelService                  |E| [ModelService.validate] : {sendMailFromScreen} : (IN) Required test error: org.apache.ofbiz.service.ServiceValidationException:
           Unknown parameter found: [sendMailFromScreen.attachmentType]
          2017-10-01 10:11:04,878 |OFBiz-JobQueue-0     |ServiceDispatcher             |E| Incoming context (in runSync : sendMailFromScreen) does not match expected requirements
          org.apache.ofbiz.service.ServiceValidationException: Unknown parameter found: [sendMailFromScreen.attachmentType]
                at org.apache.ofbiz.service.ModelService.validate(ModelService.java:681) ~[ofbiz.jar:?]
                  at org.apache.ofbiz.service.ModelService.validate(ModelService.java:585) ~[ofbiz.jar:?]
                  at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:377) [ofbiz.jar:?]
                  at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:227) [ofbiz.jar:?]
                  at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88) [ofbiz.jar:?]
           at org.apache.ofbiz.order.order.OrderServices.sendOrderNotificationScreen(OrderServices.java:2680) [ofbiz.jar:?]
                 at org.apache.ofbiz.order.order.OrderServices.sendOrderPayRetryNotification(OrderServices.java:2530) [ofbiz.jar:?]
          

          Could you please fix it or revert?

          Thanks

          Show
          jacques.le.roux Jacques Le Roux added a comment - Hi Martin, Michael, As mentionned on dev ML, this broke the sendMailFromScreen service which is used in most of emails sending, eg: 2017-10-01 10:11:04,878 |OFBiz-JobQueue-0 |ModelService |E| [ModelService.validate] : {sendMailFromScreen} : (IN) Required test error: org.apache.ofbiz.service.ServiceValidationException: Unknown parameter found: [sendMailFromScreen.attachmentType] 2017-10-01 10:11:04,878 |OFBiz-JobQueue-0 |ServiceDispatcher |E| Incoming context (in runSync : sendMailFromScreen) does not match expected requirements org.apache.ofbiz.service.ServiceValidationException: Unknown parameter found: [sendMailFromScreen.attachmentType] at org.apache.ofbiz.service.ModelService.validate(ModelService.java:681) ~[ofbiz.jar:?] at org.apache.ofbiz.service.ModelService.validate(ModelService.java:585) ~[ofbiz.jar:?] at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:377) [ofbiz.jar:?] at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:227) [ofbiz.jar:?] at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88) [ofbiz.jar:?] at org.apache.ofbiz.order.order.OrderServices.sendOrderNotificationScreen(OrderServices.java:2680) [ofbiz.jar:?] at org.apache.ofbiz.order.order.OrderServices.sendOrderPayRetryNotification(OrderServices.java:2530) [ofbiz.jar:?] Could you please fix it or revert? Thanks
          Hide
          mbrohl Michael Brohl added a comment -

          Fixed in r1810260.
          Thanks for spotting the missing attributes, Jacques.

          Show
          mbrohl Michael Brohl added a comment - Fixed in r1810260. Thanks for spotting the missing attributes, Jacques.

            People

            • Assignee:
              mbrohl Michael Brohl
              Reporter:
              mbecker Martin Becker
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development