MIME Attachment Filename Doctor

Paste raw .eml (RFC 822 / MIME) source, or upload a .eml file, and see exactly which declared attachment filenames will fail to save, get silently altered, or disagree between mail clients when a recipient actually saves them to disk on Windows, macOS or Linux.

Processed locally in your browser. Your file is never uploaded.

How to use this calculator

  1. Paste raw .eml source, or upload a .eml file — nothing leaves your browser.
  2. Select "Check attachment filenames".
  3. Review each flagged filename: which operating systems/clients are affected and why.
  4. Use the offered rewrite where one is available — character replacement, reserved-device-name suffixing, trailing dot/space trimming and RFC 2231 encoding are all safe, mechanical fixes; the rest (header disagreements, the double-extension heuristic) are explained because a safe automatic fix can't be guessed.

Assumptions

Methodology

The raw text is parsed into a MIME part tree, and each part's Content-Disposition and Content-Type headers are inspected for filename/name parameters. Each declared filename is checked against documented Windows/macOS/Linux filesystem rules and RFC 2183/2231/6266 header requirements. A rewrite is offered only when it is mechanically safe and unambiguous: replacing reserved characters, suffixing a reserved device name, trimming trailing dots/spaces, adding a plain fallback for an RFC 2231 extended filename when it decodes to plain ASCII, and RFC 2231-encoding a raw non-ASCII filename. Header disagreements and the double-extension pattern are flagged with an explanation only, since guessing which name was intended — or renaming someone's real attachment based on a heuristic — is not this tool's call to make.

Worked example

A PDF attachment filename containing a colon and a question mark

Inputs: Content-Disposition: attachment; filename="Q3 report: draft?.pdf"

Result: Windows (NTFS/exFAT) refuses to save a file whose name contains < > : " / \ | ? * even though these are valid on Linux/macOS. Flagged as an error, with a safe rewrite replacing each reserved character with "_".

A .txt attachment named exactly "con.txt"

Inputs: Content-Disposition: attachment; filename="con.txt"

Result: Windows reserves CON, PRN, AUX, NUL, COM1-COM9 and LPT1-LPT9 regardless of extension. Flagged as an error, with a safe rewrite appending an underscore to the reserved name ("con_.txt").

An executable disguised behind a document-looking extension

Inputs: Content-Disposition: attachment; filename="invoice.pdf.exe"

Result: A safe-looking extension immediately followed by an executable-style one is a well-known malware-disguise pattern. Flagged as a warning (a heuristic, not a certainty) with no automatic rename — that decision is left to the recipient.

Practical guidance
Common mistakes

FAQs

Why is a reserved character an error but a header disagreement only a warning?

A reserved character or device name will definitely fail to save on Windows — there's no ambiguity. A Content-Disposition/Content-Type disagreement is genuinely ambiguous: different real clients pick different ones, so it's a real risk but not a guaranteed failure.

Why doesn't the tool rename a file flagged by the double-extension check?

The pattern is a heuristic that can have false positives on legitimately double-extensioned files (a report literally named "summary.pdf.bak", for example). Renaming someone's actual attachment based on a guess is a judgement call this tool leaves to the recipient.

Does this tool decode or display attachment content?

No — it only inspects the Content-Disposition and Content-Type headers that declare each attachment's filename. It never decodes or displays the attachment's actual body content.