Skip to main content
Login Join
Snippet · PHP

Change Sender Name in WordPress Emails

Shared by Abdullah Kaludi · August 13, 2026

7 views
Back to Snippets

WordPress uses a non-existent email address (wordpress@yourdomain.com) to send outgoing emails by default.

This email address could be flagged as spam by email service providers.

Therefore, if you want to quickly change this to a real email address, then you can add the following code in your functions file

Don’t forget to replace the email address and name with your own information.

// Function to change email address
function wpb_sender_email( $original_email_address ) {
    return 'tim.smith@example.com';
}
  
// Function to change sender name
function wpb_sender_name( $original_email_from ) {
    return 'Tim Smith';
}
  
// Hooking up our functions to WordPress filters 
add_filter( 'wp_mail_from', 'wpb_sender_email' );
add_filter( 'wp_mail_from_name', 'wpb_sender_name' );
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments