[wp-trac] [WordPress Trac] #46217: wp_mail() not sending messages on PHP7.3.x

WordPress Trac noreply at wordpress.org
Sun Aug 3 12:38:10 UTC 2025


#46217: wp_mail() not sending messages on PHP7.3.x
--------------------------+------------------------------
 Reporter:  whatevs       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Mail          |     Version:  5.0.3
 Severity:  major         |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by SirLouen):

 * keywords:  needs-testing =>
 * status:  new => closed
 * resolution:   => worksforme


Comment:

 == Reproduction Report
 === Description
 ❌ This report can't validate that the issue can be reproduced.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.29
 - Server: nginx/1.29.0
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 138.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.3
 - MU Plugins: None activated
 - Plugins:
   * Testing Dolly
   * Test Reports 1.2.0

 === Testing Instructions
 1. I've set up a local mail server in port 1025
 2. Used the exact code provided in comment 4
 3. ❌ Tested running the code, email was delivered

 === Actual Results
 1.  ❌ Error condition is not occurring

 === Additional Notes
 - Long time has passed since this was reported without answers. But it
 seems its not reproducible anymore

 First I've tested this version:

 Replying to [comment:4 netzgestaltung]:
 > Hi, i also do have this issue:
 >
 > With PHP 7.3 on, this test script at page.php fails:
 > {{{#!php
 > <?php
 >
 >     if ( $_GET['testmail'] === "1" ) {
 >       ini_set( 'display_errors', 1 );
 >       error_reporting( E_ALL );
 >
 >       // define the wp_mail_failed callback
 >       function action_wp_mail_failed($wp_error){
 >         echo var_dump($wp_error);
 >       }
 >       add_action('wp_mail_failed', 'action_wp_mail_failed', 10, 1);
 >
 >       $from = "wordpress at alphabetisierung.at";
 >       $recipient = "listing at majors-welt.net";
 >       $subject = "PHP Mail Test script";
 >       $body = "This is a test to check the PHP Mail functionality";
 >       $headers = "From: " . $from . "\r\n";
 >       $mail = wp_mail( $recipient, $subject, $body, $headers );
 >       if ( $mail ) {
 >         wp_die('mail sendt');
 >       } else {
 >         wp_die('mail not sendt');
 >       }
 >     }
 > }}}

 Obviously firstly initializing some server for delivery (I don't have
 locally configured `mail` function with a local MTA server, so I can't
 make direct use of it, but for testing purposes this is irrelevant).

 {{{#!php
 <?php

 function initialize_mail_server( $phpmailer ) {
         $phpmailer->isSMTP();
         $phpmailer->Host = 'localhost';
         $phpmailer->Port = 1025;
 }
 add_action( 'phpmailer_init', 'initialize_mail_server' );
 }}}

 And the mail is going through perfectly

 I'm wondering about this error:
 `string(57) "Invalid address:  (setFrom) wordpress at alphabetisierung.at"`

 It was clearly PHPMailer error, not related with `wp_mail` directly, more
 specifically triggered under
 [https://github.com/PHPMailer/PHPMailer/blob/0ff2d3c8ead628df2493537d9f91db962aa47718/src/PHPMailer.php#L1345-L1349
 these circumstances].

 But, as I say with current PHP version, PHPMailer version and WP version
 its not reproducible anymore. So it's time to close this ticket as
 `worksforme`. Feel free to reopen it or comment back, if you think you
 have newer instructions to reproduce this

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46217#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list