Skip to content
OSULZER.AT
Code1 min read· updated February 14, 2026

Sending HTML Emails with the WooCommerce Header and Footer

Send HTML emails through the WooCommerce mail function with the default header and footer templates. Handy for quick status emails without extra settings.

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.

WooCommerce Development

Prefer to have it done for you?

Custom plugins, integrations, and B2B features for your shop - €120/h plus VAT.

See WooCommerce development

New project?

Contact.

Tell me briefly about your project - I'll get back to you personally.

Your data is used solely to handle your inquiry. More in the privacy policy.