Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1420253

    Dear team,
    I use on my page below a contact from and would like to re-confirm the senders his/her field entries via an autoresponder mail. But I did not find a way to do this.

    How can I realize this?

    thx a lot & best regards

    Tilman

    • This topic was modified 1 year, 2 months ago by oestersund.
    #1420266

    Hey Tilman,

    Thank you for the inquiry.

    You might be able to use the avf_contact_form_autoresponder_mail filter to adjust the autoresponder content and include the field entries to the message.

    Example:

    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
         $mail_array["Message"] = "Hello " . $new_post["1_1"] . " " . $new_post["2_1"] . "!\n" . $mail_array["Message"];
    
         return $mail_array;
    }, 10, 4);
    

    The filter above prepends an extra line to the actual autoresponder message saying “Hello” plus the value of the first and second field.

    Best regards,
    Ismael

    #1420272

    Hi Ismael,
    thx , i will be hay to try this. Just to get it right:

    -> What do I ned to add where?

    – Functions PHP
    – Custom CSS
    – Autoresponder text / backend specs

    Best regards, Tilman

    #1420364

    Hi,

    Thank you for the update.

    You have to add the filter in the child theme’s functions.php file. The $new_post variable is an array that contains the value of the input fields sent by the user.

    Best regards,
    Ismael

    #1420931

    Hi Ismael,
    thx. I’ve copied the a.m. code in the functions.php.

    The $new_post variable is an array that contains the value of the input fields sent by the user.
    ->Would you mind to give me a syntax example how to add some fields in the backend in a correct way? This would be super cool and helpful

    The autoresponder mail shall include all field entries and some plain text (not personalized)
    sent from (Email address hidden if logged out)

    thx a lot & best regards

    Tilman

    #1421059

    Hi,

    >Would you mind to give me a syntax example how to add some fields in the backend in a correct way? This would be super cool and helpful

    For the contact form in the “kalender-2024” page, the $new_post variable will contain the following values.

    $new_post["1_1"] = Vorname
    $new_post["2_1"] = Nachname
    $new_post["3_1"] = ggf. Firma
    $new_post["4_1"] = ggf. Tel. (für Rückfragen)
    $new_post["5_1"] = E-Mail
    

    .. and so on an so forth.

    So, if you want to display the values of the Vorname and the Nachname field in the autoresponsder message, the filter will look something like the following.

    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
         $mail_array["Message"] = "Hello " . $new_post["1_1"] . " " . $new_post["2_1"] . "!\n" . $mail_array["Message"];
    
         return $mail_array;
    }, 10, 4);
    

    This will render the following result.

    Hello [Vorname] [Nachname] !
    
    // autoresponsder message here
    

    Best regards,
    Ismael

    #1421406

    thx a lot Ismael,
    as I am not a PHP expert, I am not 100% there. re. Syntax as well as re.” Where to add which code”

    My functions PHP reads now as follows:
    add_filter(“avf_contact_form_autoresponder_mail”, function($mail_array, $new_post, $form_params, $class) {
    $mail_array[“Message”] = “Hallo und guten Tag ” . $new_post[“1_1″] . ” ” . $new_post[“2_1”] . “!\n” . $mail_array[“Message”];

    return $mail_array;
    }, 10, 4);

    On my page below you find the draft contact form at the very end (pls scroll down to the bottom)

    The autoresponder mail looks like here: https://imgur.com/a/9IEcWOf
    My backend entries look this way: https://imgur.com/wPS4XOc

    -> How / where Do I need to enter the first 3 entry fields “Herr/Frau” Vorname” “Nachname” in a way that they appear after the “Hello…” at the beginning of the return mail?

    thank you very much in advance & best regards, Tilman

    #1421439

    Hi,

    How / where Do I need to enter the first 3 entry fields “Herr/Frau” Vorname” “Nachname” in a way that they appear after the “Hello…” at the beginning of the return mail?

    Please replace the filter with the following code.

    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
         $mail_array["Message"] = "Hello Herr/Frau " . $new_post["1_1"] . " " . $new_post["2_1"] . "!\n" . $mail_array["Message"];
    
         return $mail_array;
    }, 10, 4);
    

    Best regards,
    Ismael

    #1421461

    Hi Ismael,
    thx a lot, so far it works. 2 remaining questions (pls see screenshots)

    1. How do I force a line break after “Guten Tag name” and message body (see mail screenshot)?
    2. How can I reduce line spacing of my address info at the mail end (see backend entry in screenshot)

    Best regards, Tilman

    #1421472

    Hi,

    Thank you for the update.

    1.) We can’t find the “Guten Tag name” part in the screenshot. Could you elaborate a bit?

    2.) You can try adding an inline style to the autoresponder message to adjust the line height.

    
    <div style="line-height: 1em;">Your message and other content here</div>
    

    Best regards,
    Ismael

    #1421475

    Hi Ismael,
    at the very top of the second pic you see it (hopefull).

    The mails reads as follows:

    Guten Tag Herr Strunk! vielen Dank für Ihre Reservierungsbestellung für den Wandkalender “Norddeutschlands Farben”, mit der Sie sich Ihr(e) Exemplar(e) gesichert haben. Hier kommt die Zusammenfassung Ihrer Eingaben im Bestellformular:

    __________________________________________________________

    Ihre Nachricht:

    Anrede:: Herr
    Vorname:: Heinz
    Nachname: Strunk
    ggf. Firma:: INferno
    ggf. Tel. (für Rückfragen):: 0123
    E-Mail:: (Email address hidden if logged out)
    Straße, Nr.: street 23
    PLZ, Stadt:: 21465 Reinbek
    Anzahl:: 2
    Ich bestelle als:: Unternehmen
    Versand oder Abholung:: Versand

    ggf. Nachricht oder Frage (z.B. zu Lieferung oder zu Preisanfragen ab 5 Stk.)::
    Was beste Preis?

    Ich stimme den AGB und Datenschutzbestimmungen zu.: true

    __________________________________________________________

    Sobald die Kalender geliefert werden, erhalten Sie weiteren Infos zur Abholung bzw. zum Versand.

    Herzliche Grüße, Ihr Tilman Möller

    Zielfoto Hamburg / Tilman Möller

    Hofriedeallee 1, 21521 Aumühle

    Tel.: +49 (0) 04104 / 699 66 96

    http://www.zielfoto-hamburg.de

    #1421607

    Hi,

    Thank you for the info.

    Have you tried adding a line break or a br tag before the ” vielen Dank für Ihre” part?

    < br > < br >vielen Dank für Ihre ... 
    

    // https://www.w3schools.com/tags/tag_br.asp

    You can also create an invisible container before the paragraph.

    
    <div class="av-email-line-break" style="height: 1em; width: 100%; clear: both;"></div>
    vielen Dank für Ihre ...
    

    Best regards,
    Ismael

    #1421618

    thx a lot Ismael,
    <br>< does work, the “em” code / <div style=”line-height: 1em;”>Your message and other content here</div> / did not really work. But it’s fine for me, I can use the responder now properly

    Cheers, Tilman

    #1421757

    Hi,
    Glad Ismael could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘contact form autoresponder with field entries’ is closed to new replies.