How to Change the Sender Name and Address in WordPress Emails

If you’re not using SMTP on your WordPress site, the system emails sent by the CMS will show “WordPress” as the sender.
These system emails are sent when a new account is created, a password is reset, and similar actions.

Here’s how to fix this and make it more user-friendly. Simply add the following lines to your functions.php file or your custom plugin:

<?php
/*
* Changes sender name and address for WordPress emails
*
*/

add_filter("wp_mail_from_name", function ($current_name) {
    return "My Company";
}, 999);
add_filter("wp_mail_from", function ($current_email) {
    return "no-reply@website.ch"; 
}, 999);
?>

 

 

Submit a Comment

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