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 '[email protected]'; } // 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.