4

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

clarkk
  • 27,151
  • 72
  • 200
  • 340
  • 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, though I could not say whether that was not probably due to the registered file ending. What happens when you send yourself a mail in Thunderbird, that you just attached an EML file to - does it work as desired then? If so, check the source code of that mail. – CBroe Jan 13 '21 at 09:20
  • @CBroe its seems to work with `application/octet-stream` create an answer :) – clarkk Jan 14 '21 at 00:22

3 Answers3

7

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.

CBroe
  • 91,630
  • 14
  • 92
  • 150
5

message/rfc822 ("encapsulated message") works, at least with ReactDropzone. That string is what's reported as Type when an .eml file is dropped. (YMMV.)

Freewalker
  • 6,329
  • 4
  • 51
  • 70
1

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

Batyuvitez
  • 11
  • 3