Changing the From Name & Email for Transactional Notifications

Due to a restriction in the WordPress wp_mail() function, it is not possible to change some of the header information for transactional notifications. This includes the ‘From’ name and email address, and ‘CC’ and ‘BCC’ details. In order to get around this, you may have to use another plugin or a function (see below) to change the default name and email address of your outgoing notifications. Please be aware though, that by doing this, you may globally affect all notifications that WordPress sends out, possibly¬†including those from BNFW too. Please test appropriately before adding the below code to your website.

To change the default From name and email address in WordPress, paste this code in your functions.php file and change the relevant information.

// Change Default Email Address
function bnfw_change_email_address($email) {
return "email@yourdomain.com";
}
add_filter('wp_mail_from', 'bnfw_change_email_address');
// Change Default Email 'From' Name
function bnfw_change_email_from($from_name) {
return "Your Name";
}
add_filter('wp_mail_from_name', 'bnfw_change_email_from');

It is also worth noting that in order to reduce the chances of your server flagging your notifications as SPAM, you should always ensure that the domain in your ‘From’ email address is the same domain that your website is sending the email out from.