Uploaded image for project: 'Magnolia Mail Module'
  1. Magnolia Mail Module
  2. MGNLMAIL-49

info.magnolia.module.mail.templates.MgnlEmail.EMAIL_WITH_PERSONAL_PATTERN is wrong and superfluous

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 5.1.4, 5.2.2
    • None
    • Templates
    • None

    Description

      The pattern is used in info.magnolia.module.mail.templates.MgnlEmail.setFrom(String). If you call e.g. setFrom("Felix Rabe <felix.rabe@magnolia-cms.com>") which is completely valid, it will go down the "else" branch, as the regular expression does not match anything without '"'s or anything with a whitespace before "<".

      I propose to shorten the code to just:

          public void setFrom(String _from) {
              try {
                  InternetAddress address = new InternetAddress(_from, True);
                  this.setFrom(address);
              }
              catch (Exception e) {
                  log.error("Could not set from field of email:" + e.getMessage());
              }
          }
      

      and remove the wrong pattern altogether.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                rsiska Robert Šiška
                frabe Felix Rabe
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD