Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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
    Kristof

    #225564

    Hey 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,
    Devin

    #225593

    Hello,

    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

    #226551

    What title and field names do you have for the form? Do any of them have accented characters?

    #227514

    Title: Contacteer ons

    fields:

    Naam, email, onderwerp, boodschap (name, email, subject, message). No accented characters no.

    #228375

    Hey!

    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,
    Peter

    #801330

    This 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,
    Stuart

    #802396

    Hi,

    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,
    Ismael

    #802576

    Thank you Ismael for your quick response. Works perfectly….you guys are great!

    #802593

    Hi,

    Glad Ismael helped you and thanks for using Enfold :)

    Best regards,
    Nikko

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘contact form in template’ is closed to new replies.