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.
An exception to this is in a language with concurrency. In Golang I might create a new function and start a new goroutine (sort of like a thread) when the server starts. This threaded function would then check for emails to be sent that were either stored in as shared variables memory (not possible in PHP) or read from a db, then sleep for x amount of time. This would ensure that only one process is running to do this action, not many.