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

When using ${type} and ${contentType} in the Form component E-Mail text, these values get overwritten.

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • Backend, Templates
    • Yes
    • Yes

      To reproduce:

      1. create new form component
      2. add two textfields, one with the fieldname "type" and the other with the fieldname "contentType"
      3. add ${ type } and ${ contentType } to the email text in the form component dialog
      4. send the form
      5. in the mail text the values of those fields have been overwritten with "freemarker" and "html" or "text" depending on the mail type you configured

      The problem lies in the method info.magnolia.module.mail.MgnlMailFactory#getEmailFromType

              Map<String, Object> newParams = new HashMap<String, Object>();
              newParams.putAll(params);
              if(!StringUtils.isEmpty(type)) {
                  newParams.put(MailTemplate.MAIL_TYPE, type);
              }
              if(!StringUtils.isEmpty(contentType)) {
                  newParams.put(MailTemplate.MAIL_CONTENT_TYPE, contentType);
              }
              return getEmail(newParams, attachments);
      

      Here the parameters are overwritten, with the put() method.

      The contentType param may not be that big of a problem, but recently one of our customers named one of its form fields "type" and was surprised to always get "freemarker" as value in the email text.


      Improvement expectation:
      Separate email built-in parameters with other params such as Form processor params so that customers won't have to mind about this issue.

        Acceptance criteria

              Unassigned Unassigned
              cbalaguer Christian Balaguer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:

                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 1h
                    1h