mikel / mail

A Really Ruby Mail Library
MIT License
3.62k stars 936 forks source link

Attachments/parts not parsed from real-world email #1329

Open steobrien opened 5 years ago

steobrien commented 5 years ago

Here’s an anonymized version of an email we came across (a Jira notification):

Raw email ``` Delivered-To: examplep@company.com Received: by 2002:a05:6000:108d:0:0:0:0 with SMTP id y13csp13744073wrw; Wed, 13 Mar 2019 14:50:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7mPKcRctqXcBKcg5CVl4NueHCPf3g06cgi9tpGswLpM7zNJcetyO8G0irZe8DHF/gqJFo X-Received: by 2002:ac8:7606:: with SMTP id t6mr16598956qtq.243.1552513805290; Wed, 13 Mar 2019 14:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552513805; cv=none; d=google.com; s=arc-20160816; b=moZWmZHtDWtOYtKPhoXN36zWN/TS1dpQqsyDQlrNX22q79KeA2OVUQJSfoKOT/LWIH b3kXF6IvIVpAjq0LYvagbl+u6YX79rDQDeC2J2eoioRB5LcpihZDyEy/68LzSUy89BsZ +ZhVlKTvqMV68qS9iLddoOg9NxdXStiOQ1e/ZAqtk6dLA7SrGjLSVt/vfWNoZFQ1YGfd Z/5Ccbq1qX0ZF8zVssEHVeRZoKbfPI5lcu2w633TagujbD8rN64XyfNs62bCtH9ET+SH ynZpJMobFRzGJ+4i5B9tS+HvmeMP9JUuDfQmFwgyiP6DiSxvLWAi14fvi+JqbnBsoPDn S2Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:precedence:auto-submitted:mime-version:subject :message-id:to:from:date:dkim-signature:dkim-signature; bh=DBHSNv0eq5QWpQ6X0SJlqwYKN6RZlnR94Fb5PlhzeEs=; b=niQS1cFFh0nWd3p/QtX98fF1P8lIhl8AZju3uKnUb6YO1CV6C7781pA37noEm1l7Nq 3vnB02eK5AvfmT6Gwwi0mF7/+DpQghcsO1r5t9K3n3HORrTT7/MhsXXez0D14KHwYGKq b5OYFKCkanQsC3KTOTf+p4iTtVG4kM6Eysb6Ru9tpA6YfGBtUy+wmK2+GP2N2HeytnFQ X+Z5DM5SQyMkAU/b8+TdJIHbpwRn7uVMI4dRYCj8dhU6cHSVu65C4RU5Ch947Cfyp+uQ +u/Zm0RxEl/dUBwNoghDfH+91BSnX8KPn4Q/DhJcBMb6B0MVDUHb+jAKOOb+ZbNHdG6s i2tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@company.com header.s=bnhupe3uxaibdavzdli42szjrzik6ehc header.b="gUU+w1q/"; dkim=pass header.i=@service.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=m+k2E4A6; spf=pass (google.com: domain of 010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@service.com designates 54.240.8.97 as permitted sender) smtp.mailfrom=010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@service.com Return-Path: <010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@service.com> Received: from a8-97.smtp-out.service.com (a8-97.smtp-out.service.com. [54.240.8.97]) by mx.google.com with ESMTPS id g4si1444434qki.69.2019.03.13.14.50.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Mar 2019 14:50:05 -0700 (PDT) Received-SPF: pass (google.com: domain of 010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@service.com designates 54.240.8.97 as permitted sender) client-ip=54.240.8.97; Authentication-Results: mx.google.com; dkim=pass header.i=@company.com header.s=bnhupe3uxaibdavzdli42szjrzik6ehc header.b="gUU+w1q/"; dkim=pass header.i=@service.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=m+k2E4A6; spf=pass (google.com: domain of 010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@service.com designates 54.240.8.97 as permitted sender) smtp.mailfrom=010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@service.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=bnhupe3uxaibdavzdli42szjrzik6ehc; d=company.com; t=1552513804; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type; bh=j+lW4T6pS6/mp8Pv87KwMxkt/FkLpXHTDDZ4Tihd8hs=; b=gUU+w1q/AX7PazrauLMCvcfwRa/cD1w4JmCvVfUYRjszL75/FR9NpStT63B7Hho8 xAZzKseHoOyokyIeP3zWiPYHasj9yT9M31ILskY3qo/MMxpyCv2h6PThGXTWkZ9MU9q YNA05NGxk5Qbq+MfbX0TMt4QdKXXLq9L+oqfBRpM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=service.com; t=1552513804; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type:Feedback-ID; bh=j+lW4T6pS6/mp8Pv87KwMxkt/FkLpXHTDDZ4Tihd8hs=; b=m+k2E4A6UTg2rO82PmmWew8riveshOhTlA+EtcjZe1AxjD2eELbXe9dkpPlw1c/Y FlAIYCLhKKzUYD8+uIw2RBkXSzqir9oeqJLBgl5+L02hi38oGklXQixgM/Ba737OHU5 MsSRnox82SlunbBiMfX2o1o894FjPoudHjc78JF4= Date: Wed, 13 Mar 2019 21:50:04 +0000 From: "Other Person (JIRA)" To: examplep@company.com Message-ID: <010001697908a842-5d693d79-52c1-46db-8087-fa32f516e764-000000@email.service.com> Subject: [JIRA] Other Person mentioned you on EXAMPLE-117 (JIRA) MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1167_2042902750.1552513803256" X-JIRA-FingerPrint: 7d29f0bc8cd3f727e720af4f92fbbd00 Auto-Submitted: auto-generated Precedence: bulk X-SES-Outgoing: 2019.03.13-54.240.8.97 Feedback-ID: 1.us-east-1./wVgWJaec4m7FrrjdJPulCbkcLW8wy7kXqubSLnQq/k=:service ------=_Part_1167_2042902750.1552513803256 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20 =20 =20 =20 Message Title=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
=20 =20 =20 =20 =20 =20
Other Person mentioned you on= 3D"Story" EXAMPLE-117
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
 =20
=20 =20 =20 =20 =20
Re: Link to COMPANY Pay Affilia= te UI in Example UI
=20 =20 =20 =20 =20

Test Test, Example Test, need your help= with that: https://confl= uence.corp.company.com/display/HASPAY/Testing+Testingit+UI+of+Example+with+T= EST+XXX+UI

This is the first draft = solution description to resolve this problem. I'm going to elaborate it to = specific requirements further.

Can you = please:

=20
    =20
  • read this d= escription,
  • =20
  • give your f= eedback: is there something that I'm missing? does this go along with your = ideas of how we should resolve it?
  • =20
  • give your c= omments (you can comment right on that Confluence page) on the sentences ma= rked with 'TBD',
  • =20
  • guide me to= any other person who can give more details on those questions.
  • =20

Thanks!

=20 =20 =20 =20 =20
= =20 =20 =20 =20 =20 =20
3D"Add Add Comment
 
=20 =20 =20 =20 =20 =20
Th= is message was sent by Atlassian JIRA (v7.9.0#79000-sha1:3ca552e) =20 =20 =20 =20 =20
3D"Atlassian
=20 ------=_Part_1167_2042902750.1552513803256 Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: inline Content-ID: iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAHXRFWHRqaXJhLXN5c3RlbS1pbWFn ZS10eXBlAGF2YXRhcuQCGmEAAAtISURBVHjafVfnXxTXGt5/Qtg2O7PLFnbBBemsCIqiYkGiKBAQ RWwUxSBFLICFRVEQRRQbSFNBAQWJigRE0FhiAWwXFRPN1auJxlg/Pvc9sysxN8n98P7OzJmZ8zzn ect5R6JS8uAUKgyPis/3trnPxosjm+P+wVT0HT+8DqfgILB78dp2zymUUMq5P5nkSxDO/jIjoVb+ mYRGKRCJP8A+z6s5FcwmPbzcjRjtbUaQnwd8PUdC76Sm9wU7MCeuawNV/H8CDICnDxgBBijYQXn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GXMBNlqxajfW8+bhzdhVtNe1Ba2YDE4mPY2nQRW451 Izm/HH5jQ0SV2d8QM6Y2M0lR/RkUN3WjoOEC1tedR05NBzYe7cK6qnNYc/AUcg+1oSQ/Bz2Hd1J1 W4XmbVk4snE56vJSyJbh7Pa1uEnP7jfvR39rNUqrG5FU3EDgl1B+rg+rDrSJa26o7cCCLCu8LaNh dDaKKqtk5IItDd2w1l/AhrouWBt6UXCsBwXHe2mB75FTdQYZu5tQThWvv7USnZT7PZVb0Vq8Gm3b V6N7/yYMNJZhsK0K1+i0zK86jaSSRpScuobKrtvIrW6njXQgn9bfdPQCrX8Baw80Y/JXUfSf4CS6 +79PLOd7+YfRKgAAAABJRU5ErkJggg== ------=_Part_1167_2042902750.1552513803256 Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: inline Content-ID: iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEX///+1tbWzs7OysrKrq6um pqalpaWdnZ2ZmZn///+VlZWPj4/7+/vu7u7p6enn5+fl5eXk5OTh4eHW1tbT09PMzMzJycm6urq5 ubm1tbWzs7OysrKrq6upqamlpaWKioqFhYWRkZGKioqHh4eDg4OAgIB/f398fHx6enp4eHh2dnZ0 dHRycnJwcHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAIFWMjAAAAIXRSTlMAIiIzZoiZu8zd3d3u7u7u7u7u7u7u7u7u7u7u7u7u7u6n leogAAAAG3RFWHRqaXJhLXN5c3RlbS1pbWFnZS10eXBlAGljb266KjlFAAAAo0lEQVR42l2P2wrC MAyG09Pa1SqKzIk3QwTf/3G8UByKyK4EcV0POqzDaTUQwv+R/EkA/gKFJGyuQrFH/+iAWJnGOCCp THcmALms6ne7ykpNeFHpft75xZWsL/XX0bMppj7eUXNseQykI7eZu3+0GpfYuVz1ephriwAnxdkD QVwIsTVAoTUswZNBuPRkw6X01cqzZtMbdWB0aFqIANqb349ZLJ5XFjQIuveaPQAAAABJRU5ErkJg gg== ------=_Part_1167_2042902750.1552513803256 Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: inline Content-ID: iVBORw0KGgoAAAANSUhEUgAAAKkAAAAkCAYAAADy+xopAAAAG3RFWHRqaXJhLXN5c3RlbS1pbWFn ZS10eXBlAGxvZ287MIqNAAAFV0lEQVR42u2cLbPrIBCGq1A4VFQUqg4VhUKh4qKizt89+U3ntjNk LpcB9oO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ei4w2UQY2JSTSDwQMEC2Ylu0Satl2mSQ2H vyuJDH7zAhYslrqSe/qPuqC2yQIdM1kdOr71uTGpabsrBaVU8Nd0auqDZeJsIM0YJtGdAqIP+3EL r60sQKWxIK6MVSeviztKp3xwLjg3kNpAhP8XBqZ5z4DU9GhHrjGJppUfG/rMMcqv4pAmk4D54gha 3RhTh/6o8knj1qyJvji5VdJMuD1bebRvEl1iHa0mvokxOjeQBkyHVprPkYE1TMzmusvEmUcOpKXj uEJHkO4MvrfP8bbI8Nnm45Wa60LHe11PQW0Zq3m20X3ImLiCYT/XelxY2gZSDgiu7wxw3XduIyCr w0L4XNhI1Et/ZR76PIuXRLQB0tKTAQOPdJHPayYrYT5jGhF/uS3gFI4Tzk20724NfS6pzk7PwsP3 ddVX50D2Mfe5IbrOPFesDrzfCTs0YavMwC5b8vsOTFZssAgrck9hWZQ46VcKuLEuTAupSX8cFz4P Fgn+3VryGnm6ib4uHh/DiMm9gYF5cUEVSp06nW+Vfsr7P2pICseXwfgnBpei1Oix8sBY9a8AAwDk nvfbckn7YgAAAABJRU5ErkJggg== ------=_Part_1167_2042902750.1552513803256 Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: inline Content-ID: iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAHXRFWHRqaXJhLXN5c3RlbS1pbWFn ZS10eXBlAGF2YXRhcuQCGmEAAADzSURBVHjaY2AYBUggdZeVQfJOm+1A/Dx5l81/KuP3QLw/aZe1 CW7Ld9l8poHF6Ph3ym5rCwwHpOy02U0Hy2H4MIYDaBTsOKMD0wH0sxyMh54DOk5l/X/3/dV/QuDD z7f/e88UUN8BxFiO7AiqO4BUMOqAUQeMOmBkOODvvz//f/39OXAOmHKhElzsYnMEzR2w+e4CuNzS 6/30dcCRp9v+p+62R5Hf/3g9fRxw6/3F/xl7nLCqOffyEO0c8Prb8/+PPt36n7/fG6ea3H0e/+9/ vA5WO/waJLR3wEA3Sge8WT7gHROYI6Ah8ZpGXbPDOC0fsQAAPF0rYTBnzJQAAAAASUVORK5CYII= ------=_Part_1167_2042902750.1552513803256-- ```

