WP HTML Mail Documentation

Can I send my newsletter campaigns with this plugin?

No, this is not a newsletter tool, it just makes your emails beautiful but doesn’t send custom ones.

How can I remove the gap at the header of my Contact Form 7 emails?

Go to your Contact Form 7 email settings and change email type from HTML to text. WP HTML Mail will take care of the HTML.

Can a customize the HTML code of the email header?

There’s a filter to change the header HTML code. Just add this to your (child-)themes functions.php:

add_filter('haet_mail_header', function( $header ){
  return 'hello <strong>world</strong>';
});

Of course you can display HTML code, not just text.

Can I add custom CSS code to my WordPress emails?

You can add your own CSS code for desktop and mobile. Just add this example to your (child-)themes functions.php and customize it:

add_filter( 'haet_mail_css_desktop', function( $css ){
    $css.= ' h1{ border-bottom: 2px solid green; } ';
    return $css;
});
add_filter( 'haet_mail_css_mobile', function( $css ){
    $css .= ' h1{ background:red; } ';
    return $css;
});

How can I modify the text shown in short email preview in some mail clients?

Add the following lines of code to your themes functions.php

add_filter( 'haet_mail_preheader', function( $pre_header, $email ){
  return 'this is my custom preheader';
}, 10, 2 );

How to disable the template for some emails?

Find anything all emails hav in common. It may be the sender, a word in the subject or something in the email body.
Then add this function to your (child-)themes functions.php and customize it. Return TRUE if the template should be used and FALSE if not.

// return true if you want to use a template for current mail
// return false if you want to leave the content of this email unchanged
add_filter( 'haet_mail_use_template', 'customize_template_usage', 10, 2 );
  function customize_template_usage( $use_template, $mail ){
  // $mail['to'] ...
  // $mail['subject'] ...
  // $mail['message'] ...
  // $mail['headers'] ...
  // $mail['attachments'] ...
  return true;
}