Email Format Troubleshooting: MIME, EML, and Encoding Issues
Diagnose and fix common email format and encoding issues. Understand MIME structure, quoted-printable encoding, character set problems, and why attachments sometimes arrive corrupted.
Key Takeaways
- Email messages are plain text (7-bit ASCII) transported by SMTP.
- A MIME message consists of headers and a body, potentially with multiple parts.
- MIME offers two encoding schemes for non-ASCII content.
- View the raw email source (most clients offer 'Show Original' or 'View Source') to inspect MIME boundaries, Content-Type headers, and encoding declarations.
- Understanding MIME structure is essential for diagnosing email display and delivery problems.
How Email Really Works
Email messages are plain text (7-bit ASCII) transported by SMTP. Everything beyond basic ASCII — international characters, HTML formatting, attachments — is encoded within this constraint using MIME (Multipurpose Internet Mail Extensions). Understanding MIME structure is essential for diagnosing email display and delivery problems.
MIME Message Structure
A MIME message consists of headers and a body, potentially with multiple parts. The Content-Type header declares what each part contains. A typical HTML email with an attachment has three parts: a plain text version, an HTML version (together in a multipart/alternative), and the attachment (wrapped in multipart/mixed).
Common Encoding Issues
| Problem | Symptom | Cause | Fix |
|---|---|---|---|
| Mojibake | é instead of é |
Charset mismatch | Set Content-Type charset |
=3D in text |
Escaped characters visible | Quoted-printable not decoded | Fix Content-Transfer-Encoding header |
| Broken attachment | Corrupt file after download | Base64 line wrapping error | Re-encode with 76-char lines |
| Missing characters | Text truncated at special chars | 8-bit chars in 7-bit transport | Use quoted-printable or base64 |
Quoted-Printable vs Base64
MIME offers two encoding schemes for non-ASCII content. Quoted-printable encodes special characters as =XX hex codes while leaving ASCII printable — efficient for mostly-ASCII text. Base64 encodes everything in 6-bit chunks — constant 33% overhead but safe for any binary content. Use quoted-printable for text parts and base64 for attachments.
Debugging Email Structure
View the raw email source (most clients offer 'Show Original' or 'View Source') to inspect MIME boundaries, Content-Type headers, and encoding declarations. Analyze email files with Peasy's EML parser to visualize the MIME structure and identify encoding problems.