[wp-trac] [WordPress Trac] #46217: wp_mail() not sending messages on PHP7.3.x
WordPress Trac
noreply at wordpress.org
Fri Feb 8 14:57:30 UTC 2019
#46217: wp_mail() not sending messages on PHP7.3.x
--------------------------+-----------------------------
Reporter: whatevs | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: 5.0.3
Severity: normal | Keywords: needs-testing
Focuses: |
--------------------------+-----------------------------
Hi,
I believe that this is a bug but my PHP-fu is not yet the belt color
needed to further debug and fix this.
I have tested this behavior on WordPress 5.0.3 and GitHub sources from
2019-02-07, on FreeBSD and Linux Ubuntu 18.04, with PHP 7.3.1.
PHP versions 7.2 and older work as expected.
While PHP's mail() sends e-mails flawlessly, there are no attempts to open
connection to a SMTP server when using wp_mail().
This issue covers all WordPress e-mails including the initial "New
WordPress Site" message. Example code, working on PHP 7.2 but not on 7.3.
{{{#!php
<?php
require('./wp-config.php');
$headers = 'From: whatevs <tester at proper-and-existing-domain.net>' .
"\r\n";
wp_mail('something at proper-and-existing-domain.com','wp mail test','test
test test', $headers );
}}}
The above example works with PHP 7.3 when "wp_mail" is replaced with
"mail". 3rd party PHPmailer also works on PHP 7.3 with no issues.
Upon testing this behavior with tcpdump I can see that with PHP 7.2,
WordPress opens a connection to 127.0.0.1:25 and tries to send the
message. With PHP 7.3 there are no attempts to establish such connection
on lo interface nor any other.
The following change results in: "Invalid address: (setFrom) tester
@proper-and-existing-domain.net"
{{{
--- wp-includes/pluggable.php 2019-02-08 15:37:38.459579000 +0100
+++ wp-includes/pluggable.php-debug 2019-02-08 15:37:29.683718000
+0100
@@ -364,7 +364,8 @@
$mail_error_data['phpmailer_exception_code'] =
$e->getCode();
/** This filter is documented in wp-
includes/pluggable.php */
- do_action( 'wp_mail_failed', new WP_Error(
'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
+ //do_action( 'wp_mail_failed', new WP_Error(
'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
+ print('DEBUG '.$e->getMessage().' DEBUG');
return false;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46217>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list