Hi guys, I've created a PHP form for my website and have added an email response to it to be sent to the user once they've submitted their details. What I'd like to do is add in a delay of some sort so that the user doesn't immediately receive the email. I'd like to pretend that it's a real person emailing them back instead of them receiving an email 2 seconds after clicking the submit button. Any ideas how I'd do that? Many thanks
1) Store the email request on a database or a file based on timestamp. 2) Create a cronjob/scheduled task to pick up all requests older than X minutes and process/email them.
But really... why? When I post an email asking for something, it be support, quotes, ordering items etc., I'm happy if I get a reply ASAP. The only things I can understand can be beneficial for something like this, are automated responses to prefilled questionaires etc. or tech support question based on a bunch of select statements in the form. But then, why would they need to be duped by a delayed response. I hardly see the benefit, apart from fooling people into believing there's a person answering their emails, which I don't really see the point of doing.
You could use the PHP sleep() function to accomplish this but the page would be sitting there loading before it finally finishes and reaches the end point, assuming your clients have enough patience to wait for this when they check their e-mails and see they received the e-mail right after the page finished loading it kind of kills the effect. If you really want to accomplish this useless task I would say either write the information submitted to a file or have it e-mailed to you and then e-mail them yourselves. Even a two minute delay (which I would say is the absolute most a person would wait for a page to finish loading) is going to have them thinking that it was a script that accomplished the sending of the e-mail and not a person.