WordPress – how to change the ‘From’ address for password reset and notification emails

When WordPress sends emails it should use the email address set in the Settings -> General -> ‘E-mail Address’ field.

WordPress-FromEmail1

However, I’ve seen cases where it hasn’t used this address and has instead used an address associated with the host, such as the cPanel email address.

If you’re having troubles getting WordPress to use your address or display name you can use the following code.

This will force WordPress to use the specified “from name” and email address for ALL emails sent.

Simply copy it into your theme’s functions.php file and change as required.

add_filter( 'wp_mail_from', 'itsg_mail_from_address' );
function itsg_mail_from_address( $email ) {
return '[email protected]';
}
add_filter( 'wp_mail_from_name', 'itsg_mail_from_name' );
function itsg_mail_from_name( $from_name ) {
return 'Senders Name';
}