Jira should be handling the emails with multipart/alternative and text/plain part empty in a better way

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Mail Server
    • None
    • 0
    • 5

      Issue Summary

      When an email like below is received -

      Content-Type: multipart/alternative;
       ------=_Part_10622_-1984937784.1597332855711
       Content-Type: text/plain; charset="US-ASCII"
       Content-Transfer-Encoding: quoted-printable
       Content-Disposition: inline
      
      ------=_Part_10622_-1984937784.1597332855711
       Content-Type: text/html; charset="UTF-8"
       Content-Transfer-Encoding: quoted-printable
       Content-Disposition: inline
      
      <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">Se=
       example text<br><br>example text<br><br=
       >example text<br> <br><table><p><tr><td><b>example text</b></td><td><a href=
       =3D"<base_URL>/portal01/jsd/kbp/kbp-tools/rfqa?iFrameTarget=
       URL=3D/rfqa/redirect.iface%3Fglobeid%3DAU+++2020+002705">example hyperlink</a></td></tr>=
       <tr><td>sent</td><td><span>13.08.2020 09:11 </span></td></tr><tr><td>Example text</td><td><span>example text</span></td></tr><tr><td>Example text</td>=
      

      As we can see the text/plain part of the email is empty, Jira is adding an empty description to the ticket created.

      Steps to Reproduce

      • The customer is using a Jira mail Handler, configured in ⚙ > System > Incoming Mail
      • Below is a sample of incoming email which added an empty description:
        eml 2
      • As we can see:
        • the 1st part has "Content-Type: text/plain; charset="US-ASCII"", but the content is empty
        • the 2nd part has ""Content-Type: text/html; charset="UTF-8"", and the content is not empty (it has HTML)
      • If we try either removing of the following section from the eml file, then the ticket is created with a description that is not empty:
        • We tried to remove this:
          Content-Type: multipart/alternative;
           ------=_Part_10622_-1984937784.1597332855711
           Content-Type: text/plain; charset="US-ASCII"
           Content-Transfer-Encoding: quoted-printable
           Content-Disposition: inline
          
        • And we tried to remove this:
          Content-Type: multipart/alternative;
           ------=_Part_10622_-1984937784.1597332855711
           Content-Type: text/plain; charset="US-ASCII"
           Content-Transfer-Encoding: quoted-printable
           Content-Disposition: inline
          
      • The conclusion from these tests is that:
        • it seems that the Mail Handler only tries to parse the 1st part (which has empty content and text/plain type), rather than parsing the content of the 2nd part (which has HTML content and text/html type)
        • if the email only had 1 part with no empty content, the ticket would be properly created without content

      Expected Results

      Jira should handle these kind of messages more smartly, if the text/plain part is empty, then it should consider checking the second part. Jira could check if the content is empty and try the other alternative: com/atlassian/mail/MailUtils.java:521.

      Actual Results

      Jira ignores the second part and adds an empty description to the ticket.

      The type of the part that contains description is multipart/alternative and as you can see in https://tools.ietf.org/html/rfc2046#section-5.1.4:
      [...] each of the body parts is an "alternative" version of the same information. Systems should recognize that the content of the various parts are interchangeable. [...]
      so the text/plain type and text/html in the mail should contain the same data, but actually the text/plain part is empty which means that the email is malformed and Jira sticks to the standard. But Jira can be more intelligent to handle these situations.

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

            Assignee:
            Unassigned
            Reporter:
            Sandhya Thottamkara
            Votes:
            9 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: