Multisite + wp_mail – Route Via Site Conditionally

Well, I guess this works:

Note: I’m using Postman SMTP; for the example below to work, I imagine that you have to have your server/transactional email delivery service properly configured for each respective ‘from’ email

function conditional_multisite_wp_mail( $post_id, $post, $update ) {

    $to1 = '[email protected]';
    $to2 = '[email protected]';
    $subject1 = 'SPECIFIC: testing right meow';
    $subject2 = 'CURRENT: testing right meow';
    $message="woof";
    $headers1 = 'From: Derp  < [email protected] > \r\n';
    $headers2 = 'From: Herp  < [email protected] > \r\n';
    switch_to_blog(1); // Switch to specific site
    wp_mail( $to1, $subject1, $message, $headers1, $attachments );
    restore_current_blog(); // Restore to current site
    wp_mail( $to2, $subject2, $message, $headers2, $attachments );


}
add_action( 'save_post', 'conditional_multisite_wp_mail', 10, 3 );