[wp-trac] [WordPress Trac] #39775: wp_mail miss send Content-Type with boundary when array header does not have other custom headers
WordPress Trac
noreply at wordpress.org
Fri Feb 3 07:42:44 UTC 2017
#39775: wp_mail miss send Content-Type with boundary when array header does not
have other custom headers
--------------------------+-----------------------------
Reporter: kn007 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
It's a PR send in github. https://github.com/WordPress/WordPress/pull/273
Fix empty charset in line 436.
Before:
`Content-Type: multipart/alternative; charset=`
After:
`Content-Type: multipart/alternative; charset=UTF-8`
-------------
fix `$headers[] = "Content-Type: multipart/alternative;
boundary=\"$boundary\"";` not send when not other headers.
Test Code:
{{{#!php
<?php
$boundary = md5( uniqid() . microtime() );
$to = 'wordpress at wordpress.org';
$subject = 'TEST';
$headers[] = "From: Wordpress <wordpress at wordpress.org>";
$headers[] = "Content-Type: multipart/alternative;
boundary=\"$boundary\"";
$body = "--$boundary\r\n" .
"Content-Type: text/plain; charset=UTF-8\r\n";
$body .= 'test';
$body .= "--$boundary\r\n" .
"Content-Type: text/html; charset=UTF-8\r\n";
$body .= '<div>test</div>';
wp_mail( $to, $subject, $body, $headers );
}}}
Before:
[[Image(https://cloud.githubusercontent.com/assets/6196903/22583305
/a84c5f1c-ea26-11e6-8718-2bde99d20484.png)]]
After:
[[Image(https://cloud.githubusercontent.com/assets/6196903/22583326/c4055362-ea26-11e6-8890-1da8fac8552e.png)]]
I could search some issue for this, like
http://wordpress.stackexchange.com/questions/191923/sending-multipart-
text-html-emails-via-wp-mail-will-likely-get-your-domain-b
https://wordpress.org/support/topic/using-wp_mail-with-php-generated-
attachments/
but still have same problem here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39775>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list