-
AuthorPosts
-
January 16, 2019 at 3:25 pm #1054567
Hi,
we use the contact form for several forms.
But we have a “spf-Filter” and so we need to set the “from” to a special email-adress.
But the from is the email adress that the user enters in the form. Where can I change this?
We have this problem since the last update from enfold.
Thank’s for help
NAdjaJanuary 18, 2019 at 10:36 am #1055388Noone the same problem?
We have the problem since the update in december.
NadjaJanuary 19, 2019 at 6:04 pm #1055920Hi,
Sorry for the late reply, I’m not sure what you mean by “spf-filter”
but if you are using SMTP often you need to set the “from” address for your email server, if that is what you mean, then Try adding this code to the end of your functions.php file in Appearance > Editor:// set contact form "from" address to SMTP domain to receive emails // AND allow vistor address to be in the "to" address in the autoresponder add_filter('avf_form_from', 'avf_form_from_mod', 10, 3); function avf_form_from_mod($from, $new_post, $form_params) { global $enfold_custom_from_header; $enfold_custom_from_header = $from; $from = " (Email address hidden if logged out) "; return $from; } add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 10, 3); function avf_form_autoresponder_from_mod($from, $new_post, $form_params) { global $enfold_custom_from_header; return $enfold_custom_from_header; }
please be sure to change the address ” (Email address hidden if logged out) ” in the code.
Or if you just want to change the “from” address:
// change from address add_filter('avf_form_from', 'avf_form_from_mod', 10, 3); function avf_form_from_mod($from, $new_post, $form_params) { $from = " (Email address hidden if logged out) "; return $from; }
If you need to add a “reply to” address so it won’t be marked as spam:
// add reply-to in mail header add_filter( 'avf_form_from', 'enfold_customization_contact_form_etc', 10, 3 ); function enfold_customization_contact_form_etc( $from, $p1, $p2 ) { global $enfold_custom_from_header; $enfold_custom_from_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_from_header; $header .= 'Reply-To: ' . $enfold_custom_from_header . '\r\n'; return $header; }
Please don’t use all of these, only one at a time until you find the one that is working for you.
Best regards,
MikeJanuary 20, 2019 at 12:02 pm #1056141The spf-filter is a filter for spam.
And we tried the smtp-plugin but it doesn’t work. We don’t know why (perhaps it is a problem from the provider).
So we have to change the “from” in the email.
NadjaJanuary 20, 2019 at 4:40 pm #1056179Hi,
Thanks for the feedback, please try the solutions posted above, one should work for you, I believe it would be the second one, but if not then remove it and try the first one.Best regards,
MikeJanuary 21, 2019 at 8:53 am #1056487I will try it.
Thank you
NadjaJanuary 21, 2019 at 12:12 pm #1056549Hi Nadja,
Thanks for the feedback. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardJanuary 28, 2019 at 12:36 pm #1059596This is really strange…
I added this to my function.phpadd_filter('avf_form_from', 'avf_form_from_mod', 10, 3); function avf_form_from_mod($from, $new_post, $form_params) { $from = " ( (Email address hidden if logged out) ) "; return $from; }
If I send the form, I get the reply email and on the website I get the “Thank you”-Site.
But the email do not arrive on the server the form is sent. ( I hope you understand what I mean).Nadja
January 29, 2019 at 3:26 am #1059870Hi,
Please include a admin login in the Private Content area, so we can be of more assistance.Best regards,
MikeJanuary 29, 2019 at 12:23 pm #1059962Here you are.
Thank you for your help.
NadjaJanuary 31, 2019 at 4:04 am #1060691Hi,
Thank you for the login, but I didn’t see a contact form on any of the pages to test, which page is it on?
Did you see this error in your Forms setting?
If fixing the error doesn’t solve, please install WP Mail Logging plugin, for us, it helps with finding errors when we send test messages though your site.Best regards,
MikeJanuary 31, 2019 at 8:45 am #1060826We do not use this email-plugin. We are using the form-element from enfold.
You can find it for example here:January 31, 2019 at 10:32 am #1060856It is really strange.
If I use the standard form element the emails arrive.
But if I set the from// change from address add_filter('avf_form_from', 'avf_form_from_mod', 10, 3); function avf_form_from_mod($from, $new_post, $form_params) { $from = " ( (Email address hidden if logged out) ) "; return $from; }
I get my autoresponder email but the real email do not arrive. It seems that it is blocked from the provider (we cannot find it in spam or log).
Have you any idea?
Thank you
NadjaJanuary 31, 2019 at 12:55 pm #1060941Hi,
Your provider could be marking it as spam at the server level because it’s coming from a different domain than the email is.
It is common for the email filter to trash it before it gets to your inbox.
Is your email server the address in the functions.php?
did you try this function?// set contact form "from" address to SMTP domain to receive emails // AND allow vistor address to be in the "to" address in the autoresponder add_filter('avf_form_from', 'avf_form_from_mod', 10, 3); function avf_form_from_mod($from, $new_post, $form_params) { global $enfold_custom_from_header; $enfold_custom_from_header = $from; $from = " (Email address hidden if logged out) "; return $from; } add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 10, 3); function avf_form_autoresponder_from_mod($from, $new_post, $form_params) { global $enfold_custom_from_header; return $enfold_custom_from_header; }
Best regards,
MikeJanuary 31, 2019 at 4:52 pm #1061054I will try it.
Thank you.
NadjaFebruary 1, 2019 at 1:03 am #1061317Hi,
I believe that when the form sends the email to your inbox your spam filter sees what the domain of the site is, but the different “from” domain that you are adding is triggering the spam filter, which trashes it before the spam folder.
Please try making the “from” address the same as the site domain and your inbox, to confirm that you site is sending the message and your inbox will receive it.Best regards,
MikeFebruary 5, 2019 at 10:15 am #1063086Hi I signed up for this problem too. This is unfortunately a developers mistake since the internet is there. In the past I was responsible for a large marketing system and we worked together with Barracuda Anti Spam so I have my experience on this area.
The receiver (the website owner / backend employee) should NEVER receive the emails through the email address of the website visitor but through a correct internal email (from the website owner’s owned email domain). This is bad programming, so please change this. Thank you.
- This reply was modified 5 years, 9 months ago by avdprojects.
February 5, 2019 at 11:43 pm #1063408Hi,
@avdprojects to change the from address of your email, use this code to the end of your functions.php file in Appearance > Editor:add_filter('avf_form_from', 'avf_form_from_mod', 10, 3); function avf_form_from_mod($from, $new_post, $form_params) { global $enfold_custom_from_header; $enfold_custom_from_header = $from; $from = " (Email address hidden if logged out) "; return $from; } add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 10, 3); function avf_form_autoresponder_from_mod($from, $new_post, $form_params) { global $enfold_custom_from_header; return $enfold_custom_from_header; }
please change the ” (Email address hidden if logged out) ” to your email address.
Best regards,
MikeFebruary 6, 2019 at 8:37 am #1063515@Mike, Thank you for your reply, I will implement your advice. But still I think the current method to handle SMTP protocol is wrong and should be changed in the core of the Enfold theme. Furthermore I some Enfold users who are not developers and never understand this whole topic.
I could not find a good example and the moment, but this page shows that how it works at the moment in Enfold is wrong:
https://help.dreamhost.com/hc/en-us/articles/214831378-Troubleshooting-WordPress-contact-formsPlease ask the product owner to put it on a urgent to fix list ;-)
February 7, 2019 at 11:30 pm #1064346Hi,
Thank you for your feedback and the article about the requirements of Dreamhost, but we try to accommodate what our users have requested the most for this function over the years, as our users use many different webhosts, each with different requirements.
We are always happy to assist each user with their own and their hosts requirements.Best regards,
MikeFebruary 12, 2019 at 3:14 pm #1065960We are using the following modified version of the functions to have the visitor address in the Reply-To: header instead of the From: header. (Auto-reply is not configured, so no changes there).
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; }
Please mind that the “\r\n” has to be in double-quotes not in single-quotes!
This works for us. However, I would suggest adding a “use Reply-To: instead of From: header for visitor address” option to the contact form settings.February 13, 2019 at 3:24 am #1066184Hi,
@rsplaul thank you for sharing, I’m sure this will be quite helpful to some.Best regards,
MikeFebruary 21, 2019 at 4:14 pm #1069986Sorry for my late response. Finally I could test the example provided by @rsplaul and thats works! So Thanks for this ;)
Also this is the solution what I prefer and tried to explain earlier. The From address in a raw email body should always be an address of a mail domain managed by yourself. No matter what is possible and yes actually all parameters in a raw email body can be used differently but we should not do it!
The current method what Enfold implemented is coming out the period from before Google where we trust the internet and their users. But in the meantime everything is changed and must be very strict and this counts for the mime FROM-ADDRESS in a email body too. So I really hope the Enfold team will take this solution over and maybe make the “info@<domain>” coming from a setting what can be set through the “Contact Form” settings.
The solution of @rsplaul is what I have to implement now for more clients and I hope a future update will not overwrite it :-/
Best regards,
avdprojectsFebruary 26, 2019 at 1:26 am #1071578Hi,
The solution of @rsplaul is what I have to implement now for more clients and I hope a future update will not overwrite it
Do you have a child theme? You should put that filter in the child theme’s functions.php file to keep it from being overwritten during updates.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.