2

Is it possible to have different "FROM" / sender email addresses for the different outgoing email types in woocommerce?

For example;

  • Processing, Complete, Order on hold, refunded to come from orders@domain.com email address

  • Reset password, New accounts to come from accounts@domain.com

I can only see the option to have ALL emails sent from the same email address that is put in the "FROM" email field but would like to be able to have different FROM/sender emails for different types of email?

SeanT
  • 21
  • 4

1 Answers1

0

Late, I know... But, from what I can tell, there's no existing solution and it's certainly not an option that comes default with WooCommerce.

You can set the sender manually for each email ID you can check against with a conditional.

For example, when an email is sent, check if it is "whatever email" and if so, mail sender is "abc@abc.abc". This would be relatively straight forward with WooCommerce emails, but I'm not too sure of all the internal WP emails and whether there's something you can check against for them.

Here's how you would do it in WC (from this post) - Add this to your functions.php or a custom plugin.

// Change sender name
add_filter( 'woocommerce_email_from_name', function( $from_name, $wc_email ){
    if( $wc_email->id == 'customer_processing_order' )
        $from_name = 'Jack the Ripper';

    return $from_name;
}, 10, 2 );

// Change sender adress
add_filter( 'woocommerce_email_from_address', function( $from_email, $wc_email ){
    if( $wc_email->id == 'customer_processing_order' )
        $from_email = 'jack.the.ripper@freek.com';

    return $from_email;
}, 10, 2 );
Benbodhi
  • 197
  • 1
  • 15
  • Are you using a custom plugin for that? – rraallvv Dec 28 '18 at 21:26
  • @rraallvv you can make a custom plugin to hold this code or just put it in your child theme’s functions.php file. You could also use a php snippets plugin to hold it. But there is no other plugins needed to run it. – Benbodhi Dec 28 '18 at 21:48