How To Change the Sender Name and Email in WordPress? Solve Now 1

Hello friends, when a visitor comments on our website or creates an account or contacts us, the e-mail that the visitor receives includes Sender Name: WordPress and Email: wordpress@example.com. Due to this, our website appears unprofessional.

How To Change the Sender Name and Email in WordPress?

So today we will learn how we can change the Default Sender Name and Email Address of our website. So that our mail looks professional.

For this, we can also take the help of various plugins (eg:- WP Mail SMTP). But today we will talk about how to change the Sender Name and Email Address in WordPress with the help of PHP code.

You need to add the following PHP code to your theme’s file.


// Function to change email address
function custom_sender_email( $original_email_address ) {
    return 'xyz@example.com';
}
 
// Function to change sender name
function custom_sender_name( $original_email_from ) {
    return 'Admin Name';
}
 
// Hooking up our functions to WordPress filters 
add_filter( 'wp_mail_from', 'custom_sender_email' );
add_filter( 'wp_mail_from_name', 'custom_sender_name' );

Note: In this code, in place of ‘xyz@example.com’, enter your mail address, and in place of ‘Admin Name’, enter the Sender Name which you want to be displayed.

Kindly Note: This PHP code only helps us to change the Mail Sender Name and Email Address. It is not able to fix any email sending issue.

You can test this code by adding a new user or changing the password or doing any other action (by which the user receives the mail).

    Leave a Reply