This mail displays correctly in clients like Gmail, and is parsed by other tools like http://www.mimedecoder.com/.

However, Mail does not detect the attachments:

parsed = Mail.read_from_string(raw)
parsed.attachments.count
# => 0

parsed.parts.count
# => 0

One last detail: I noticed that there was an error with parsing the Received header, but a quick spike to tolerate malformed content there (https://github.com/considerhq/mail/compare/s/tolerant-received?expand=1) did not help with attachments parsing.

lao9 commented 5 years ago

I think I was able to isolate the source of this issue. Without the Content-Location: [something] field to the attachment section, Mail is unable to recognize the attachments. Here is a small sample:

This Works

Mime-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <9169D984-4E0B-45EF-82D4-8F5E53AD7012@example.com>
From: foo@example.com
Subject: testing
Date: Mon, 6 Jun 2005 22:21:22 +0200
To: blah@example.com

--Apple-Mail-13-196941151
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
    charset=ISO-8859-1;
    delsp=yes;
    format=flowed

This is the first part.

--Apple-Mail-13-196941151
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Location: Photo25.jpg
Content-ID: <qbFGyPQAS8>
Content-Disposition: inline

jamisSqGSIb3DQEHAqCAMIjamisxCzAJBgUrDgMCGgUAMIAGCSqGSjamisEHAQAAoIIFSjCCBUYw
ggQujamisQICBD++ukQwDQYJKojamisNAQEFBQAwMTELMAkGA1UEBhMCRjamisAKBgNVBAoTA1RE
QzEUMBIGjamisxMLVERDIE9DRVMgQ0jamisNMDQwMjI5MTE1OTAxWhcNMDYwMjamisIyOTAxWjCB
gDELMAkGA1UEjamisEsxKTAnBgNVBAoTIEjamisuIG9yZ2FuaXNhdG9yaXNrIHRpbjamisRuaW5=

--Apple-Mail-13-196941151--

Does Not Work

Mime-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; 
boundary=Apple-Mail-13-196941151
Message-Id: <9169D984-4E0B-45EF-82D4-8F5E53AD7012@example.com>
From: foo@example.com
Subject: testing
Date: Mon, 6 Jun 2005 22:21:22 +0200
To: blah@example.com

--Apple-Mail-13-196941151
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
    charset=ISO-8859-1;
    delsp=yes;
    format=flowed

This is the first part.

--Apple-Mail-13-196941151
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-ID: <qbFGyPQAS8>
Content-Disposition: inline

jamisSqGSIb3DQEHAqCAMIjamisxCzAJBgUrDgMCGgUAMIAGCSqGSjamisEHAQAAoIIFSjCCBUYw
ggQujamisQICBD++ukQwDQYJKojamisNAQEFBQAwMTELMAkGA1UEBhMCRjamisAKBgNVBAoTA1RE
QzEUMBIGjamisxMLVERDIE9DRVMgQ0jamisNMDQwMjI5MTE1OTAxWhcNMDYwMjamisIyOTAxWjCB
gDELMAkGA1UEjamisEsxKTAnBgNVBAoTIEjamisuIG9yZ2FuaXNhdG9yaXNrIHRpbjamisRuaW5=

--Apple-Mail-13-196941151--

Is this intentional?

saghaulor commented 5 years ago

@steobrien what are the line endings in your problematic email? I've noticed that the Mail::Body#extract_parts method requires CRLF line endings, and sometimes we seem to receive mail with only LF endings. When this happens, the email isn't parsed correctly. Perhaps this is your issue?

steobrien commented 5 years ago

Thanks for the tip. Don't have time to check right now, but @lao9 captured a failing test case in her PR, if that could be of interest to you: https://github.com/mikel/mail/pull/1350/files#diff-525687bb61fad571b82fcb18ffc06375