Message

message/rfc822

Basic information

Typemessage
Subtyperfc822
Structured suffixNone
File extensions.eml
CategoryMessage
StandardIANA media type registry or common platform registration

MIME anatomy

message/rfc822 has a top-level type of message and a subtype of rfc822. The top-level type tells clients the broad handling model, while the subtype identifies the exact format, codec family, document type, or container.

PartValueWhat to check
Top-level typemessageControls broad behavior such as text rendering, image decoding, download handling, or multipart parsing.
Subtyperfc822Should match the real file format, not only the filename extension.
Structured suffixNoneNo structured suffix is declared for this type.
CharsetBinaryDo not add a charset parameter to binary payloads.
Binary payloadYesTreat the body as bytes and avoid text transformations.

HTTP header

Content-Type: message/rfc822
BinaryEncodingYesBinary.emlExtensions

Common use

Use message/rfc822 in Content-Type and Accept headers when serving or requesting email message. Correct MIME types help browsers, APIs, uploads, and download workflows handle files safely and predictably.

Browser support depends on the media type and the feature using it. Browsers can download almost any MIME type, but only selected text, image, audio, video, font, and document types are rendered natively.

For uploads, do not trust the file extension alone. Check the declared MIME type, validate the file signature when security matters, and store the original extension separately from the trusted server-side classification.

Browser and API behavior

ContextHow message/rfc822 is usedPractical check
HTTP responseSend message/rfc822 so clients choose the right parser or renderer.Inspect the Network panel and confirm the response header, not just the file extension.
HTTP requestUse Accept: message/rfc822 when an API can return several formats.Return 406 Not Acceptable or a documented fallback when the type is unavailable.
Upload formUse file extension and declared MIME type as hints.For risky uploads, verify magic bytes or parse the file before trusting it.
StorageStore the trusted MIME classification separately from the original filename.This keeps later downloads correct even if a user uploads a misleading name.

Common mistakes

  • Serving binary content as application/octet-stream when the browser or API client expects message/rfc822.
  • Assuming .eml proves the file is safe. Extensions are user-controlled and should be treated as hints.
  • Adding a charset parameter to binary content. Binary formats should normally be sent without charset.

HTML download

<a href="/download.eml" download type="message/rfc822">Download file</a>

fetch Accept header

fetch("/api/file", {
  headers: { Accept: "message/rfc822" }
});

multer upload filter

const upload = multer({
  fileFilter: (req, file, cb) => cb(null, file.mimetype === "message/rfc822")
});

Express response

app.get("/file", async (req, res) => {
  res.setHeader("Content-Type", "message/rfc822");
  res.send(await readFile("example.eml"));
});

Flask response

from flask import send_file

@app.get("/file")
def file():
    return send_file("example.eml", mimetype="message/rfc822", as_attachment=False)

Go net/http response

func handler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "message/rfc822")
    http.ServeFile(w, r, "example.eml")
}

Nginx type mapping

types {
    message/rfc822 eml;
}
default_type application/octet-stream;

curl negotiation

curl -H "Accept: message/rfc822" https://example.com/file.eml

Validation checklist

CheckRecommended handling
Declared typeCompare the uploaded or generated MIME value with message/rfc822 when this exact format is required.
ExtensionAccept .eml only as a convenience signal, not as proof of content.
Signature or parserValidate the binary signature or parse the container when untrusted users can upload files.
Download safetySet Content-Disposition deliberately when the file should download instead of render inline.
CachingUse cache headers that match the file lifecycle, especially for generated assets and user uploads.