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

WordPress Trac noreply at wordpress.org
Tue Feb 21 14:34:15 UTC 2017


#15448: wp_mail() sets Content-Type header twice for multipart emails
---------------------------------------+------------------------
 Reporter:  rmccue                     |       Owner:  nacin
     Type:  enhancement                |      Status:  reviewing
 Priority:  normal                     |   Milestone:  4.8
Component:  Mail                       |     Version:
 Severity:  normal                     |  Resolution:
 Keywords:  gci has-patch westi-likes  |     Focuses:
---------------------------------------+------------------------

Comment (by MattyRob):

 Proof of concept:

 {{{#!php
 function mail_check() {
         $to = "recipient at example.com";

         $subject = 'wp_mail testing multipart';
         $message = 'Hello world! This is plain text...';

         $headers = "MIME-Version: 1.0\r\n";
         $headers .= "From: sender at example.com\r\n";
         $headers .= 'Content-Type:
 multipart/alternative;boundary="----=_Part_18243133_1346573420.1408991447668"';


         // send email
         wp_mail( $to, $subject, $message, $headers );
 }
 add_action( 'shutdown', 'mail_check' );
 }}}

 Produces the following in WordPress 4.7.2:


 {{{
 From: WordPress <wordpress at localhost.localdomain>
 Message-ID: <183f1675f0731e7c2d3b822eb0370c1f>
 X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
 MIME-Version: 1.0
 Content-Type: multipart/alternative;
          boundary="----=_Part_18243133_1346573420.1408991447668"
 MIME-Version: 1.0
 Content-Type: multipart/alternative; charset=

 Hello world! This is plain text...
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15448#comment:45>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list