16

How to Change Sender Name and Email in Outgoing WordPress Emails

Powered by WPCodeBox

Learn how to easily change the sender name and email address for outgoing WordPress emails. This snippet provides a simple solution to customize your WordPress email settings for improved branding.


/**
 * Author: WP Turned UP
 * Author URI: https://wpturnedup.com
 */
 
 //// 1. Adjust the 'return '[email protected]';' entry as desired.
//// 2. Adjust the 'return 'FirstName LastName';' entry as desired.

----------------- CODE SNIPPET IS BELOW THIS LINE - REMOVE THIS LINE AND ABOVE ----------------- 

// CHANGE THE EMAIL ADDRESS
function wptu_sender_email( $original_email_address ) {
    return '[email protected]';
}
 
// 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' );

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.