[wp-trac] [WordPress Trac] #5204: wp_mail Does Not Detect Custom Boundaries in "Multipart/Mixed" Email Headers

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 15 16:41:49 GMT 2007


#5204: wp_mail Does Not Detect Custom Boundaries in "Multipart/Mixed" Email
Headers
----------------------+-----------------------------------------------------
 Reporter:  Ghidra99  |       Owner:  anonymous                                         
     Type:  defect    |      Status:  new                                               
 Priority:  normal    |   Milestone:  2.3.1                                             
Component:  General   |     Version:  2.3                                               
 Severity:  major     |    Keywords:  wp_mail, email, multipart, mixed, header, boundary
----------------------+-----------------------------------------------------
 There is a problem with the new wp_mail function.

 If an email is sent to wp_mail() with a custom header of "Content-Type:
 multipart/mixed; boundary="frontier"", wp_mail() is a) not recognizing
 that a custom boundary has been set and b) using that custom boundary (in
 this case, "frontier") as the email character set (charset). This is
 producing malformed subject lines and messages in emails with non-western
 characters.

 For example, PluginX sends an email to wp_mail(). The email's headers are
 formed correctly:

 {{{
 To: xxx at xxx.org
 Subject: =?UTF-8?B?0KHRgNC/0YHQutC4INCa0YPQu9GC?=
 Date: Mon, 15 Oct 2007 10:04:34 -0500
 From: "xxx at xxx.org" <xxx at xxx.org>
 MIME-Version: 1.0
 Content-Type: multipart/mixed; boundary="frontier"

 --frontier
 Content-Type: text/plain; charset = "UTF-8"
 Content-Transfer-Encoding: 8bit

 Attached to this email is
    xxx.sql.gz
    Size:82 kilobytes

 --frontier
 Content-Type: application/octet-stream; name="xxx.sql.gz"
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment; filename="xxx.sql.gz"

 H4sIAAAAAAAAA5yMQQrCMBRE9znFQNdKWhQhWwu6sKgouLQ/yYeCNSn5UentzcITOLt585gKt5j8
 --frontier
 }}}

 wp_mail() explodes and parses the email headers, incorrectly ascribing
 "frontier" as the Charset while assigning its own boundary:

 {{{
 To: xxx at xxx.org
 Subject: =?frontier?B?0KHR?=  =?frontier?B?gNC/?=  =?frontier?B?0YHQ?=
 =?frontier?B?utC4?=  =?frontier?B?INCa?=  =?frontier?B?0YPQ?=
 =?frontier?B?u9GC?=
 Date: Mon, 15 Oct 2007 10:04:34 -0500
 From: "xxx at xxx.org" <xxx at xxx.org>
 MIME-Version: 1.0
 Content-Type: multipart/mixed;
 boundary="b1_49700ab183d95dd1680e0898d750b958"

 --b1_49700ab183d95dd1680e0898d750b958
 Content-Type: text/plain; charset = "frontier"
 Content-Transfer-Encoding: 8bit

 Attached to this email is
    xxx.sql.gz
    Size:82 kilobytes

 --b1_49700ab183d95dd1680e0898d750b958
 Content-Type: application/octet-stream; name="xxx.sql.gz"
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment; filename="xxx.sql.gz"

 H4sIAAAAAAAAA5yMQQrCMBRE9znFQNdKWhQhWwu6sKgouLQ/yYeCNSn5UentzcITOLt585gKt5j8
 --b1_49700ab183d95dd1680e0898d750b958
 }}}

 PluginX's once correctly-formed email is now severely broken, using
 PluginX's custom boundary as a charset.

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


More information about the wp-trac mailing list