Send Base64 Encoded Email with PHP

Base 64 is a way to representing binary data – like images – into ASCII text. You can use use Base-64 encoding to easily send binary data through HTML Mail, e-mail attachments, JSON requests and HTML forms.

The encoded data uses A-Z, a-z, 0-9 and + and /, with = as a padding character while carriage return line feed (“\r\n”) characters are inserted into the output to keep the line lengths less than 76 characters. Here is the raw source of a MIME encoded HTML Mail:

You can easily send MIME encoded email messages through PHP. The base64_encode() method encodes the HTML message with base64 while chunk_split() splits the encoded messages into smaller chunks and appends “\r\n” at the end.