• Hello,

    I have Contact Form 7 version 4.3.1 and WordPress 4.4.1.

    I added define( ‘WPCF7_AUTOP’, false ) to the wp-config.php file but the HTML mails are still being sent with p tags everywhere.

    I confirmed that it is a Concact Form 7 issue, because when I uncheck Use HTML content type the p tags disappear (but obviously the mail is sent in plain text and the HTML code is visible).

    Contact Form 7 is changing the HTML code and sending it like this:

    <p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http=
    ://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></p>=0A<p><html xml=
    ns=3D"http://www.w3.org/1999/xhtml" lang=3D"en" xml:lang=3D"en"></p>=0A<=
    p><head><br />=0A<meta http-equiv=3D"Content-Type" content=3D"text/html;=
     charset=3Dutf-8"><br />=0A<meta name=3D"viewport" content=3D"width=3Dde=
    vice-width, initial-scale=3D1.0"/><br />=0A </head></p>=0A<p><body><br /=
    >=0A<img src=3D"http://somedomain/images/someimage.png"></p>=0A<p>Dear Joe=
    ,</p>=0A<p>Thanks for contacting us! This is just a note to confirm that=
     we have received your message.  We'll analyze your request and reply as=
     soon as possible.</p><br />=0A</body></p>=
    =0A

    But it should be sent like this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
     </head>
     <body>
    <img src="http://somedomain/images/someimage.png" >
    Dear [your-name],<br /><br />
    Thanks for contacting us! This is just a note to confirm that we have received your message.  We'll analyze your request and reply as soon as possible.<br /><br />
    </body>

    Please any help will be greatly appreciated.

    Mc

    https://wordpress.org/plugins/contact-form-7/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    The WPCF7_AUTOP constant doesn’t affect HTML in mail. It’s for HTML in form.

    Handling the doctype declaration and HTML header in a message body is one of unresolved issues.

    I am also experiencing this issue?!
    Contact Form 7 v 3.4.1 and WordPress v 4.4.1
    Website hosting provider is GoDaddy

    The email form was working perfectly…as far as I know nothing changed. And now the auto responder is not sending when I place the company name inform of the <email address> (Example From: Company Name <email@websitename.com>), won’t send.

    And both emails (The one to the company and the auto-responder) have arbitrary coding and html in them:

    Reply To: User <user@email.com>
    MIME-Version: 1.0
    Content-Type: text/html; charset=UTF-8
    Content-Transfer-Encoding: 8bit

    <p>Name: User
    Email: user@email.com
    Company Name: FORM-TEST (2), please reply to sender</p>

    Do I need to revert to an older version of CF7 while this is being resolved?

    **Typo Above**
    Contact Form 7 v 4.3.1 (most current)

    Thread Starter mcclausky

    (@mcclausky)

    Hi Takayuki,

    It’s not happening only with DOCTYPE declarations. When I don’t specify DOCTYPE, CF7 will still wrap everything in p tags. This means that if I include ONLY this code:

    <img src="http://somedomain/images/someimage.png" >
    Dear [your-name],<br /><br />
    Thanks for contacting us! This is just a note to confirm that we have received your message.  We'll analyze your request and reply as soon as possible.<br /><br />

    The CF7 will send it like this:

    <p><img src=3D"http://somedomain/images/someimage.png"></p>=0A<p>Dear Joe=
    ,</p>=0A<p>Thanks for contacting us! This is just a note to confirm that=
     we have received your message.  We'll analyze your request and reply as=
     soon as possible.</p>

    Any idea why this is happening?

    Thank you in advance.

    Thread Starter mcclausky

    (@mcclausky)

    Takayuki?
    Sorry if I insist, but the issue is not happening only with DOCTYPE declarations. When I don’t specify DOCTYPE, CF7 will still wrap everything in p tags.

    Your help will be greatly appreciated.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Yes. Please read my answer. It is the correct behavior.

    Can you add a another defined value to handle this issue?

    //*** add in wp-contact-form-7.php

    if ( ! defined( 'WPCF7_AUTOP_EMAIL_BODY' ) ) {
    	define( 'WPCF7_AUTOP_EMAIL_BODY', true );
    }

    //*** modify the compose() function in mail.php on line 51:

    $body = $this->replace_tags( $template['body'], true );
    if( WPCF7_AUTOP_EMAIL_BODY ) {
         $body = wpautop( $body );
    }
    • This reply was modified 7 years, 5 months ago by creativeround. Reason: code indentation fix
    • This reply was modified 7 years, 5 months ago by creativeround. Reason: code indentation fix
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘define( 'WPCF7_AUTOP', false ) not working, p tags still there’ is closed to new replies.