XCON: A Description of Base64 MIME Content Transfer Encoding (323489)



The information in this article applies to:

  • Microsoft Exchange 2000 Server SP1
  • Microsoft Exchange 2000 Server SP2
  • Microsoft Exchange Server 5.5

This article was previously published under Q323489

SUMMARY

An e-mail message that is sent by using Exchange Server may be encoded in Base64 Multipurpose Internet Message Extensions (MIME) content transfer encoding. Because of the Base64 encoding algorithm, a message or attachment cannot be read if it is not decoded first. However, this increases the message size by about 33 percent.

MORE INFORMATION

The Base64 encoding semantics are described in Request for Comments ( RFC) 2045. This standard proposes that the algorithm be used to transport binary data over a transport that can only handle 7-bit data. To encode the data, a group of three bytes is converted into four 6-bit numbers. Each 6-bit number is then replaced by the corresponding US-ASCII character in the Base64 alphabet. Carriage Return Line Feed (CRLF) characters are inserted into the output stream to keep the line lengths less than 76 characters. When there is one extra byte, the 3-byte group is created by appending two 0-value bytes; two encoded characters are generated, and two equal sign (=) characters are appended. When there are two extra bytes, the 3-byte group is created by appending one 0-value byte; three encoded characters are generated, and one equal sign (=) character is appended.

Base64 Encoding in Exchange Server

Base64 encoding is used in the following situations:
  • If you send a message that contains characters that are outside the 7bit US-ASCII range. Exchange Server is a 7-bit Single Mail Transfer Protocol (SMTP) transport. To send an 8-bit message, the message must be encoded in Base64, and then sent by using SMTP.
  • If you send a message that contains 25 percent or more 8-bit characters.

Base64 Encoding in Exchange 2000

Base64 encoding is used in the following situations:
  • If you send an SMTP message that has an attachment. For example:

    ------_=_NextPart_001_01C211A6.C0897AD3
    Content-Type: text/plain;
    charset="US-ASCII"
    Content-Transfer-Encoding: quoted-printable
    
    ------_=_NextPart_001_01C211A6.C0897AD3
    Content-Type: text/plain;
    name="testattach.txt"
    Content-Transfer-Encoding: base64
    Content-Description: testattach.txt
    Content-Disposition: attachment;
    filename="testattach.txt"
    
    naXZlIG91dCB5b3VyIHBhc3N3b3JkIG9yIGNyZWRpdCBjYXJkIG51bWJlciBpbiBh
    biBpbnN0YW50IG1lc3NhZ2UgY29udmVyc2F0aW9uLg0KICANClZlcm9uaWNhIFJ5YW4gKFZvbHQ
    DQpoaSBhZGUNClZlcYSBSeWFuIChWb2x0KSBzYXlzOg0KaSBoYXZlIGEgcHJl
    bWllciBjYWxsYmFjaw0KQWRlIEZhbW90aSBzYXlzOg0KSSJtIG9uIHRoZSBwaG9uZSB3aXRoIGE

    The second part of the MIME headers indicates that the SMTP attachment (testattach) was sent by using the Base64 encoding algorithm. Attachments that are sent to the Internet are always encoded as Base64 in Exchange 2000.
  • If you send a message that uses characters from certain character sets in the message body. Messages that use character sets from the following code pages are encoded as Base64 messages when they are sent from an Exchange 2000 computer:
    • Shift-JIS
    • EUC-KR
    • ISO-2202-JP
    • BIG5
    • ISO-2202-KR
    • GB18030
    • GB2312

Modification Type:MajorLast Reviewed:11/20/2003
Keywords:kbinfo KB323489