How to Change Sender Name and Address in WordPress Email Without using any Plugins

By default WordPress sender name is “WordPress” which sends emails from a non-exist email address “wordpress@domainname.com” as the sender email.

Many time these type of emails goes in SPAM folder.

You will need to add the following code in your theme’s functions.php file.


// Function to change email address
function wptw_sender_email( $original_email_address ) {
return 'no-reply@domainname.com';
}

// Function to change sender name
function wptw_sender_name( $original_email_from ) {
return 'SITE NAME';
}

add_filter( 'wp_mail_from', 'wptw_sender_email' );
add_filter( 'wp_mail_from_name', 'wptw_sender_name' );

This code simply replaces the default WordPress sender name and email address with your custom sender name and email address.

Leave a Reply

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