PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Auto Response Delay

  1. Alex
    Member

    I was wondering if there was a way of delaying the auto responder function within notification settings? Would be great as I have a client who wants to portray that all emails are read within the hour.

    Thanks

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  2. There is no way within the notification settings. Gravity Forms hands off the mail to wp_mail() immediately and it's sent out by the server immediately. You might be able to find a plugin which delays wp_mail() - I found this one but it looks pretty old http://wordpress.org/extend/plugins/wp-delayed-mail/

    I'm not sure of another way to do it.

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  3. Alex
    Member

    thanks for the quick response. will take a look and if i find a solution i'll come back in here and share :)

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  4. Please do. I am thinking about a way to catch and queue the notification, or not send notifications and then programmatically resend them with WP Cron or similar.

    Posted 12 years ago on Monday October 8, 2012 | Permalink
  5. Just to say I also needed this functionality as I have used Gravity Forms as part of a booking system that captured the booking request then sent the user off-site to pay via RealEx. I only wanted the notifications to be triggered once the payment had been authorised even though the Gravity Form completed before sending the visitor to the payment gateway.

    Basically I got around it by doing the following:

    1) Created a separate table in the DB to store email notifications (but could be stored against the entry if required)

    2) Using the GF hook: "gform_entry_created" I added the entry ID to the global $_POST array for retrieval later then added a new filter on wp_mail that captured the variables sent to wp_mail, stored them in the new database table (serialized) against the entry ID (fetched from $_POST) - 1 record created per notification email, and then blanked the array variables that are returned to wp_mail to stop it sending the emails.

    3) Using the GF hook "gform_after_submission" I removed the filter from wp_mail so that it does not affect future emails sent out

    4) When the gateway sent its response back to my site I grabbed all the stored emails for the particular entry ID from my BD table and manually called wp_mail() passing the variables - this was done in a loop as there were two notifications, Admin and User.

    This worked like a charm for me but I did not need to manipulate the email notification at all so it was quite easy.

    If you need example code then let me know.

    MJ

    Posted 12 years ago on Friday November 23, 2012 | Permalink
  6. Thanks for posting your solution MJ. Please do post the code at pastebin.com or pastie.org so we can point people to your solution.

    Posted 12 years ago on Monday November 26, 2012 | Permalink
  7. No problem - I have stripped it out to the basics and commented where I feel applicable. You can find the code at: http://pastebin.com/1ZaJkVY4

    Note - this can just be pasted into your functions file but I have used a custom database table (I have added the code to create the table if it doesn't exist already).

    Hope it helps others.

    MJ

    Posted 12 years ago on Monday November 26, 2012 | Permalink
  8. Thank you MJ.

    Posted 12 years ago on Tuesday November 27, 2012 | Permalink