WordPress self-hosting: How to change default email sender name?

Well, let’s get to the answers! So far, I’ve found two ways how to fix the problem.
[contentblock id=1 img=adsense.png]

  1. I call it ‘a temporary trick’, anyway, let’s go to the wp-include directory and open pluggable.php, then search:
    $from_name = 'WordPress';

    and change it with your name (website name or anything you want).It’s simple and it works, indeed! Unfortunately we have a drawback here, you have to do it every time you update WordPress into the recent one. That’s why I called it a temporary trick. However I use it because it’s effective.

  2. Through functions.php, and this is ‘perhaps’ the smartest way
    Open your functions.php and add this code: 

    add_filter('wp_mail_from', 'new_mail_from');
    add_filter('wp_mail_from_name', 'new_mail_from_name');
    
    function new_mail_from($old) {
        return 'admin@yourblogname.com';
    }
    function new_mail_from_name($old) {
        return 'Blog Name';
    }

    However, I haven’t tried this way, so I don’t know whether it works or not 😛

Sources:

I hope it is useful 🙂

Leave a Reply