[wp-trac] [WordPress Trac] #4197: Bad headers generated when using non-western encoding

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 25 18:37:23 GMT 2007


#4197: Bad headers generated when using non-western encoding
----------------------+-----------------------------------------------------
 Reporter:  yaman666  |       Owner:  anonymous
     Type:  defect    |      Status:  new      
 Priority:  normal    |   Milestone:  2.1.4    
Component:  General   |     Version:  2.1.3    
 Severity:  normal    |    Keywords:           
----------------------+-----------------------------------------------------
 wp_mail function does not bother encoding headers, to and from fields,
 which generates "bad header" error in anti-spam software and increases
 chances of flagging it as spam.

 Possible solution to encode subject and message that worked for me:

 $subject = "=?UTF-8?B?".base64_encode($subject)."?=";
 $message = chunk_split(base64_encode($message));
 $headers = "From: $from\n"
           ."MIME-Version: 1.0\n"
           ."Content-Type: text/plain; charset=UTF-8; format=flowed\n"
           ."Content-Transfer-Encoding: base64\n"
           ."Content-Disposition: inline\n";
 mail($to, $subject, $message, $headers);

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4197>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list