WordPress: Send HTML emails from your plugin

December 7, 2014

By default when you use the wp_mail() function it will send out an ugly text based email. Lucky for you WordPress has an easy built in tool (surprise!) to switch the emails from text emails into html email. Simply drop the following line into your plugin and presto! Html email will flow out of it.

add_filter( 'wp_mail_content_type',create_function( '', 'return "text/html"; ' ) );