Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1080916

    Hi,

    when i use the reply function for forms which where send from my website the repply will go to my own e-mail-adress. is there a function to set the “reply to” to the e-mail-adreess the user entered in the form?

    I searched the forum but did not find a definitive / clean answer :(

    best regards
    joschi

    #1081044

    Hey j0schi,

    Please add the following to functions.php:

    add_filter( 'avf_form_from', 'enfold_customization_contact_form_etc', 10, 3 );
    function enfold_customization_contact_form_etc( $from, $p1, $p2 ) {
    	global $enfold_custom_reply_header;
    	$enfold_custom_reply_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_reply_header;
    	$header .= 'Reply-To: ' . $enfold_custom_reply_header . '\r\n';
    	return $header;
    }

    Best regards,
    Jordan Shannon

    #1082749

    Hey Jordan, thanks, but that did not work. It still replys to the mail adress that i had set up in wp mail smtp, but not the one the user entered.
    any other suggestions? if not i would have to do this with cf 7, which is way harder to do for my customer :(

    Kind regards
    joschi

    • This reply was modified 5 years, 9 months ago by j0schi.
    #1084804

    Hi,
    Sorry for the late reply, please try using these two functions in your functions.php, it adds the visitor email as the reply-to address:

    //have the visitor address in the Reply-To: header instead of the From: header
    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;
    }

    As I recall you need to use both of these together, so in the top one please edit your “from” address, but you could first try testing just the bottom one as it adds the “reply-to” address.

    Best regards,
    Mike

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