Do you want to change the default sender name and email address for outgoing WordPress emails? By default, WordPress uses ‘WordPress’ as the sender name for all outgoing WordPress notification emails. In this article, we will learn how to change the default sender name and email address in outgoing WordPress email in static and dynamic way.

We need to add the following code in your theme’s functions.php file or a your desired plugin.

1. Dynamic Site Options :

/* change WordPress default email FROM name*/
function codecanal_mail_from_name($old) {
    $site_name = get_option( 'blogname');
    return $site_name;
}

add_filter('wp_mail_from', 'codecanal_mail_from');
function codecanal_mail_from($old) {
    $email = get_option( 'admin_email' );
    return $email;
}

2. Custom Site Options :

/* change WordPress default email FROM name*/
function codecanal_mail_from_name($old) {
    return 'John Doe'; 
    /* replace "John Doe" with your desired name */
}

add_filter('wp_mail_from', 'codecanal_mail_from');
function codecanal_mail_from($old) {
    return 'admin@example.com'; 
    /* replace "admin@example.com" with your desired email address */
}
There are currently no comments.