Join

Change Sender Name in Outgoing WordPress Email

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

  1. Adjust the ‘return ‘firstname.lastname@example.com’;’ entry as desired.
  2. Adjust the ‘return ‘FirstName LastName’;’ entry as desired.
// CHANGE THE EMAIL ADDRESS
function wptu_sender_email( $original_email_address ) {
    return 'FirstName.LastName@example.com';
}

// CHANGE THE SENDER NAME
function wptu_sender_name( $original_email_from ) {
    return 'FirstName LastName';
}

// APPLY THE FILTERS
add_filter( 'wp_mail_from', 'wptu_sender_email' );
add_filter( 'wp_mail_from_name', 'wptu_sender_name' );