Summary:ASTERISK-08755: e-mail attachment contains CRLF within MIME (base64) data
Reporter:Oskar Senft (osk)Labels:
Date Opened:2007-02-08 10:31:07.000-0600Date Closed:2011-06-07 14:07:51
Versions:Frequency of
Description:The MIME (base64) encoded attachment contains CRLF within the data block. In combination with some MTAs the CRLF becom LFLF causing problems with some mail clients (e.g. Outlook).

Background: The function "ochar" used by "base_encode" uses CRLF instead of a plain LF to indicate a new line. The characters to indicate a new line are defined  as
#define eol "\r\n"

Changing this to "\n" only solves the problem.


According to http://en.wikipedia.org/wiki/MIME#Content-Transfer-Encoding and http://tools.ietf.org/html/rfc2045 (section 2.1) a CRLF indicates a "line break", e.g. to separate header fields.

With respect to Base64 encoding a "line break" (CRLF) within the data block does not make sense.

The problem also exists in Asterisk 1.2.x.
Comments:By: Tilghman Lesher (tilghman) 2007-02-08 11:13:49.000-0600

As noted on page 25 of RFC 2045:

"All line breaks or other characters not found in Table 1 must be ignored by decoding software."

Hence, the decoder you are using is not in compliance with the RFC.  We cannot break compliance with the vast majority of mailers that are RFC-compliant to be compatible with the one that is not.  Therefore, we cannot make this change.  We suggest that you inform your vendor that their mail client is out of compliance with the recommended standard and request that they fix it, instead of asking us to break our product.