How to Globally Enable HTML for CF7 Mails

If you do not want to enable “Use HTML” for every contact form 7 forms, then you can use the following code snippet:

function we_cf7_always_use_html($cf){

    $wpcf7 = WPCF7_ContactForm::get_current();
    $submission = WPCF7_Submission::get_instance();
    if (!$submission){

    $mail2 = $wpcf7->prop('mail_2');
    if(!empty($mail2)) {
    	$mail2['use_html'] = true;
    	$wpcf7->set_properties( array("mail_2" => $mail2)) ;
add_action( 'wpcf7_before_send_mail', 'we_cf7_always_use_html' );

This will globally enable the use_html filter for all mails.

Leave a Reply

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

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Close Popup
Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

These cookies are necessary for the website to function and cannot be switched off in our systems.

Technical Cookies
In order to use this website we use the following technically required cookies
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

Decline all Services
Accept all Services