[MAGNOLIA-2451] Attachments are removed by Outlook Created: 27/Oct/08  Updated: 18/Sep/12  Resolved: 30/Aug/12

Status: Closed
Project: Magnolia
Component/s: mail
Affects Version/s: 3.6.1, 3.6.3
Fix Version/s: 4.5.5

Type: Bug Priority: Major
Reporter: Marcel van den Brink Assignee: Milan Divilek
Resolution: Fixed Votes: 1
Labels: attachment, mail, outlook
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to DOCU-310 Update mail documentation - mimeMulti... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

When sending an email with an attachment it is always considered to be a multipart message. The type of this message will be set to "related" (line 65 of the file MgnlMultipartEmail.java). This causes Outlook 2003 to remove the attachment. Most other mail clients do show it.

The problem is solved when setting the type to "mixed".



 Comments   
Comment by Magnolia International [ 13/Nov/09 ]

So this could be fixed in the info.magnolia.module.mail.templates.MgnlMultipartEmail#turnOnMultipart method; I'm not sure what the impacts are, and why it's currently set to "related", so we'll have to investigate; feel free to drop clues if you have any !

Comment by Magnolia International [ 13/Nov/09 ]

Is there any chance you could try this with javax.mail 1.4.2 or 1.4.1 ?

Comment by Edgar Vonk [ 10/Jul/12 ]

Just retested (for the Van Lanschot upgrade to Magnolia 4.5) in Magnolia 4.5 and the issue remains.. ;-( The attachment is not shown in Outlook 2007 on Windows. No problem with Mac Mail or with Outlook on the Mac (= a completely different product).

We are using javax.mail 1.4.1 as shipped with Magnolia 4.5.3.

Any chance of fixing this in Magnolia 4.5.x (4.5.4 preferably of course). Now we have to keep on forking the Magnolia Mail Module.

If you read the MIME type specs using the type 'mixed' is really the type you should be using for sending attachments. Not 'related'.

Also see this Outlook issue report about using 'related' instead of 'mixed' for sending attachments:

I think the issue related to malformed MIME. The content type of the email is not correct; it is multipart/related, and should be multipart/mixed

Comment by Milan Divilek [ 24/Aug/12 ]

This isn't related only to Outlook, but also to another mail clients (for example Mozilla Thunderbird 8.0). Depends how mail clients are working with attachments with different mime multipart-message.

if we simply change mime type from related to mixed, then the attachments which should be shown in text will be mounted just as normal attachments and then won't shown in text part of message. But MIME Types are not exclusive and can be combined into a single message.

So we created hierarchical structure in MgnlMultipartEmail :

  • MimeMultipartMixed - multipart/mixed
    • MimeMultipartRelated - multipart/related
      • the text part of email - text/plain, text/html
      • the attachments which are shown in text part of message - some mail clients also show those attachments like "normal attachments"
    • "normal attachments" connected only like attachments in mail clients. Those attachments are not used in text part of message.

This solution also introduced mimeMultipart property into MailAttachment. The property specifies in which part of structure of MgnlMultipartEmail will be attachment added. The mimeMultipart property should have values "mixed" or "related", with different value will be treated as "mixed". And for backward compatibility with mail templatesConfiguration. MailAttachments with not specified (null value) mimeMultipart property will be treated as "related".

Comment by Jan Haderka [ 27/Aug/12 ]

Port to 5.0 is missing.

     public boolean isMultipart() {
        return (this.multipartMixed != null);
     }

Doesn't seem correct. I know it is fine because the mixed part is encapsulating the related part as you have described in the comment in this issue, but it's not clear for anyone looking just at the code w/o knowing related issue. Either there needs to be similar comment in the code describing hierarchy that is being created or the variables need to be renamed.

Comment by Milan Divilek [ 27/Aug/12 ]

Port to 5.0:
https://git.magnolia-cms.com/gitweb/?p=modules/mail.git;a=commit;h=582a680bb78abd106cdb88c76ba6a3e30e3a45ab
https://git.magnolia-cms.com/gitweb/?p=modules/mail.git;a=commit;h=f87a321bfbcbc3eaaa21fa81145394fa9566d35d
https://git.magnolia-cms.com/gitweb/?p=modules/mail.git;a=commit;h=79121f60789a751a847f7e74ec83b6d7c06e0289

Generated at Mon Feb 12 03:36:51 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.