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

    When I receive an email in my mailbox (Thunderbird), send from my build in contactform, then I see this in my Inbox message tab in Thunderbird:

    (Email address hidden if logged out) < (Email address hidden if logged out) >
    subject: blablabla

    In other words: I do not see the Name of the sender. But I do have a name field in my form! Please see https://www.fotoloek.nl/contact/

    In the email itself everything is okay like this:
    Name: Example
    E-Mail: (Email address hidden if logged out)
    Subject: blablabla
    Message: mesage text is okay

    Because I want to see the subject from the sender in my mail client and not something like “subject=send from your mailform” I have added this code to my function.php file:

    add_filter(‘avf_form_subject’,’avia_change_mail_subject’, 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params) {
    $subject = urldecode($new_post[‘3_1’]);
    return $subject;
    }

    I don’t know if this code is causing the issue with the Name field? Anyway; how can I set up the form like this:
    – I want to see the name ocf the sender in the message field of my mail client and not (Email address hidden if logged out) < (Email address hidden if logged out) >
    – I still want to see the subject in my mail client (like it is now thanks to the code in functions.php

    Is this possible?

    Thank you!

    #1015223

    Hey Alwin,

    Please try to add this code to your child theme to show the name of the sender:

    
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
        $email = $from;
        $name = urldecode($new_post['1_1']);
        if($name) $from = $name . " <$email>";
        return $from;
    } 
    

    Best regards,
    Peter

    #1015255

    Hallo Peter,

    Thank you for your help.

    I have to place this code in my functions.php in my child theme, correct?
    Can I use this together with the code I already placed in functions.php?

    Alwin

    #1015264

    Hi,

    Yes! You can simply insert it at the very bottom of the functions.php.

    Best regards,
    Peter

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.