Change WordPress Default Sender

Little quick tip for users of the CMS WordPress, tired of seeing the function wp_mail send automatic messages to their users under the email " WordPress@yourdomain.com“. To overcome this problem, there are unfortunately no settings in the backend of WordPress. So, here is a little filter seen on Butterblog.com, the author of the WP-Members plugin, which allows you to customize not only the default WordPress sending email address, but also the sender name.

We will filter wp_mail_from And wp_mail_from_name, by editing the file functions.php.

functions.php:

add_filter( 'wp_mail_from', 'my_mail_from' );
function my_mail_from($email)
{ return ''; }
add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
function my_mail_from_name($name)
{ return 'My Name'; }

Ziyad Bachalany

The author

Ziyad Bachalany

Entrepreneur and web consultant in Paris. I managed a group of four restaurants, launched software for restaurateurs, and published WordPress plugins. I build websites, tools, and automations for freelancers, businesses, and SMEs.

Comments

One response to “Changer l’expéditeur par défaut de WordPress”

  1. xavier Avatar
    Xavier

    Good morning,

    which functions.php file should you modify exactly because there are several?

    Thanks in advance

Leave a Reply

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