
-
AuthorPosts
-
February 17, 2014 at 3:14 pm #224969
Hello,
When using the contact form in the template, the message is delivered in text with all the tags between. How do I get the message in plain text? No tags etc..
can yo provide me a solution asap?
Thank you
KristofFebruary 18, 2014 at 5:05 pm #225564Hey krimson99!
What do you mean by tags? The contact form should, by default, be only sending a plain text email with the form field names and then their content.
Best regards,
DevinFebruary 18, 2014 at 5:20 pm #225593Hello,
If the contact form is used, this is what the receiptent gets:
Content-type: text/html; charset=utf-8
From: (Email address hidden if logged out)
Stuur ons een mail<br/><br/><br/>Your Message: <br/><br/>Naam: Kristof <br/>E-Mail: (Email address hidden if logged out) <br/>Onderwerp: Test<br/><br/>Boodschap: Hello,<br />
<br />
This is a test to show you the tag and markup text which is shown in the contact form, by the receiptant.<br />
<br />
Kind regards<br />
Kristof<br/><br/>Thanks for checking this out.
Kind regards
Kristof
February 20, 2014 at 4:13 am #226551What title and field names do you have for the form? Do any of them have accented characters?
February 21, 2014 at 3:34 pm #227514Title: Contacteer ons
fields:
Naam, email, onderwerp, boodschap (name, email, subject, message). No accented characters no.
February 24, 2014 at 9:05 am #228375Hey!
It seems like your mail client interprets the html text as plain text. Please try to use another webmail provider or email client if you want to read the email as html mail. If you want to receive plain text mails open up wp-content/themes/enfold/framework/php/class-form-generator.php and replace
$header = 'Content-type: text/html; charset=utf-8' . "\r\n"; $header = apply_filters("avf_form_mail_header", $header, $new_post, $this->form_params); $copy = apply_filters("avf_form_copy", array($to), $new_post, $this->form_params); $message = stripslashes($message);
with
$header = 'Content-type: text/plain; charset=utf-8' . "\r\n"; $header = apply_filters("avf_form_mail_header", $header, $new_post, $this->form_params); $copy = apply_filters("avf_form_copy", array($to), $new_post, $this->form_params); $message = preg_replace("/<br[^>]*>\s*\r*\n*/is", "\n", $message); $message = stripslashes($message);
Regards,
PeterMay 30, 2017 at 3:42 am #801330This fix worked for me until I updated to Enfold 4.07. I noticed the code in wp-content/themes/enfold/framework/php/class-form-generator.php has changed from when this is written.
Is there updated fix for the newer versions of Enfold?
Many thanks. Our incoming contact forms are unreadable and it would be great to get this fixed.
Best,
StuartJune 1, 2017 at 8:07 am #802396Hi,
Please remove the previous modifications then add this filters in the functions.php file.
add_filter('avf_form_mail_header', 'avf_form_mail_header_mod', 10, 3); function avf_form_mail_header_mod($header, $new_post, $form_params) { $header = 'Content-type: text/plain; charset=utf-8' . "\r\n"; return $header; } add_filter('avf_form_message', 'avf_form_message_mod', 10, 3); function avf_form_message_mod($message, $new_post, $form_params) { $message = preg_replace("/<br[^>]*>\s*\r*\n*/is", "\n", $message); $message = stripslashes($message); return $message; }
Best regards,
IsmaelJune 1, 2017 at 3:00 pm #802576Thank you Ismael for your quick response. Works perfectly….you guys are great!
June 1, 2017 at 3:20 pm #802593Hi,
Glad Ismael helped you and thanks for using Enfold :)
Best regards,
Nikko -
AuthorPosts
- The topic ‘contact form in template’ is closed to new replies.