.eml MIME type
Email messagedocuments
message/rfc822A complete email — headers, body and attachments — in the standard internet message format.
| MIME type | message/rfc822 |
|---|---|
| Extensions | .eml |
| Content-Type | message/rfc822 |
| Compress in transit? | Yes — enable gzip or Brotli |
Good to know
- Mail clients open
.emlfiles directly. Outlook's own.msgformat is a different, binary file — see .msg. - An email forwarded as an attachment is a
message/rfc822part inside the outermultipart/mixedmessage. - Treat uploaded emails like untrusted HTML: never render the body inline on your own origin.
Serve .eml files with the right type
The response header to send:
Content-Type: message/rfc822
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
message/rfc822 eml;
Apache (.htaccess or server config)
AddType message/rfc822 .eml
Express
res.set("Content-Type", "message/rfc822");Python
import mimetypes
mimetypes.add_type("message/rfc822", ".eml")HTML file input
<input type="file" accept=".eml,message/rfc822">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.eml | grep -i '^content-type:' file --mime-type file.eml
Frequently asked questions
What is the MIME type for .eml files?
message/rfc822.
What Content-Type header should a .eml file be served with?
Content-Type: message/rfc822. It compresses well, so let the server apply gzip or Brotli.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options