[wp-trac] Re: [WordPress Trac] #4296: wp_mail removes the Content-Type

WordPress Trac wp-trac at lists.automattic.com
Fri May 25 10:19:30 GMT 2007


#4296: wp_mail removes the Content-Type
------------------------------+---------------------------------------------
 Reporter:  morty             |        Owner:  rob1n   
     Type:  defect            |       Status:  assigned
 Priority:  high              |    Milestone:  2.2.1   
Component:  General           |      Version:  2.2     
 Severity:  major             |   Resolution:          
 Keywords:  has-patch commit  |  
------------------------------+---------------------------------------------
Comment (by mattyrob):

 I'm not 100% sure how phpmailer works but some of this code may be
 contradictory.

 We are checking for Content-Type and setting it as text/plain if it is not
 set.

 However, I have a plugin that passes some  mail via wp_mail() that sets
 the Content-Type as text/html. With his diff the Content-Type will be left
 alone but the code still invokes $phpmailer->IsHTML( false ); which
 presumably tells phpmailer that the email isn't html when in fact it is!

 Something like this might avoid this problem (if indeed it is still a
 problem after the patch.

 {{{
 if ( !isset( $content_type ) ) {
         $content_type = 'text/plain';
         $phpmailer->IsHTML( false );
 } elseif ( isset( $content_type) && ($content_type == 'text/plain' ) {
         $phpmailer->IsHTML( false );
 } elseif ( isset( $content_type) && ($content_type == 'text/html' ) {
         $phpmailer->IsHTML( true );
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4296#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list