How do attachments work in email?
Attachments are files included in email messages using MIME encoding. Since email was designed for text, binary files must be converted to text-safe formats for transmission.
How attachments are structured:
The email uses multipart/mixed MIME type
Each attachment is a separate MIME part
Binary content is encoded using Base64 (converts binary to ASCII characters)
Content-Disposition: attachment indicates it should download rather than display inline
Example headers for an attachment:
Content-Type: application/pdf; name="document.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="document.pdf"
[Base64 encoded file content]
Size impact: Base64 encoding increases file size by approximately 33%. A 1MB file becomes ~1.33MB in the email. Combined with message overhead, attachments significantly increase email size.
Inline vs attachment: Content-Disposition: inline attempts to display the content within the message (common for images). attachment prompts download.
Most email providers limit attachment sizes (typically 10-25MB). For larger files, send links to cloud storage instead.
Was this answer helpful?
Thanks for your feedback!