EllisLab/CodeIgniter — pull request #1709 by bbarao (2012-08-14 17:51:40+00:00)
Title: Fix email headers when using long email subjects and \r\n as crlf.

Issue
---------

When using long email subjects and \r\n as crlf, the header is badly formatted, and either the email appears with headers on the body, or doesn't arrive at all.

The problem is that on the preg_replace, the multiline mode only matches the \n leaving the \r to be matched on the regex.

Examples
--------------

I'm showing the part of the header where the subject is set.

**Current Code** (notice the **^M** on the first two lines)

Subject: =?utf-8?Q?Big_email_subject_with_some_non_ascii_chars:_=c3=a0_=c3=a1_=c3^M?=
=?utf-8?Q?=a9_=c3=a8_=c3=b6_=c3=af_@_=e2=82=ac_=c2=a9_=c2=ae_>_=c2=bb_an^M?=
=?utf-8?Q?d_so_on,_and_so_on...?=^M

**Patched Code**

Subject: =?utf-8?Q?Big_email_subject_with_some_non_ascii_chars:_=c3=a0_=c3=a1_=c3?=^M
=?utf-8?Q?=a9_=c3=a8_=c3=b6_=c3=af_@_=e2=82=ac_=c2=a9_=c2=ae_>_=c2=bb_an?=^M
=?utf-8?Q?d_so_on,_and_so_on...?=^M