Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #367788

    Hi,

    It looks like when I add a Contact Form using the Advanced Layout Editor, and select Contact Form from the Content Elements, I run into a very specific problem.

    By default, if you have an item and validate it as an email address, it automatically puts the email address in the from field of the email that is generated. That’s great! BUT, not if your email address is a gmail.com address or some other address handled by Google (or AOL or Yahoo).

    The reason is that most emails will get through but emails sent from people with addresses that end in gmail.com, yahoo.com, and aol.com will not get through the form.

    Why? Because of the DMARC policy thing they implemented early this year. Bottom line is that if you fill out a form on my site and use an AOL address as your email address I won’t get it.

    I’ve seen a solution with other form scripts where instead of using the person filling out the form’s email address as the From, the From is set to the default email address on the server. And, as a bonus, the Reply-To is set to the person filling out the form’s email address. That way emails get to me, but in my email program if I hit reply, my email gets sent to the person who filled out the form and not just to the default email address.

    Is there a similar work around here?

    If so how do I implement it?

    #367800

    Hey!

    Try adding this at the very end of your theme / child theme functions.php file:

    function change_cf_from() {
    	return " (Email address hidden if logged out) ";
    }
    add_filter('avf_form_from', 'change_cf_from', 10);

    Cheers!
    Josue

    #399886

    That works. Is there a way to set the Reply-To header to the email address of the visitor who filled out the form. That way even though the From field gets through the DMARC issues, if I hit reply in my email program the response goes to the right person instead of the generic email address I’m using to send from the server?

    #399984

    Try with this:

    add_filter('avf_form_mail_header', 'chang_reply_to', 10, 3);
    function chang_reply_to($header, $new_post, $form_params){
    
        $header .= 'Reply-To: ' . $new_post['email'] . "\r\n";
    	return $header;
    
    }

    Best regards,
    Josue

    #428462

    Hi – I know it is a while but just picked this up again and it doesn’t seem to be working. The first bit of code changes the from address – so that works!

    But, the second bit of code doesn’t seem to work. When I hit reply I get an empty To field instead of the value in the Email field.

    Help!

    And thanks in advance!

    #428615

    Hm, let’s discard something, change the last code to:

    add_filter('avf_form_mail_header', 'chang_reply_to', 10, 3);
    function chang_reply_to($header, $new_post, $form_params){
    
        $header .= "Reply-To:  (Email address hidden if logged out)  \r\n";
    	return $header;
    
    }

    Now check if ” (Email address hidden if logged out) ” appears when you hit the reply button.

    Regards,
    Josue

    #428617

    That worked. So how do we get it to be the value entered in the Email field in the form instead of (Email address hidden if logged out) ?

    #428627

    Open js/shortcodes.js and comment/remove this line (98):

    $('.avia_ajax_form', container).avia_ajax_form();
    

    Then change back the code in functions.php to:

    add_filter('avf_form_mail_header', 'chang_reply_to', 10, 3);
    function chang_reply_to($header, $new_post, $form_params){
    
        $header .= 'Reply-To: ' . $new_post['email'] . "\r\n";
    	return $header;
    
    }

    And check if it works now.

    Regards,
    Josue

    #428637

    Didn’t work. Now when I hit reply, it replies to the from address – it is not picking up the email address as the reply-to address.

    The field in the form I am using for the email address is labeled Email when I build the forms in case that matters.

    Do you want me to send you credentials for the site or anything else?

    #428638

    Also, I didn’t modify the shortcodes.js in the enfold theme. Instead I added a js folder in my child theme and dropped in shortcodes.js there and modified that. I think that should work – but maybe not. Didn’t want to modify the enfold theme directly.

    #428660

    No, that won’t work unless you add this to your child theme functions.php:

    function change_shortcodesjs() {
       wp_dequeue_script( 'avia-shortcodes' );
       wp_enqueue_script( 'avia-shortcodes-child', get_stylesheet_directory_uri().'/js/shortcodes.js', array('jquery'), 2, true );
    }
    add_action( 'wp_enqueue_scripts', 'change_shortcodesjs', 100 );
    

    However, i’d suggest doing the change in the parent theme and check if it works first.

    Best regards,
    Josue

    #428882

    Still sending the email to the from address not a reply-to address even with commenting out the line in the js file in the parent theme.

    #429089

    Hi,

    Can you please create me a WordPress administrator account? post it here as a private reply.

    Regards,
    Josue

    #429527
    This reply has been marked as private.
    #429937

    Hey,

    Should work now, try it. I’ve changed the code to:

    add_filter('avf_form_mail_header', 'chang_reply_to', 10, 3);
    
    function chang_reply_to($header, $new_post, $form_params){
        $header .= 'Reply-To: ' . $new_post['email_1'] . "\r\n";
        return $header;
    }

    Best regards,
    Josue

    #431600

    It did – thanks!

    #431634

    I spoke too soon. I just updated the theme from version 3.04 (I think) to the latest version. Now instead of the email in the reply-to looking like:

    (Email address hidden if logged out)

    it looks like:
    (Email address hidden if logged out)

    Please help!

    Thanks in advance!

    #431673

    Hi!

    Could be because the parent, unmodified shortcodes.js is being included, try applying this and then change shortcodes.js in the child theme

    Regards,
    Josue

    #432109

    Removing the line in the parent shortcodes.js file did the trick – thanks!

    #432288

    Hi,

    Glad it worked, i’d suggest trying to implement it on the child theme to avoid losing it when updating.

    Cheers!
    Josue

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