Opened 8 years ago
Closed 8 years ago
#39360 closed defect (bug) (fixed)
wp_mail throws a phpmailerException when the sender address is incorrect
Reported by: | xknown | Owned by: | dd32 |
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | 4.6.1 |
Component: | Keywords: | ||
Focuses: | Cc: |
Description
The default implementation of wp_mail
causes a PHP fatal due to an uncaught phpmailerException
exception when the From
address contains an invalid email address.
I noticed this error while trying to install WP on a local ubuntu 16.04 VM with PHP 7.1 and the default nginx config (the WP dir was in /var/www/html/wordpress/
).
server { listen 80 default_server; root /var/www/html; index index.php index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; } }
On the last install step, the VM http server responsed with a 500 error page --- the installation seems to have completed though. Here's the stack trace:
PHP message: PHP Fatal error: Uncaught phpmailerException: Invalid address: wordpress@_ in /var/www/html/wordpress/wp-includes/class-phpmailer.php:946 Stack trace: #0 /var/www/html/wordpress/wp-includes/pluggable.php(352): PHPMailer->setFrom('wordpress@_', 'WordPress', false) #1 /var/www/html/wordpress/wp-admin/includes/upgrade.php(395): wp_mail('alex@buayacorp....', 'New WordPress S...', 'Your new WordPr...') #2 /var/www/html/wordpress/wp-admin/includes/upgrade.php(98): wp_new_blog_notification('test', 'http://128.199....', 1, 'The password yo...') #3 /var/www/html/wordpress/wp-admin/install.php(375): wp_install('test', 'alex', 'alex@buayacorp....', 1, '', '...', 'en_US') #4 {main}
Attachments (3)
Change History (5)
#1
@
8 years ago
- Milestone changed from Awaiting Review to 4.8
39360.diff is a patch which catches this fatal error, it doesn't attempt to set a proper sender email address though.
I'm going to redirect conversation for setting a proper sender address over to #25239, leaving this ticket open to get rid of the fatal. I feel like this should probably be pushed into 4.7.1 too.
Unit tests to reproduce this issue.