The function below lets you send HTML emails through the WooCommerce mail function. The default templates for header and footer are loaded along with it. This is handy if, for example, you want to send status emails quickly without creating extensive backend settings.
function osulzer_send_wc_email($user_email, $subject, $html_message) {
ob_start();
// header template with subject
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $subject ) );
echo $html_message;
// footer template
wc_get_template( 'emails/email-footer.php' );
$message = ob_get_clean();
wc_mail($user_email, $subject, $message);
return true;
}
Learn more about my services as a WooCommerce developer.




