Viewing 24 posts - 1 through 24 (of 24 total)
  • Author
    Posts
  • #1054567

    Hi,
    we use the contact form for several forms.
    But we have a “spf-Filter” and so we need to set the “from” to a special email-adress.
    But the from is the email adress that the user enters in the form. Where can I change this?
    We have this problem since the last update from enfold.
    Thank’s for help
    NAdja

    #1055388

    Noone the same problem?
    We have the problem since the update in december.
    Nadja

    #1055920

    Hi,
    Sorry for the late reply, I’m not sure what you mean by “spf-filter”
    but if you are using SMTP often you need to set the “from” address for your email server, if that is what you mean, then Try adding this code to the end of your functions.php file in Appearance > Editor:

    
    // set contact form "from" address to SMTP domain to receive emails
    // AND allow vistor address to be in the "to" address in the autoresponder
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
    	global $enfold_custom_from_header;
    	$enfold_custom_from_header = $from;
    	$from = " (Email address hidden if logged out) ";
    	return $from;
    }
    
    add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 10, 3);
    function avf_form_autoresponder_from_mod($from, $new_post, $form_params) {
    	global $enfold_custom_from_header;
    	return $enfold_custom_from_header;
    }

    please be sure to change the address ” (Email address hidden if logged out) ” in the code.

    Or if you just want to change the “from” address:

    // change from address
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
        $from = " (Email address hidden if logged out) ";
        return $from;
    }
    

    If you need to add a “reply to” address so it won’t be marked as spam:

    // add reply-to in mail header
    add_filter( 'avf_form_from', 'enfold_customization_contact_form_etc', 10, 3 );
    function enfold_customization_contact_form_etc( $from, $p1, $p2 ) {
      global $enfold_custom_from_header;
      $enfold_custom_from_header = $from;
    }
    add_filter( 'avf_form_mail_header', 'enfold_customization_contact_form_etc2', 10, 3 );
    function enfold_customization_contact_form_etc2( $header, $p1, $p2 ) {
      global $enfold_custom_from_header;
      $header .= 'Reply-To: ' . $enfold_custom_from_header . '\r\n';
      return $header;
    }

    Please don’t use all of these, only one at a time until you find the one that is working for you.

    Best regards,
    Mike

    #1056141

    The spf-filter is a filter for spam.
    And we tried the smtp-plugin but it doesn’t work. We don’t know why (perhaps it is a problem from the provider).
    So we have to change the “from” in the email.
    Nadja

    #1056179

    Hi,
    Thanks for the feedback, please try the solutions posted above, one should work for you, I believe it would be the second one, but if not then remove it and try the first one.

    Best regards,
    Mike

    #1056487

    I will try it.
    Thank you
    Nadja

    #1056549

    Hi Nadja,

    Thanks for the feedback. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1059596

    This is really strange…
    I added this to my function.php

    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
        $from = " ( (Email address hidden if logged out) ) ";
        return $from;
    }

    If I send the form, I get the reply email and on the website I get the “Thank you”-Site.
    But the email do not arrive on the server the form is sent. ( I hope you understand what I mean).

    Nadja

    #1059870

    Hi,
    Please include a admin login in the Private Content area, so we can be of more assistance.

    Best regards,
    Mike

    #1059962

    Here you are.
    Thank you for your help.
    Nadja

    #1060691

    Hi,
    Thank you for the login, but I didn’t see a contact form on any of the pages to test, which page is it on?
    Did you see this error in your Forms setting?
    2019-01-30-205635
    If fixing the error doesn’t solve, please install WP Mail Logging plugin, for us, it helps with finding errors when we send test messages though your site.

    Best regards,
    Mike

    #1060826

    We do not use this email-plugin. We are using the form-element from enfold.
    You can find it for example here:

    #1060856

    It is really strange.
    If I use the standard form element the emails arrive.
    But if I set the from

    // change from address
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
        $from = " ( (Email address hidden if logged out) ) ";
        return $from;
    }

    I get my autoresponder email but the real email do not arrive. It seems that it is blocked from the provider (we cannot find it in spam or log).
    Have you any idea?
    Thank you
    Nadja

    #1060941

    Hi,
    Your provider could be marking it as spam at the server level because it’s coming from a different domain than the email is.
    It is common for the email filter to trash it before it gets to your inbox.
    Is your email server the address in the functions.php?
    did you try this function?

    // set contact form "from" address to SMTP domain to receive emails
    // AND allow vistor address to be in the "to" address in the autoresponder
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
    	global $enfold_custom_from_header;
    	$enfold_custom_from_header = $from;
    	$from = " (Email address hidden if logged out) ";
    	return $from;
    }
    
    add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 10, 3);
    function avf_form_autoresponder_from_mod($from, $new_post, $form_params) {
    	global $enfold_custom_from_header;
    	return $enfold_custom_from_header;
    }

    Best regards,
    Mike

    #1061054

    I will try it.
    Thank you.
    Nadja

    #1061317

    Hi,
    I believe that when the form sends the email to your inbox your spam filter sees what the domain of the site is, but the different “from” domain that you are adding is triggering the spam filter, which trashes it before the spam folder.
    Please try making the “from” address the same as the site domain and your inbox, to confirm that you site is sending the message and your inbox will receive it.

    Best regards,
    Mike

    #1063086

    Hi I signed up for this problem too. This is unfortunately a developers mistake since the internet is there. In the past I was responsible for a large marketing system and we worked together with Barracuda Anti Spam so I have my experience on this area.

    The receiver (the website owner / backend employee) should NEVER receive the emails through the email address of the website visitor but through a correct internal email (from the website owner’s owned email domain). This is bad programming, so please change this. Thank you.

    • This reply was modified 5 years, 10 months ago by avdprojects.
    #1063408

    Hi,

    @avdprojects
    to change the from address of your email, use this code to the end of your functions.php file in Appearance > Editor:

    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
    	global $enfold_custom_from_header;
    	$enfold_custom_from_header = $from;
    	$from = " (Email address hidden if logged out) ";
    	return $from;
    }
    
    add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 10, 3);
    function avf_form_autoresponder_from_mod($from, $new_post, $form_params) {
    	global $enfold_custom_from_header;
    	return $enfold_custom_from_header;
    }

    please change the ” (Email address hidden if logged out) ” to your email address.

    Best regards,
    Mike

    #1063515

    @Mike, Thank you for your reply, I will implement your advice. But still I think the current method to handle SMTP protocol is wrong and should be changed in the core of the Enfold theme. Furthermore I some Enfold users who are not developers and never understand this whole topic.

    I could not find a good example and the moment, but this page shows that how it works at the moment in Enfold is wrong:
    https://help.dreamhost.com/hc/en-us/articles/214831378-Troubleshooting-WordPress-contact-forms

    Please ask the product owner to put it on a urgent to fix list ;-)

    #1064346

    Hi,
    Thank you for your feedback and the article about the requirements of Dreamhost, but we try to accommodate what our users have requested the most for this function over the years, as our users use many different webhosts, each with different requirements.
    We are always happy to assist each user with their own and their hosts requirements.

    Best regards,
    Mike

    #1065960

    We are using the following modified version of the functions to have the visitor address in the Reply-To: header instead of the From: header. (Auto-reply is not configured, so no changes there).

    add_filter('avf_form_from', 'enfold_contact_form_change_from', 10, 3);
    function enfold_contact_form_change_from($from, $new_post, $form_params) {
            global $enfold_visitor_from;
            $enfold_visitor_from = $from;
            $from = "info@<domain>";
            return $from;
    }
    
    add_filter( 'avf_form_mail_header', 'enfold_contact_form_add_replyto', 10, 3 );
    function enfold_contact_form_add_replyto( $header, $p1, $p2 ) {
            global $enfold_visitor_from;
            $header .= 'Reply-To: ' . $enfold_visitor_from . "\r\n";
            return $header;
    }

    Please mind that the “\r\n” has to be in double-quotes not in single-quotes!
    This works for us. However, I would suggest adding a “use Reply-To: instead of From: header for visitor address” option to the contact form settings.

    #1066184

    Hi,

    @rsplaul
    thank you for sharing, I’m sure this will be quite helpful to some.

    Best regards,
    Mike

    #1069986

    Hi @rsplaul @Mike,

    Sorry for my late response. Finally I could test the example provided by @rsplaul and thats works! So Thanks for this ;)

    Also this is the solution what I prefer and tried to explain earlier. The From address in a raw email body should always be an address of a mail domain managed by yourself. No matter what is possible and yes actually all parameters in a raw email body can be used differently but we should not do it!

    The current method what Enfold implemented is coming out the period from before Google where we trust the internet and their users. But in the meantime everything is changed and must be very strict and this counts for the mime FROM-ADDRESS in a email body too. So I really hope the Enfold team will take this solution over and maybe make the “info@<domain>” coming from a setting what can be set through the “Contact Form” settings.

    The solution of @rsplaul is what I have to implement now for more clients and I hope a future update will not overwrite it :-/

    Best regards,
    avdprojects

    #1071578

    Hi,

    The solution of @rsplaul is what I have to implement now for more clients and I hope a future update will not overwrite it

    Do you have a child theme? You should put that filter in the child theme’s functions.php file to keep it from being overwritten during updates.

    Best regards,
    Ismael

Viewing 24 posts - 1 through 24 (of 24 total)
  • You must be logged in to reply to this topic.