Paulund
2016-09-18 #wordpress

Change WordPress Default Email From Name

If you send emails from your WordPress site using the wp_mail() function you might of noticed that the email address and the email name is not being sent as you would expect it to. When an email is sent by default the from email address is set to [email protected] and the from name is set to WordPress. This doesn't look the most professional if you're sending customer's email address from [email protected]. The solution to this is to use the filters

All you have to do is add the following to your functions.php file.

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 'Your site name';
}

If you find you have to do this a lot for client websites it will be a good idea to create a plugin you can use instead.