'What is the MIME type of .eml files in emails
I want to attach a MTA report (not delivered bounce mail) to an email, but what is the correct MIME type?
I fetch the full body of the MTA report with
$body = imap_fetchbody($this->Mailbox->stream, $this->header->uid, '', FT_UID);
But what is the correct MIME type for attached .eml files?
Have tried message/rfc822
but when you open the file in Thunderbird the popup windows is empty. Have also tried text/plain
but then the attachment is opended as plain text. I want to open the attachment .eml as an email
When you receive a MTA report (not delivered) the bounce mail is always forwarded as an attachment
I want to attach the full MTA report + forwarded bounce mail to a new mail
Solution 1:[1]
Content-Type: application/octet-stream
should do the trick.
Our (proprietary) mail client at work just sets Content-Type: application/octet-stream; name="xxx.EML" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xxx.EML"
, and is able to open the received attachment “as” an email again via double click. Since that mime type is anything but specific, I suppose it falls back onto the file type handler registered for the .eml
suffix on the OS level.
Solution 2:[2]
There is no mime type for it based on list as of 2020-12-23. See:
http://www.iana.org/assignments/media-types/media-types.xhtml
Solution 3:[3]
message/rfc822
("encapsulated message") works, at least with ReactDropzone. That string is what's reported as Type when an .eml file is dropped. (YMMV.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | CBroe |
Solution 2 | Batyuvitez |
Solution 3 | Freewalker |