• So I’m trying to set the sender email for the “New Account” and “Password Reset” to “[email protected]”. Currently WooCommerce settings has “[email protected]” as the default sender email address and that works fine for all the other emails. Using WooCommerce Email Template Customizer to customize the look of the default emails but I don’t think this has anything to do with it. I’ve tried several different snippets but most of them are outdated by 3+ years so the syntax is probably wrong and they do not work. If someone could let me know what I’m doing wrong I would greatly appreciate it! Here’s what I’ve tried so far:

    //// Change sender address
    add_filter( ‘woocommerce_email_from_address’, function( $from_email, $wc_email ){
    if( $wc_email->id == ‘customer_new_account’ )
    $from_email = ‘[email protected]’;

    return $from_email;
    }, 10, 2 );

    add_filter( ‘woocommerce_email_from_address’, function( $from_email, $wc_email ){
    if( $wc_email->id == ‘customer_reset_password’ )
    $from_email = ‘[email protected]’;

    return $from_email;
    }, 10, 2 );`

    AND

    // Email From
    add_filter( 'woocommerce_email_from_address', 'change_from_email', 10, 3 );
    function change_from_email( $from, $email ) {
        if( $email->id == 'customer_reset_password' ){
            $from = '[email protected]';
        }
        return $from;
    }

    AND

    // Change Sender Per Email
    add_filter( 'woocommerce_email_from_address', 'my_email_from_address', 10, 2 );
    function my_email_from_address ( $from_email, $wc_email ) {
        // Targeting specific email notification via the email id
        if ( $email->id == 'customer_reset_password' || 'customer_new_account' ) {
                $from_email = '[email protected]';
            }
        }
    
        return $from_email;
    • This topic was modified 2 years, 10 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce Set Sender Email For “New Account” and “Password Reset”’ is closed to new replies.