Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce

Your premise is correct – you can connect to different STMP accounts based on whatever criteria you can build into your action function.

It’s a little tricky with WooCommerce because it has two email objects that it uses, one for creating emails and the other for sending. Also, hooking into the WC send process requires some serious grokking of WC to figure out where you need to hook your phpmailer_init action.

A simple method to figure out whether the email being sent is a WC email or not is to setup WC with a different “from” address in the settings (this address won’t matter anyway, since you’re sending via an SMTP server and you’re re-setting the “from” when you setup your SMTP settings). Go to WooCommerce > Settings > Emails and set a unique “from” address that is different from your WP settings. You can then use that in your logic to determine whether the email is being generated via WC or something else.

add_action( 'phpmailer_init', 'send_smtp' );
function send_smtp( $phpmailer ) {

    // Assuming the WC email is set to a different address than all others (i.e. WP General Settings email).
    $woo_from = get_option( 'woocommerce_email_from_address' );

    // If phpMailer is initialized with the WooCommerce from address...
    if ( $phpmailer->From == $woo_from ) {

        // This is a WooCommerce email.

        $phpmailer->Host       = SMTP_WC_HOST;
        $phpmailer->SMTPAuth   = SMTP_WC_AUTH;
        $phpmailer->Port       = SMTP_WC_PORT;
        $phpmailer->Username   = SMTP_WC_USER;
        $phpmailer->Password   = SMTP_WC_PASS;
        $phpmailer->SMTPSecure = SMTP_WC_SECURE;
        $phpmailer->From       = SMTP_WC_FROM;
        $phpmailer->FromName   = SMTP_WC_NAME;

    } else {

        // It's NOT a WooCommerce email.

        $phpmailer->Host       = SMTP_HOST;
        $phpmailer->SMTPAuth   = SMTP_AUTH;
        $phpmailer->Port       = SMTP_PORT;
        $phpmailer->Username   = SMTP_USER;
        $phpmailer->Password   = SMTP_PASS;
        $phpmailer->SMTPSecure = SMTP_SECURE;
        $phpmailer->From       = SMTP_FROM;
        $phpmailer->FromName   = SMTP_NAME;

    }
}   

UPDATE: Just re-read your question, so this may be a little off. You said you wanted one for WC orders and one for all other forms. What I have above is for any WC email vs any non-WC email. Depending on what you mean by “other forms” (since there are other WC forms and emails), this may not be exactly what you need. If that’s the case, mention it in the comments and I’ll edit accordingly. It may be that you just need to check the subject line to see if it’s an order.