April 3, 20197 yr I'm stumped by this. Code like this works both from the command line (php -f mailtest.php) and via the web. No errors, mail is seen hitting my local ssmtp instance (this host is not running the mail server portion of froxlor): <?php ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "emailtest@YOURDOMAIN"; $to = "YOUREMAILADDRESS"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; mail($to,$subject,$message, $headers); echo "Test email sent"; ?> WordPress, which uses PHPMailer fails to send mail silently. No errors in php-fpm's log, no errors in apache, and if I turn on php errors and WP_DEBUG, nothing, just silent failure. Also noticed that when I add new customers in froxlor, there is an error about not being able to send email. AND froxlor uses PHPMailer. So what might be stopping PHPMailer from working system-wide, but not php's mail() function?
April 3, 20197 yr Don't know for WordPress, but in Froxlor its mostly due to an invalid email address in the settings
April 4, 20197 yr Author This is some weird php/phpmailer/pcre2 issue apparently. For Froxlor, just updating phpmailer to a current version will resolve it (I tested with 6.0.7). For Wordpress, same thing, have to wait for them to sync up with the current version of phpmailer. Other workarounds: - downgrade to php 7.2 - manually build php 7.3 from source using a few specific versions of pcre that don't expose the bug - in Wordpress, add a filter to disable the regex: add_filter( 'wp_mail_from', function($from){PHPMailer::$validator = 'noregex'; return $from;} ) Just answering here for anyone wandering in from google... It's vexing because unless you turn on debugging in phpmailer, you get a very generic 'invalid address' error (sender? recipient? who knows?).
Archived
This topic is now archived and is closed to further replies.