Hi
You should use the wp_mail hook and make the required changes. More info here: https://developer.wordpress.org/reference/functions/wp_mail/
Here is an example:
add_filter('wp_mail', 'custom_email', 10, 1);
function custom_email($wp_email) {
$wp_email['to'] = 'custom_email@example.com';
return $wp_email;
}
In the code, you should change the value of the “custom_email@example.com” as you like.
The code sends all WordPress email notifications to the email address mentioned in the code.
Thanks. I added the function you provided and made the change to our email address (below) but it doesn’t work. We don’t receive any email once I add this function. When I remove it, it again sends the notifications to the email address in the WP settings.
add_filter('wp_mail', 'custom_email', 10, 1);
function custom_email($wp_email) {
$wp_email['to'] = 'johnb@ourdomain.com';
return $wp_email;
}
We do use the plugin WP Mail SMTP which uses Google for the mailer. This works correctly with the User Submitted Posts plugin and sends their notifications to our address (as defined in the function above).
Any other thoughts?
You’ll need to contact the WP Mail SMTP plugin support with this question.
Thanks but I don’t see how this issue has anything to do with the WP MAIL SMTP plugin.
Without your above code the email is sent to the email address in our settings for admin. with the above code installed nothing is received at the admin address or the email address we inserted in that function.