You are probably reading this post because have already noticed, that every time someone submitted a comment on your blog, signed up as a user or did anything that required WordPress to generate and send an e-mail, by default the “From Name” in that message appeared as “WordPress” and “From” address was “wordpress@your-domain.com”.
If this is not the way you want it – read on, as there is an easy way of customizing both these fields.
So how can you change these WordPress default email settings for FromName and From address.
So far I found three ways of doing it:
a) you can install a WordPress plugin, for example: Change WP eMail from Tips & Tricks HQ;
b) edit wp-includes/pluggable.php file, look for lines 372-396, and make changes in:
375 | $from_name = ‘WordPress’;
change ‘WordPress’ to ‘your name or your website’
391 | $from_email = ‘wordpress@’ . $sitename;
change ‘wordpress@’ to ‘your name@’
Remember the email address you are changing this to must exist either as a mailbox or a forward.
c) add filter to functions.php file
The third option is my favourite and comes from Deluxe Blog Tips. I prefer to keep all my tweaks in one functions.php file as later I can easily reuse them on another project.
So how do we do this.
First of all you need to find and open functions.php file – it should be in your template folder.
Open it and either at the beginning or the end (as you prefer) – paste the following code:
/** changing default wordpres email settings */
add_filter(‘wp_mail_from’, ‘new_mail_from’);
add_filter(‘wp_mail_from_name’, ‘new_mail_from_name’);
function new_mail_from($old) {
return ‘your email address’;
}
function new_mail_from_name($old) {
return ‘your name or your website’;
}
Obviously you have to replace ‘your email address’ with your actual address, and ‘your name or your website’ with the name that you want to appear as FromName on all messages.
Now, aave file and upload.
These filters will simply override default WordPress email settings.
I hope one of these three solutions worked for you, share and enjoy.