Change Default From Email Address in WordPress

How to Change Default From Email Address in WordPress

in WordPress Config
Google+ LinkedIn

By default, WordPress uses the “From Email” as “[email protected]” and “From Name” as “WordPress” when it sends out notifications to users. In our case, the emails come from [email protected] This is meaningless and quite annoying to be honest because WordPress does not offer any way to change this email settings from admin panel and modifying core WordPress file is not a good option either because with each new WordPress update all modified core files will be replaced and you will have to apply modification again.

If you already knew about this little problem then most probably you might have been using a plugin to change default FROM email address in WordPress. There are quite a few plugins in WordPress plugins respiratory that can change FROM email settings but we will show you how you can change these without using a plugin.

Using this code snippet you can change default FROM email address in WordPress. Just paste this snippet in your theme’s functions.php file.

// change default from email address in wordpress
function wcs_change_default_email_address( $old ) {
    $email = get_option( 'admin_email' );
    return $email;
}
function wcs_change_default_email_name( $old ) {
    $site_name = get_option( 'blogname');
    return $site_name;
}
add_filter( 'wp_mail_from', 'wcs_change_default_email_address' );
add_filter( 'wp_mail_from_name', 'wcs_change_default_email_name' );

Now WordPress will use your blog name for “From Name” and admin email address for “From Email”.

Share the love

If you like this snippet, share it with others!

Leave a Reply

Your email address will not be published. Required fields are marked *