-
-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Description
- bug report? yes
- feature request? yes
- version: 2.4
Wrong content type for .eml files added as attachment
Hi, if you add eml file (mail file) to mail message attachments and send, some mail servers (in my case seznam.cz) reply me:
You message for <...@...> from 2017/11/29 could not be delivered.
It's attached below.
Důvod / Reason:
---------------
5.6.5 ebox; ebox: bad argument: Rfc822 message part can not be conbinated with base64 encoding.
It noticed me about wrong content type of attachment, which is "correctly" set as Rfc822, but this content type is not allowed for attached files.
Chapter 4.4 of whitepapers from microsoft describes how to fix it: change content-type to APPLICATION/OCTET-STREAM.
This should be fine implemented at nette mail for example at Message.php.
public function addAttachment($file, $content = null, $contentType = null) {
$path = $file;
$ext = Strings::lower(pathinfo($path, PATHINFO_EXTENSION));
if ($ext == 'eml') {
$contentType = $contentType ?? 'APPLICATION/OCTET-STREAM';
}
return $this->attachments[] = $this->createAttachment($file, $content, $contentType, 'attachment');
}
What do you think about this change?
Regards,
Ondrej
Metadata
Metadata
Assignees
Labels
No labels