Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #966486

    Hi!
    I’ve customized the “from” email to be used in the contact form using the following function (from a post):

    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;
    }

    Now the mail is sent correctly from the desired account but, the auto-reply is not sent to the user’s email. Before doing this change, it did correctly (but from the undesired account).

    What am I doing incorreclty?

    Many thanks in advance for your support!

    Cheers,
    Carlos.

    #966883

    Hey TEZ-CV,

    Please take a look at the post here

    That would help you get things fixed

    Best regards,
    Basilis

    #967124

    Hi, Basilis.
    Thanks for your support, but unfortunately I’ve not been able to solve the issue yet.
    Suppose I didn’t explain it correctly. Let me try again…
    I don’t want to include the “reply-to” field in the mail header.
    I want to send a reply to the user automatically wich can be done by placing the text in the auto-response field of the contact form editor.
    It works ok if I don’t change the “from” email address, i.e, whitout adding any php function. But in that case, the address used to sent the mails is not valid for us. But when I add the php code to change the “from” address, the auto-response is not sent.
    Here is the code I’ve added:

    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;
    }

    Hope now the question is a bit clearer..
    Many thanks in advance.
    Carlos.

    #969810

    Hi,

    I am not sure about it, I did asked team mates to help if they have any knowledge on that.

    Best regards,
    Basilis

    #969923

    Hi,
    When I test the above function with the autoresponder on I find that it is sending the autoresponder email, but the “to” address is the one in the function instead of the from field address of the visitor. The emails are probably going to your spam folder.
    I found a way around it by editing your \wp-content\themes\enfold\framework\php\class-form-generator.php file if you would like to try.
    Go to line 862, above:

    			$from = urldecode( $from );
    			$from = apply_filters("avf_form_from", $from, $new_post, $this->form_params);

    and add:

    $from1 = " (Email address hidden if logged out) ";

    then go to line 925 and change:

    					$header .= 'From: '. $from . " <".$from."> \r\n";
    					wp_mail($send_to_mail, $subject, $message, $header);
    				}
    				else
    				{
    					$header .= 'From:'. $from . " \r\n";
    					mail($send_to_mail, $subject, $message, $header);

    to:

    					$header .= 'From: '. $from1 . " <".$from1."> \r\n";
    					wp_mail($send_to_mail, $subject, $message, $header);
    				}
    				else
    				{
    					$header .= 'From:'. $from1 . " \r\n";
    					mail($send_to_mail, $subject, $message, $header);

    Best regards,
    Mike

    #969976

    Thank you very much, Mike.
    I’ll try it in few hours/days and give you feedback.
    Only one question… (I’m a bit newbie in WordPress etc.) Will this modification be overwritten with the Enfold updates? In this case, how could be the work-around to do it in my child-theme?
    Many thanks for your suuport, and kindest regards,
    Carlos.

    #970054

    Hi,
    To apply this to your child theme, copy the \wp-content\themes\enfold\framework\php\class-form-generator.php file to your child theme folder, then make the edits above, and find following line at the top file:

    
    <?php  if (  ! defined( 'AVIA_FW' ) ) exit( 'No direct script access allowed' );

    and change it to

    
    <?php 

    then add following line to functions.php file of your child theme

    
    require( 'class-form-generator.php' );

    Best regards,
    Mike

    #970088

    Hi, Mike!
    It works perfectly!
    The only “problems” I see are that the new address is hard-coded in the function and on the other hand, overwritting the full function in the child theme is a little risky in case of important theme updates that affect to that function… But I know that my case is a little “special”, and have to assume this.
    Thank you very much for your support, and kindest regards.
    Carlos.

    #970108

    Hey!

    Awesome! Glad @Mike helped. When you have the time, please remove the modifications temporarily then use these filters instead.

    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;
    }
    

    Regards,
    Ismael

    #970201

    Don’t want to hijack the thread but I’m just wondering if this fix will go into the main theme? To me it looks like a bug that the $from in

    
    $from = apply_filters("avf_form_from", $from, $new_post, $this->form_params);
    

    is also used as the recipient address of the auto response mail.

    We run a online shop using Enfold and WooCommerce and relying on Mandrill (Mailchimp) to handle our email sending. They reject emails where we don’t have our domain as the sender address. Hence we rely on this work-around until there is another way.

    • This reply was modified 6 years, 5 months ago by martin_e83.
    #970242

    Hi,

    @TEZ-CV
    I have tested @Ismael filters and find they work no my test server, please try for yourself and let us know if it works for you.
    This will be a better solution than the edited file I posted.

    @martin_e83
    please try the filter above and let us know if it works for you, after we have some feedback we can post to the dev team for their review. I would also suggest requesting this feature on the Enfold feature request form so others can vote on this to demonstrate it’s popularity. This is where the dev team looks for new features and improvements.

    Best regards,
    Mike

    #970761

    Hi Mike,

    Thanks for the response! The fix works great for us. We have already implemented our own workaround, same as this but we have temporarily set the users email as a session variable, but your solution is a bit more clean.

    I would kindly ask you to handle it as a bug that modifying the sender email of the form breaks the auto response function. I see it as two separate things and would not reuse the variable in the auto response section of the code.

    I will consider adding a feature request to make it possible to set the sender email of all forms to a specified address. It’s an extremely boring feature, but necessary to a lot of people if one goes through years of support threads where emails not being sent or ending up in the spam filters (due to sender email set to something else than the websites domain). Currently the Request Feature button is not working for me though. Have tried both Chrome and FF and cleared my browser cache.

    Thanks!
    Martin

    #970808

    Hi,
    Thanks for the feedback, glad that it helped.
    We will forward this.

    Best regards,
    Mike

    #970955

    Hi!
    I see the weekend has been busy for you…. ;)
    I’ve tested @ismael filters and works perfectly in my case also.
    Certainly, it would be great if this could be done in the avia editor, simply adding a field for the address to be used to send the mails. Hope it can be added as a new feature.
    Thank you all very very much for your support.
    Kind regards,
    Carlos.

    #971941

    Hi,

    Thanks for the update. We’ll forward this to the dev team. :)

    Best regards,
    Ismael

    #1017450

    Hi,

    Ismael’s code works perfectly, I had the same problem.

    Only one annoying thing still a problem in my case:
    Sender in my incoming box is “Me” not the field email address or user email address. So if I pushing the reply button I’m sending reply to my self not for the user.

    Have any idea how to solve that?

    Thnks,
    Csaba.

    #1018118

    Hi,

    That is the disadvantage of using these filters. Your domain’s email address is use as the “from” address to tell your mail server that the source is trustworthy. Have you tried setting up a SMTP instead of using the filters? Please ask your hosting provider if they can set your mail server to accept third party email addresses with SMTP.

    Best regards,
    Ismael

    #1018205

    Hi Ismael,

    I have SMTP already setted up. But form mailing is didn’t works without your code. WP Mail SMTP can send the test mail successfully
    I’m using Zoho mail for company mailing and a VPS so I making every changes.

    Plus I wanna ask You, how to disable the “today” in the forms date picker?

    Thanks,
    Csaba.

    #1018216

    Datepicker problem solved. I found the solution on this link: Datepicker, only allow Dates in the Future

    #1018364

    Hi,
    Thank you for sharing your solution, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 20 posts - 1 through 20 (of 20 total)
  • The topic ‘Contact form not sending auto-reply emails’ is closed to new replies.