Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to stop Contact From 7 from adding paragraph and break tags to HTML emails but can't figure it out. About 4 blank paragraph tags are added at the beginning of the email and two at the end.

This question brings up the same issue, and the fix is said to have come in a recent update but I have the most recent one and no luck.

Any ideas?

share|improve this question
add comment

5 Answers

I came to the conclusion that new lines (enter's) in the textarea are being converted to html line breaks (br's).

So if I put the input on the same line as the label, it shows correctly.

Hope it helps.

share|improve this answer
add comment

This seems to be a bug with the contact form plugin. You may look at the plugin source files to see if there are extra

tags.

share|improve this answer
add comment

well if you updated and it didn't work, try doing the fix manually

as per this user

"The solution I came up with was a serious hack, but there was no other way around it short of editing the plugin's core code. Just stick this somewhere in your theme's functions.php and it should work:"

    add_filter("wpcf7_mail_tag_replaced", "suppress_wpcf7_filter");
function suppress_wpcf7_filter($value, $sub = ""){
    $out    =   !empty($sub) ? $sub : $value;
    $out    =   strip_tags($out);
    $out    =   wptexturize($out);
    return $out;
}

hope it helps - otherwise if you are really helpless u might have to roll back to an older version of contact form. Version 2.2.1 doesn't seem to have this problem while version 2.3 has it

share|improve this answer
    
I tried that fix yesterday and again today with no luck. –  Carson Feb 2 '11 at 13:13
    
@carson tried using an older version of contact form ? –  mireille raad Feb 2 '11 at 15:15
add comment

I agree with David Garcia, in the textarea where you compile your form, any new line is converted to a
tag.

the paragraphs instead are automatically created by CF7 in rendering the forms. You've just to reset css to p tags inside the form.

share|improve this answer
    
Nope, I had a css reset. Extra blank paragraph tags were being added somewhere out of my control. I ended up making my own form and sending it hah. –  Carson May 3 '11 at 19:59
add comment

Open the "classes.php" file in the CF7 plugin's "includes" folder and uncomment the following line (number 550) like so ...

//$body = wpautop( $body );

Hope this helps (you too)!

TIP: Minify your HTML-Email-Content with a HTML-Minifier - just to be safe ;)

share|improve this answer
1  
Modifying the core files directly is not a good practise. –  Maruti Mohanty Dec 19 '13 at 19:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.