Conditional Logic for Sender Information ?

Posted by: victorwpdev

24th October 2020, 8:30 am

victorwpdev

@victorwpdev

24 Oct 2020
8:30 am

Hello SOM team!

After fully editing the sender information everything works as expected, except for when the password has been reset where the user gets a confirmation from wordpress@mysite.

I used the Code Snippets plugin to include:

// Function to change email address
function wpb_sender_email( $original_email_address ) {
    return 'info@mysite.com';
}
 
// Function to change sender name
function wpb_sender_name( $original_email_from ) {
    return 'Info from MySite';
}
 
// Hooking up our functions to WordPress filters 
add_filter( 'wp_mail_from', 'wpb_sender_email' );
add_filter( 'wp_mail_from_name', 'wpb_sender_name' );

However, this seems to be a global override. Is it possible to add conditional logic to this code so that it only changes if the sender is "Wordpress@mysite" or only for that message in particular?

I'm a complete beginner with code, so I really wouldn't know where to start. All the progress I've done on this is finding and trying what people share on forums. So any advice is appreciated! Love the plugin!