WP HTML Mail FAQs

Created by Danny Wong, Modified on Sun, 09 Aug 2020 at 12:48 PM by Danny Wong

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.

How can I remove the link from email header?

By default the logo or header image links to your website. If you want to remove this link add the following line of code to your themes functions.php

add_filter( 'haet_mail_link_header', '__return_false' );

Can I customize the HTML code of the email footer?

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

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

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;
});

Add a rounded border around your email content.

Another example of custom CSS, but not all email clients support rounded corners. In most versions of Microsoft Outlook you will only see regular border with edges.

add_filter( 'haet_mail_css_desktop', function( $css ){
    $css .= '  
            td.header{
                border: 1px solid #ddd;
                border-bottom: none;
                border-top-left-radius: 10px;
                border-top-right-radius: 10px;
            }
            td.content{
                border: 1px solid #ddd;
                border-top: none;
                border-bottom: none
            }
            td.footer-text{
                border: 1px solid #ddd;
                border-top: none;
                border-bottom-left-radius: 10px;
                border-bottom-right-radius: 10px;
            }
        ';
    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 );

If you want to remove the pre-header:

add_filter('haet_mail_preheader','__return_empty_string');

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;
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article