Home

contenttransferencodings

Content-Transfer-Encoding is a MIME header field used in email messages to indicate how the body or a MIME part is encoded for transport. It is defined in RFC 2045 and 2046 and is applied so that data can pass through mail servers that may restrict certain byte values. If no encoding is declared, the default assumption is 7-bit US-ASCII, suitable for bodies containing only 7-bit data.

Common values

- 7bit: the content consists only of 7-bit ASCII characters, with no octets above 0x7F. This is the

- 8bit: the content may include octets with the high bit set. This is allowed in modern mail

- binary: the body contains raw binary data without any transfer encoding. This is not safe over

- quoted-printable: designed for mostly text with a small number of non-ASCII characters. It uses =XX escapes

- base64: encodes binary and non-ASCII data into ASCII text. It is widely used for attachments and

Extensions

- Some implementations use extensions starting with x- (for example, x-uuencode historically), though many such forms are

Usage

Each MIME part can have its own Content-Transfer-Encoding. Decoding processes reverse the encoding to reveal the

traditional
safe
subset
for
SMTP.
systems,
but
some
gateways
still
require
7-bit
data
or
may
mishandle
8bit.
gateways
or
older
mail
systems
that
expect
textual
data.
for
non-printable
bytes
and
soft
line
breaks
to
keep
line
length
manageable.
non-text
MIME
parts.
obsolete.
original
bytes.
Content-Transfer-Encoding
is
distinct
from
Content-Type;
in
HTTP,
the
analogous
header
is
Content-Encoding,
which
serves
a
different
protocol.