[wp-trac] [WordPress Trac] #43425: WP_Mail BCC and CC - RCPT TO Errors

WordPress Trac noreply at wordpress.org
Mon Feb 26 22:15:09 UTC 2018


#43425: WP_Mail BCC and CC - RCPT TO Errors
--------------------------+-----------------------------
 Reporter:  JWGarber1725  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Mail          |    Version:  4.9.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Adding BCC and CC Fields are having inconsistent results. Undeliverable
 emails, incorrect "RCPT TO" Addresses in SMTP Communication etc. "RCPT TO"
 is being set to "Message-ID".

 See Tests Below - I tested with standard PHP Mail and wp_mail
 If anyone has any pointers that would be great.

 Windows Server 2012R2
 IIS: 8.5
 PHP: 7.0.9
 WP: 4.9.4
 No special plugins or code.

 Test 1: Standard PHP Mail with CC Field
 {{{
         $headers = 'From: Test <help at myname.com>' . "\r\n" . 'cc:
 myotheremail at myname.com';
         $to = "myemail at gmail.com";
         $subject = "TEST SUBJECT";
         $body = "Test";

 if (mail($to, $subject, $body, $headers)) {
     echo("Message successfully sent");
 } else {
     echo("Message sending failed");
 }
 }}}

 Results
 Both emails received. Content looks ok


 ----


 Test 2: Standard PHP Mail with BCC Field
 {{{

         $headers = 'From: Test <help at myname.com>' . "\r\n" . 'bcc:
 myotheremail at myname.com';
         $to = "myemail at gmail.com";
         $subject = "TEST SUBJECT";
         $body = "Test";

 if (mail($to, $subject, $body, $headers)) {
     echo("Message successfully sent");
 } else {
     echo("Message sending failed");
 }

 }}}


 Results: Both emails were received
 However. The body of each email now has the letter "b" appended to the
 content.


 Body Content

 {{{
 b

 Test
 }}}


 Is something in WP causing this or is this an issue in Windows PHP??

 ----

 Test 3: WordPress wp_mail with CC Field
 {{{

         $headers = 'From: Test <help at myname.com>' . "\r\n" . 'cc:
 myotheremail at myname.com';
         $to = "myemail at gmail.com";
         $subject = "TEST SUBJECT";
         $body = "Test";

 if (wp_mail($to, $subject, $body, $headers)) {
     echo("Message successfully sent");
 } else {
     echo("Message sending failed");
 }
 }}}


 Results
 CC never received - SMTP Log file shows: [2018.02.26] 16:46:04 [55583]
 CMD: RCPT TO:<945dc26bed6e74aeec984fc4ae828e32 at myname.com>
 Why did the CC field get changed? It looks like the "CC" Field is now the
 "Message-ID" as they are the same now.

 Gmail received the copy as expected.

 ----

 Test 4: WordPress wp_mail with BCC Field

 {{{
         $headers = 'From: Test <help at myname.com>' . "\r\n" . 'bcc:
 myotheremail at myname.com';
         $to = "myemail at gmail.com";
         $subject = "TEST SUBJECT";
         $body = "Test";

 if (wp_mail($to, $subject, $body, $headers)) {
     echo("Message successfully sent");
 } else {
     echo("Message sending failed");
 }

 }}}

 Results
 Same as Test 3 -- The BCC Field "RCPT TO" command became the "Message-
 ID"??
 Gmail received the copy but still had the letter "b" appended into the
 message body.


 Any ideas, pointers etc? Suspecting Bug in WordPress or Windows PHP.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43425>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list