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 wordpress@your-domain.com and the from name is set to WordPress.

This doesn't look the most professional if you're sending customer's email address from wordpress@your-domain.com.

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 'the-new-email-address@yourdomain.com';

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.

Back to top

Leave a Reply

Your email address will not be published. Required fields are marked *