Title: Sender email through theme function.php
Last modified: March 12, 2021

---

# Sender email through theme function.php

 *  [Taner Temel](https://wordpress.org/support/users/clu55ter/)
 * (@clu55ter)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/sender-email-through-theme-function-php/)
 * Hello,
 * Until WordPress 5.7 update I was able to put the following snippet into my theme
   function.php to send the site emails through a different email address due to
   the strict filtering we have on our network.
 *     ```
       /*--------------------------------------------------------------
       	// Sender email address
       --------------------------------------------------------------*/
       function wpb_sender_email( $original_email_address ) {
       		return 'no-reply@my-company.net';
       }
       // Function to change sender name
       function wpb_sender_name( $original_email_from ) {
       		return 'My Company';
       }
       // Hooking up our functions to WordPress filters
       add_filter( 'wp_mail_from', 'wpb_sender_email' );
       add_filter( 'wp_mail_from_name', 'wpb_sender_name' );
       ```
   
 * But since WordPress 5.7 update if anyone tries to use the password reset on the
   login page they get the following error:
 * “Error: the email could not be sent. Your site may not be correctly configured
   to send emails.” message when they try to change their passwords.
 * When I remove the code from function.php the error message disappears but the
   email gets filtered on our network.
 * Can anyone think of a way I can get this to work?
 * Many thanks
    Clu55ter

The topic ‘Sender email through theme function.php’ is closed to new replies.

## Tags

 * [sender email](https://wordpress.org/support/topic-tag/sender-email/)

 * 0 replies
 * 1 participant
 * Last reply from: [Taner Temel](https://wordpress.org/support/users/clu55ter/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/sender-email-through-theme-function-php/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
