Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

malformed email subject header when subject > 75 chars using codeigniter email lib

I'm getting some garble in my MIME headers when the subject is over 75 chars. When the line break is encoded in the header there is an extra line break that is invalid.

Some email gateways are bouncing the email with a "Malformed MIME field: ?= =?utf-8?Q?SUBJECT?=" error.

Does anyone have any experience with utf-8 problems sending emails with CodeIgniter?


-snip-
Return-Path: ***
Subject: =?utf-8?Q?SUBJECT_LINE    <--
?=                                 <-- Problem in Subject header
 =?utf-8?Q?SUBECT_LINE_2?=         <--
To: ***
Reply-To: ***
-snip-

Update: This has nothing to do with gmail smtp. I have rewritten the question in the hope that it will help someone out in the future.

like image 273
willoller Avatar asked Nov 29 '22 15:11

willoller


1 Answers

Apparently this is a known issue, caused by Subject lines > 75 chars.

http://codeigniter.com/forums/viewthread/154493/P15/#925385

The fix was to change the email config like this:

$config['newline'] = "\r\n";
$config['crlf']    = "\n"; 
like image 153
willoller Avatar answered Dec 04 '22 09:12

willoller