SMTP's Historical Limitations
SMTP (Simple Mail Transfer Protocol) was defined in 1982 for exchanging text messages. It uses 7-bit ASCII, which means bytes with the high bit set are invalid and get stripped or corrupted in transit. Binary file formats contain arbitrary byte values throughout and cannot be transmitted directly over original SMTP.
MIME: Multipurpose Internet Mail Extensions
MIME extended email to support multiple content types and binary attachments. A MIME email consists of multiple parts, each with its own Content-Type and Content-Transfer-Encoding headers. Attachments use Content-Transfer-Encoding: base64, signaling that the body must be Base64-decoded.
How Email Clients Handle This
When you attach a file, your email client reads the file as binary, Base64-encodes the bytes, and embeds the resulting text in the MIME message. When the recipient's client receives the message, it reads the Base64 text, decodes it back to binary, and presents it as a downloadable attachment.
Modern SMTP and 8BITMIME
Modern SMTP servers often support the 8BITMIME extension, which allows transmission of 8-bit data directly. However, for maximum compatibility with older servers and relay chains, email clients still widely use Base64 for attachments rather than relying on 8BITMIME support.
Base64 in email attachments is a compatibility solution born from SMTP's text-only origins. MIME and Base64 together gave email its ability to carry any file type — a capability we've relied on for decades.