You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently some mailer clients can send emails that contain one or multiple inline attachment, without any contentId :
From: Test <test@example.com>
Content-Type: multipart/mixed;
boundary="Apple-Mail=_DF026BAA-42B1-476C-A89F-A2B2D388A362"
Subject: test PJ
Message-ID: <87B0499D-EFFC-424C-8B68-45B6CBDDBA29@resabase.com>
Date: Thu, 15 Jun 2017 09:52:02 +0200
To: Test <test@example.com>
X-Mailer: Apple Mail (2.3273)
MIME-Version: 1.0
--Apple-Mail=_DF026BAA-42B1-476C-A89F-A2B2D388A362
Content-Disposition: inline;
filename="ALERTE SOCIALE 12 juin 2017.pdf"
Content-Type: application/pdf;
x-unix-mode=0644;
name="ALERTE SOCIALE 12 juin 2017.pdf"
Content-Transfer-Encoding: base64
...
--Apple-Mail=_DF026BAA-42B1-476C-A89F-A2B2D388A362
Content-Disposition: inline;
filename="ALERTE SOCIALE 12 juin 2017.pdf"
Content-Type: application/pdf;
x-unix-mode=0644;
name="ALERTE SOCIALE 12 juin 2017.pdf"
Content-Transfer-Encoding: base64
...
--Apple-Mail=_DF026BAA-42B1-476C-A89F-A2B2D388A362--
In this case, the email contains 2 attachments, but the MimeMessageParser's cidMap contains only one, with a null key.
A way to fix this would be to handle an INLINE Content-Disposition without contentID just as a standard attachment :
final DataSource ds = createDataSource(part);
// If the diposition is not provided, the part should be treat as attachment
if (part.getDisposition() == null || Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
this.attachmentList.put(parseResourceName(part.getContentID(), part.getFileName()), ds);
} else if (Part.INLINE.equalsIgnoreCase(part.getDisposition())) {
if (part.getContentID() != null) {
this.cidMap.put(part.getContentID(), ds);
} else {
// Missing contentID : treated as standard attachment
this.attachmentList.put(parseResourceName(null, part.getFileName()), ds);
}
} else {
throw new IllegalStateException("invalid attachment type");
}
Sincerely,
The text was updated successfully, but these errors were encountered:
bbottema
changed the title
MimeMessageParser skips inlined parts without contentID
Parse INLINE attachments without ID as regular attachments when converting
Aug 12, 2017
Hello,
Apparently some mailer clients can send emails that contain one or multiple inline attachment, without any contentId :
In this case, the email contains 2 attachments, but the MimeMessageParser's
cidMap
contains only one, with anull
key.A way to fix this would be to handle an INLINE Content-Disposition without contentID just as a standard attachment :
Sincerely,
The text was updated successfully, but these errors were encountered: