Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1321390

    Hi I am trying to add Dear ‘name’ to the contact form autoresponder email.

    I tried this code but it doesn’t work. Can you help?

    function modify_autorespondermessage_func($message) {
    $new_message = “Dear “.$_POST[‘Your First Name’].”<br><br>”;
    $new_message .= $message;

    return $new_message;
    }
    add_filter(‘avf_form_autorespondermessage’, ‘modify_autorespondermessage_func’, 10, 1);

    #1321643

    Hey JennyGr,

    Thank you for the inquiry.

    Try to use the new filter avf_contact_form_autoresponder_mail to adjust the email message.

    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
         $new_message = "Dear ".$new_post["2_1"]."<br><br>";
         $new_message .= $mail_array["Message"];
    
         $mail_array["Message"] = $new_message;
    
         return $mail_array;
    }, 10, 4);
    

    The $new_post[“2_1”] should contain the value of the “Your First Name *” field.

    Best regards,
    Ismael

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