[wp-trac] [WordPress Trac] #15448: wp_mail() sets Content-Type header twice for multipart emails

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 17 12:15:05 UTC 2010


#15448: wp_mail() sets Content-Type header twice for multipart emails
-------------------------+--------------------------------------------------
 Reporter:  rmccue       |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:                 
 Severity:  normal       |    Keywords:                 
-------------------------+--------------------------------------------------
 When trying to send emails via `wp_mail()` with a Content-Type of
 multipart/alternative, the Content-Type header will be set with
 `$phpmailer->ContentType`, and again with `$phpmailer->AddCustomHeader()`,
 which causes two Content-Type headers in the email:
 {{{
 Content-Type: multipart/alternative;
          boundary="example_boundary"
 Content-Type: multipart/alternative; charset=""
 }}}

 This appears to cause errors in Outlook, as there is no boundary on the
 latter.

 The cause of this is `PHPMailer::GetMailMIME()`, as it does not know that
 the email is a multipart email. The easiest way to achieve this appears to
 be to simply allow the user to set the AltBody via `wp_mail()`. In order
 to achieve backwards compatibility, `wp_mail()` should work out which part
 is the text/plain one and which is the text/html one based on the
 boundary.

 I'll be working on a patch for this.

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


More information about the wp-trac mailing list