I am using Microsoft Graph to fetch mail and I recently noticed when an email has a .eml attachment, there are two cases:
If the sender attach that email through drugging emails to the composer, the attachment will be an item attachment type. <-- I can handle this case
If the sender attaches a .eml file through clicking "attach file", that attachment will be a type of file attachment. Up to this point, I think it is fine to be a file attachment. But when I try to fetch that attachment, the attachment content type is application/octet-stream which is wrong. Shouldn't it be message/rfc822? With application/octet-stream, I cannot create that attachment from our server.
It isn't wrong, application/octet-stream simply represents a generic/unknown binary file. From RFC 2046 § 4.5.1:
The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.
Your application can make its own determination on how to handle the file. In this case, the .eml is just a text file. You can simply fetch the attachment and treat it as raw text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With