Categories About Us Contact Us Become a Member

How to fix “E12506 Unsupported file type” for .eml attachments

This is raised by email sending APIs when they cannot recognize the type of an attached .eml file. An .eml is a message/rfc822 file, and the API needs that type declared correctly. Jump to your situation below or work through the methods in order.

By Neeraj Singh ~7 min Updated Jun 2026 90% found this helpful
Error message
E12506: Unsupported file type. The system could not recognize the message/rfc822 MIME type of the file.
Summary

Error E12506 is returned by email sending APIs when they cannot recognize an attached .eml file's type. An .eml is a message/rfc822 file, and the API needs that content type declared, usually together with a correct .eml filename. The error appears when the type field is blank or wrong, when the file is sent as application/octet-stream or text/plain, when the platform simply does not allow the message/rfc822 type, or when MIME encoding rules are broken. There is an important rule here: RFC 2045 forbids base64 or quoted-printable encoding on composite types such as message/rfc822, so an .eml part must use 7bit, 8bit or binary, and any encoding has to be done on the inner bodies instead. The fix is to set the content type to message/rfc822, use a proper .eml filename, confirm the API allows the type, and follow the MIME encoding rules.

What this error means

When you attach a file, the API decides how to handle it from its declared content type. An .eml is an email message, whose MIME type is message/rfc822. If that type is missing, wrong, or one the platform does not accept, the API cannot tell what the file is and returns E12506.

There is also a MIME subtlety. message/rfc822 is a composite type, and RFC 2045 expressly forbids encoding composite parts with base64 or quoted-printable. So even with the right type name, applying base64 to the message/rfc822 part itself can make the file look invalid. Declaring the type correctly and respecting that encoding rule resolves the error.

Common causes

The content type was not set to message/rfc822.
The file is sent as application/octet-stream or text/plain.
The filename has the wrong extension or none at all.
The API or platform does not permit the message/rfc822 type.
Base64 was applied to the message/rfc822 part, which RFC 2045 forbids.
The type field was left blank.
The file is not actually a valid .eml message.
Expert insight

“E12506 is the API saying I do not know what this file is. An .eml has a specific identity, message/rfc822, and if you do not tell the API that, it shrugs. The fix is usually just setting the content type correctly and giving the file a real .eml name. The trap that catches developers is the encoding rule: you cannot base64 a message/rfc822 part, the standard forbids it, you encode the bits inside instead. Get the type right and respect that rule, and the file is recognized.”

How to fix it

Method 1

Set the content type to message/rfc822

1Declare the attachment's type as message/rfc822, which is the MIME type for an email message file.
2Do not send it as application/octet-stream or text/plain, which hide what the file is.
3Set the type in the API's attachment type field.
Method 2

Use a correct .eml filename

1Give the attachment a filename ending in .eml, for example message.eml.
2Some platforms detect the type partly from the extension, so a correct name helps.
3Avoid blank or mismatched filenames.
Method 3

Confirm the API allows the type

1Check the API documentation that message/rfc822 attachments are permitted.
2Some platforms restrict attachment types, in which case you may need to wrap or convert the file.
3If it is blocked, contact the provider or use an allowed type.
Method 4

Follow the MIME encoding rule

1Do not base64 or quoted-printable the message/rfc822 part itself, RFC 2045 forbids encoding composite types.
2Use 7bit, 8bit or binary for the message/rfc822 part, and encode the inner bodies if needed.
3This keeps the part valid so the API recognizes it.
Method 5

Validate the file is a real .eml

1Open the file and confirm it has proper email headers and a valid MIME structure.
2A file that only has an .eml name but is not a real message will still fail.
3Re-export it from a mail client if in doubt.
Method 6

Test with a known-good .eml

1Send a small, valid .eml with the type set to message/rfc822 to confirm the API accepts it.
2Once that works, the issue was the type, name or encoding on the original.
3Apply the same settings to your real file.

E12506 is a type-declaration problem. Setting the content type to message/rfc822 and giving the file a proper .eml name resolves most cases. Remember the RFC 2045 rule that composite types like message/rfc822 must not be base64-encoded at the part level, encode the inner bodies instead, or the file will look invalid no matter what type you declare.

Frequently asked questions

What does E12506 mean?
It means an email API could not recognize the type of an attached .eml file. An .eml is a message/rfc822 file, and the API needs that content type declared correctly.
What content type should I use for an .eml?
Use message/rfc822, the MIME type for an email message. Set it in the attachment's type field and give the file a .eml filename.
Why does setting application/octet-stream not work?
That type hides what the file is, so the API cannot treat it as an email message. Declare message/rfc822 so the .eml is recognized.
Can I base64-encode the .eml attachment?
Not the message/rfc822 part itself. RFC 2045 forbids base64 or quoted-printable on composite types, so use 7bit, 8bit or binary and encode the inner bodies if needed.
Does the file extension matter?
It can. Some platforms detect the type partly from the name, so use a proper .eml filename alongside the correct content type.
What if the API does not allow message/rfc822?
Check the documentation. If the type is blocked, you may need to convert or wrap the file, or contact the provider about allowing email message attachments.

Still not working?

If the type is set to message/rfc822 and the file is a valid .eml but E12506 persists, the platform may not allow email-message attachments at all, or may require them wrapped in a specific way. Check the provider's attachment policy and test through their console with a known-good sample. You can also submit your error to us for a tailored fix.

Was this fix helpful? Thanks for your feedback!