Skip to content

MailService - fix email structure with multiple attachments#113

Open
APaikens wants to merge 2 commits intodotkernel:5.2from
APaikens:5.2
Open

MailService - fix email structure with multiple attachments#113
APaikens wants to merge 2 commits intodotkernel:5.2from
APaikens:5.2

Conversation

@APaikens
Copy link

Outlook has problems sending emails, when there are multiple attachments.

"Expected response code "250" but got code "554", with message "554 5.6.0 Invalid message content when handling MIME exception. IMC53"

Analyzing generated email files found out, that there are problems with structure - old code nests each attachment on top of previous one.

Structure was
Content-Type: multipart/mixed; boundary=Btd1YvhJ ← level 1
Content-Type: multipart/mixed; boundary=rsZ9uNfm ← level 2 (WHY?)
Content-Type: multipart/mixed; boundary=sYDuS8mW ← level 3 (WHY?)
text/html (body)
PDF attachment
other attachment 9012
other attachment 9013

Structure after fix
multipart/mixed; boundary=XXX
text/html (body)
PDF attachment
other attachment 9012
other attachment 9013

After exploration there was conclusion about old solution:
Not strictly invalid per MIME RFC — but result has multipart/mixed inside multipart/mixed

The inner multipart only groups:
HTML body
one PDF
Then another attachment exists outside that group

This structure is redundant and irregular, and Outlook is known to behave unpredictably with nested multipart/mixed blocks like this.

Fix multiple file attachment - attachments now are attached as list, not nested recursively.

Signed-off-by: APaikens <shamanis@gmail.com>
Signed-off-by: APaikens <shamanis@gmail.com>
@arhimede
Copy link
Member

Outlook has problems sending emails, when there are multiple attachments.

Outlook does not send emails using this library, doh

@arhimede arhimede self-requested a review February 18, 2026 10:34
@arhimede
Copy link
Member

Please check the PHP Stan error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments