Open steobrien opened 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:
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--
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?
@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?
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
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 forTest 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!
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:
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.