Content-Transfer-Encoding

Content-Transfer-Encoding

Many message transfer agents properly handle only short lines of US-ASCII characters. This is referred to as "7bit" or sometimes as "7bit encoded" text. SMTP imposes this limit. In order to send a richer set of file types across the Internet so that all MTAs can properly process them, some sort of encoding must be used. The purpose of the encoding is to use only 7-bit characters and limited line lengths to represent the content of the file. The file can be an image file, an executable file, or any general binary file.

While there are five content-transfer-encoding values defined, along with the extensible X-token, the base64 and quoted-printable are the only actual encoding schemes defined by MIME. These two schemes offer the extremes in the tradeoff between the need for a compact and efficient scheme and the desire for a generally human-readable scheme. The base64 is a totally mapped and fairly efficient encoding scheme for binary files. The quoted-printable scheme is used for mostly 7-bit data and is readable by humans.

There are three values of content-transfer-encoding that can be used in Internet SMTP messages. The 7bit is the definitive SMTP mechanism. The base64 and quoted-printable are encoding schemes that ensure that the content will properly pass through all MTAs. The 8bit and binary content-transfer-encoding values are defined to explicitly identify content which may require processing or encoding before being packaged for Internet transfer.