wordpress - Sending a multipart E-Mail using PHP Mailer/wp_mail - not all clients display E-Mail -


i have problems sending multipart e-mail through wordpress function wp_mail, wrapper php mailer.

in os x mail.app, mail displays fine. in thunderbird, nothing displayed, while google mail displays attachment called 'noname' size of 1 kb.

my guess has encoding, since noticed boundary not displayed in e-mail's header @ all, while appears in header other e-mails have received. also, there seems kind of content-transfer-encoding mismatch?

these important bits of header:

to: email@address.com subject: testsubject x-php-originating-script: 10029:class-phpmailer.php date: mon, 24 mar 2014 15:52:59 +0000 from: wordpress <wordpress@example.com> message-id: <ab7dd25d45c2d5be71df1e592bb0ab96@www.example.com> x-priority: 3 x-mailer: phpmailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/) mime-version: 1.0 content-transfer-encoding: 8bit content-type: multipart/alternative; charset=utf-8  --1234567890 content-type: text/plain; charset=utf-8 content-transfer-encoding: 7bit  text plain  --1234567890 content-type: text/html; charset=utf-8 content-transfer-encoding: 7bit  <b>html e-mail</b>  --1234567890-- 

in other html e-mail correctly displayed, can read boundary header. also, content-transfer-encoding different.

content-type: multipart/alternative; boundary="--==_mimepart_532c53995fed2_5f733fb4b5966cd0158292"; charset="utf-8" content-transfer-encoding: 7bit 

in php script, mail compiled that:

$to = 'email@address.com'; $subject = 'testsubject';  $headers = 'content-type: multipart/alternative; charset=utf-8; boundary="1234567890"' . "\r\n\r\n";  $message = '--1234567890' . "\r\n"; $message .= 'content-type: text/plain; charset=utf-8' . "\r\n"; $message .= 'content-transfer-encoding: 7bit' . "\r\n\r\n"; $message .= 'text plain' . "\r\n\r\n";  $message .= '--1234567890' . "\r\n"; $message .= 'content-type: text/html; charset=utf-8' . "\r\n"; $message .= 'content-transfer-encoding: 7bit' . "\r\n\r\n"; $message .= '<b>html e-mail</b>' . "\r\n\r\n"; $message .= '--1234567890--';  wp_mail( $to, $subject, $message, $headers ); 

do see strikes here? why e-mail body not displayed @ in thunderbird/google mail?

at moment thinking maybe server misconfigured or that, fact mail.app displays mail correctly not fit that.

add "\r\n" after each header line in $headers var. mail systems have issue "\r" - breaks message on mail servers reason; if continue have issues, try omitting "\r" 's.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -