Header and envelope encoding

SMTP standards require envelope commands and header information to be sent in the US-ASCII character set.

From RFC2821:

No sending SMTP system is permitted to send envelope commands in any character set other than US-ASCII; receiving systems SHOULD reject such commands, normally using "500 syntax error - invalid character" replies.

From RFC2822:

2.2. Header Fields

Header fields are lines composed of a field name, followed by a colon (":"), followed by a field body, and terminated by CRLF. A field name MUST be composed of printable US-ASCII characters (i.e., characters that have values between 33 and 126, inclusive), except colon. A field body may be composed of any US-ASCII characters, except for CR and LF. However, a field body may contain CRLF when used in header "folding" and "unfolding" as described in section 2.2.3. All field bodies MUST conform to the syntax described in sections 3 and 4 of this standard.

The MIME Content-Type header is used in message bodies to specify alternate character sets.

Bad header example

$ cat -v bad.header | grep '^From:'
From: <franM-gois.jaucot@example.com>

In cat -v output. M- represents a character outside the ASCII range (metacharacter).

$ grep '^From:' bad.header | od -c
0000000   F   r   o   m   :       <   f   r   a   n 347   o   i   s   .
0000020   j   a   u   c   o   t   @   e   x   a   m   p   l   e   .   c
0000040   o   m   >  \n
0000044

Back to brandonhutchinson.com.
Last modified: 2006/03/09