Change WordPress Mail Sender

WordPress makes it easy and fast to add new users in the backend. Since version 2.8 of WordPress, it can send the access information via email. A nice feature, with no additional settings to change the sender of this email. For example the email should be send from the administrator instead from WordPress.

Nevertheless, there is a possibility and with the help of two hooks, the sender can be changed. I created a small Plugin, where you can easy and simple adjust the sender name and sender email.

The Plugin is available in the following source code and has no options for the backend and doesn’t leave any data in the database. Anyone who wants can simply extend the Plugin.

The values for name and email have to be maintain in each of the associated function. After that, the two values are getting examined, but is not necessarily needed.

As a note: the function esc_attr() is only since version 2.8 available and replaces the function attribute_escape(). Should the solution be used in an earlier version, then you have to change the function.

For suggestions and improvements, I am grateful, as always. You can use this Plugin to improve WordPress a bit and the user is not surprised about the sender “WordPress”.


Posted

in

by

Comments

4 responses to “Change WordPress Mail Sender”

  1. Spence Kiddle Avatar
    Spence Kiddle

    Frank,

    Awesome little script very easy to use.
    FYI the function names are flipped.

    //new name
    fb_mail_from()
    should be fb_mail_from_name()

    //new email-address
    fb_mail_from_name()
    should be fb_mail_from()

  2. Frank Avatar

    @Spence Kiddle: thanks for your hint; you have right.
    I have fixed this.

  3. Mike Avatar

    awesome post! If you are looking to just change the name of the default sender from “WordPress” to something like “Mike” just edit line 352 of pluggable.php. change:

    $from_name = 'WordPress';

    to

    $from_name = 'Mike';

    As a side note, if you update wordpress, this change will be undone…so a more permanent solution would be to use a plugin. But for quick and easy, this is a viable solution.

  4. Derry Avatar
    Derry

    @Mike

    edit line 375 in WordPress 3.0 . You also want to edit line 391

    $from_email = ‘wordpress@’ . $sitename;

    Cheers