By Default Wordpress, all outgoing notification mails are sent from WordPress <wordpress@yourdomain.com>. Does Wordpress have a built-in option to change the default name and email address for outgoing mails? There is no built-in option for it. We have to change manually by using WordPress hooks. In this article, I will show you how to change the default sender name and email address in WordPress notification emails.
The functionality
Copy the code and paste into current theme functions.php
// change sender email function
function yr_sender_email( $var_email) {
return 'info@yoursite.com';
}
// change sender name function
function yr_sender_name( $var_name) {
return 'Yourname';
}
// Hooking up our functions to WordPress filters
add_filter( 'wp_mail_from', 'yr_sender_email' );
add_filter( 'wp_mail_from_name', 'yr_sender_name' );
0 comments:
Post a Comment