How-To Modify the From Email Address and Name in WP

After installing WordPress on your server you realize that although the site emails are sent properly, the sender address and name have nothing to do with your brand.How-to Modify the Address and Name for outgoing emails in WP

Since you are in the process of building your brand, all your site’s attributes should support that effort.

Especially when it comes to the email address it is important to set your own based on your domain name otherwise your outgoing messages will end up in the recipient’s spam folder.

Get the snippets

You can easily modify these by using the snippets below. Each snippet should be placed in functions.php file of your active theme, preferably a child theme.

From email address

The email address that will show up as the sender e-mail for all the outgoing messages from your site.

add_filter( 'wp_mail_from', 'example_wp_mail_from' );
function example_wp_mail_from( $original_email_address ) {
	//Make sure the email is from the same domain 
	//as your website to avoid being marked as spam.
	return 'webmaster@mydomainname.com';
}

[Source]

From name

The sender name that will show up for all the outgoing e-mail messages from your site.

add_filter( 'wp_mail_from_name', 'example_wp_mail_from_name' );
function example_wp_mail_from_name( $original_email_from ) {
	return 'My Awesome Website';
}

[Source]

Get my plugin

You don’t want to mess up with files and manual modifications?

Get my free plugin from GitHub which uses info@yourdomain.com as the address and your site title as the name.

Comments

Leave a Reply

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