I have a question about changing the default sender From name/email on default wp_mail notifications (e.g., Lost Password response), but WITHOUT it messing up notifications being passed on by Gravity Forms.
I've found a few threads on changing the default From name/email, and this is what I ended up using. It did work properly to change the default sender from 'Wordpress' & '[email protected]'.
// Change default WP email sender
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
return '[email protected]';
}
function new_mail_from_name($old) {
return 'Site Admin';
}
But it ended up also changing all form submissions being passed on from Gravity Forms, as that just uses wp_mail to process the completed form submissions. The Gravity Forms submissions SHOULD retain the From name/email entered by the user when completing the form. This info is stored in the header and passed on to wp_mail for sending.
- Is there a way to modify the function so it ONLY affects any mail being sent by the default address (Wordpress & [email protected])? Maybe some sort of search/replace?
I'm also open to using SMTP sending if this could help and be more secure/robust. Unfortunately, I'm just not fluent in PHP to be able to write the function myself.