In WooCommerce it's bit lengthy because it has two email objects one for creating emails and the other for sending. and, hooking into the WC send process needs grokking of WC to figure out where you need to hook your phpmailer_init action.
To check 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, As you are 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 which must be different from your WP settings. Yo may 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;
}
}