Answer the question
In order to leave comments, you need to log in
How not to wait for an email to be sent in PHP?
I'm using PHPMailer and it hangs when sending email. The mail server thinks for a long time and as a result PHP falls off on a timeout.
Don't want to fork. Maybe someone knows how it can be handled by means of PHPMailer itself?
Tried setting the "Timeout" property, didn't help.
Answer the question
In order to leave comments, you need to log in
you need to have a sendmail daemon ( qmail ) on the server. It will process the queue. php.net/manual/en/function.mail.php look on the 'queue' page, there are a few ideas there.
Maybe do something like a task scheduler, which adds sending a letter with everything you need, and it runs separately from the script for some period of time.
Instead of sending, write an email to a json/xml file or database. And run the script that poisons the letter using the cron. If the letter is sent, delete/move the file/record.
It is also very beautifully solved by asynchronous tasks in Gearman.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question