Free EML test files and sample generator
A single email saved to disk in the RFC 5322 format every mail client understands. Generate valid .eml sample files to test mail importers, archivers, parsers and attachment handling.
What is a .eml file?
EML: Email Message. An EML file is a single email saved exactly as it traveled: RFC 5322 headers, a blank line, then the body. Because that is the same wire format mail servers exchange, an .eml is the honest way to test a mail importer. You are feeding it the real thing rather than a database row. Headers are the interesting part for testing: they must use CRLF line endings, they can be folded across lines, and a multipart message nests parts inside MIME boundaries with an attachment carried as base64 or plain text.
Why generate a test EML file?
- Test a mail importer, archiver or e-discovery ingest.
- Exercise MIME parsing, multipart handling and attachment extraction.
- Check header parsing, CRLF handling and behavior on a truncated message.
What you can put inside a .eml file
You get 3 content options for EML, so the file holds something meaningful rather than random padding: Plain text, HTML message, With attachment. For EML these are alternatives, so choose the one that matches what you need to test.
How a .eml file is identified
A .eml file has no signature at the start. A text format has no identifying leading bytes, so the extension and the reported media type are the only claims about it until a parser actually reads it, which is why validating uploads by extension alone is unsafe.
Negative testing with broken EML files
- Invalid. Identifiable, but wrong inside, so it fails during parsing.
- Corrupted. The leading bytes are destroyed. Same length as the valid file.
- Incomplete. Truncated part-way, so it is genuinely shorter.
- Empty. Chosen under Content rather than File Condition: valid structure, no data.
Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation, and for this format's encodings, UTF-16 and BOM test files.
Sample EML content
From: James Smith <james.smith@example.com> To: support@example.com Subject: Test message Date: Mon, 27 Jul 2026 09:14:00 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 This is a generated test message.
This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.
How to open and verify the file
Double-click to open it in Outlook, Thunderbird or Apple Mail, or read it in any text editor. The format is plain text by design. Files here use CRLF throughout, as the specification requires, and the multipart option carries a real CSV attachment.
Media type message/rfc822 · extension .eml · category Data
Generate a .eml file → · questions about sizes, privacy or cost are answered on the site FAQ.
Frequently asked questions about EML files
What identifies a .eml file?
Nothing at the start of the file does. A text format has no identifying leading bytes, so the extension and the reported media type are the only claims about it until a parser actually reads it, which is why validating uploads by extension alone is unsafe.
What can go inside the EML file?
There are 3 content options for .eml: Plain text, HTML message, With attachment. For EML these are alternatives, so pick the one matching what you need to test.
Can I download several broken EML files at once?
Yes, select more than one File Condition and you get one ZIP containing a .eml per condition, each named after its condition.
Can the EML file use UTF-16 or a byte-order mark?
Yes. .eml is a text format, so it can be generated as UTF-8, UTF-8 with a byte-order mark, UTF-16 LE or UTF-16 BE. The body is shortened before re-encoding so the finished file still lands on the exact size you asked for. Note that a UTF-16 file always has an even byte count.
How do I open or verify the EML file?
Double-click to open it in Outlook, Thunderbird or Apple Mail, or read it in any text editor. The format is plain text by design. Files here use CRLF throughout, as the specification requires, and the multipart option carries a real CSV attachment.