Question: 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' & 'wordpress@mydomain.com'.

```
// 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 'site-admin@mydomain.com';
}
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 & wordpress@mydomain.com)? 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.

Answer: 
I think I found the answer on another forum discussing using Contact Form7, with the same issue I was having.

This is what I got from that thread and tried. It does appear to work and does appear to be only targeting email from the default 'Wordpress' sender name/email.

```
// Change default WP email sender
add_filter('wp_mail_from', 'doEmailFilter');
add_filter('wp_mail_from_name', 'doEmailNameFilter');

function doEmailFilter($email_address){
if($email_address === "wordpress@mydomain.com")
    return 'site-admin@mydomain.com';
else
    return $email_address;
}
function doEmailNameFilter($email_from){
if($email_from === "WordPress")
    return 'Site Admin';
else
    return $email_from;
}

```

Let me know if there is a better way to do this. Sorry if obvious...
I had a related issue and coded a plugin a few weeks ago. [WP-HTML Mail](http://wp-html-mail.com) doesn't support gravity forms now, but if you decide to change you form to Ninja Forms, the plugin is perfect for you.
I added detectors for plugins to find out which plugin just sent the mail.
Changing formatting and sender can be turned on/off for detected plugins.