How to change the default from wordpress email from address

June 27, 2012

Sometimes you might want to stop Wordpress sending emails with the default Wordpress email from address.

Usually something like wordpress@domain.com

Often displayed like so: Wordpress wordpress@domain.com

There are a few plugins available to achieve this, but personally I don't relying heavily on Wordpress plugins - mainly because dependencies on too many third parties can be annoying.

Particularly when there is not much code needed to achieve the change.

Add the following code to your functions.php file.

add_filter('wp_mail_from', 'replacement_mail_from');
add_filter('wp_mail_from_name', 'replacement_mail_from_name');
 
function replacement_mail_from($old) {
 return 'your email address';
}
function replacement_mail_from_name($old) {
 return 'your name or your website';
}

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.