Disable WP-HTML-Mail template for specific emails

WP HTML Mail is a free WordPress plugin to customize all your outgoing emails. In most cases the plugin just wraps a container around existing emails and applies some nice styling.

For some plugins like WooCommerce and Easy Digital Downloads it offers advanced styling features.

But many other plugins already use their own template system. WP HTML Mail can’t detect these other templates, but it has a filter to manually disable the template for some emails.

Just add one of the functions below to your themes functions.php

Disable Email Template by subject keyword

Disable Template if message contains a specific string

You can change the functions to use receiver, attachment or anything else to detect your email.

2 thoughts on “Disable WP-HTML-Mail template for specific emails”

  1. Hello, im contacting you to know how i can add more than 1 keyword in this code line
    if( stripos( $email[‘message’], ‘MY KEYWORD 1 MY KEYWORD 2 MY KEY WORD 3’ ) !== false )

    I hope you can help me.
    Thank you

    1. Just write multiple stripos() joined by ||

      if( stripos( $email[‘message’], ‘MY KEYWORD 1’ ) !== false || stripos( $email[‘message’], ‘MY KEYWORD 2’ || stripos( $email[‘message’], ‘MY KEYWORD 3’ ) !== false ) !== false )

Leave a Reply

Your email address will not be published. Required fields are marked *