Tagged: mailform
-
AuthorPosts
-
September 27, 2018 at 10:45 am #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: blablablaIn 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 okayBecause 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.phpIs this possible?
Thank you!
September 27, 2018 at 11:20 am #1015223Hey 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,
PeterSeptember 27, 2018 at 12:12 pm #1015255Hallo 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
September 27, 2018 at 12:40 pm #1015264Hi,
Yes! You can simply insert it at the very bottom of the functions.php.
Best regards,
Peter -
AuthorPosts
- You must be logged in to reply to this topic.