Today I had to solve the problem, that my wordpress cron throws an exception like this when sending an email via wp_mail function inside a cron scheduled event function.
|
PHP Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: (setFrom) wordpress@' in /var/www/clients/client2/web8/web/wp-base/wp-includes/class-phpmailer.php:1023 Stack trace: #0 /var/www/clients/client2/web8/web/wp-base/wp-includes/pluggable.php(352): PHPMailer->setFrom('wordpress@', 'WordPress', false) #1 /var/www/clients/client2/web8/web/wp-base/wp-content/plugins/sheldon_misc/admin/class-sheldon_misc-admin.php(183): wp_mail('info@ask-sheldon.com....', 'Statusmailing i...', 'The cron for im...') #2 /var/www/clients/client2/web8/web/wp-base/wp-content/plugins/sheldon_misc/admin/class-sheldon_misc-admin.php(143): Sheldon_Misc_Admin::sendStatusMail('ERROR', 0, 'Something went ...') #3 [internal function]: Sheldon_Misc_Admin->process_hourly_cron() #4 /var/www/clients/client2/web8/web/wp-base/wp-includes/class-wp-hook.php(298): call_user_func_array(Array, Array) #5 /var/www/clients/client2/web8/web/wp-base/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array) #6 /var/www/clients/cli in /var/www/clients/client2/web8/web/wp-base/wp-includes/class-phpmailer.php on line 1023 |
The wordpress cron was registered like that:
|
wp_schedule_event( time(), 'hourly', 'intolife_misc_hourly_cron_event' ); |
And the wordpress cron mechanism was triggered via Linux crontab:
|
*/15 * * * * php /var/www/clients/client2/web8/web/wp-base/wp-cron.php |
Problem with wp_mail in wordpress cron […]