Answer the question
In order to leave comments, you need to log in
How would you send mail in the background?
What is the best way to send mail to background.
There is a form, some action takes place on the form, the result of which should be sending a letter to the user.
Taking into account the connection to the mail server, this causes some delay in responding to the form submission, what is the best way to respond to form changes instantly, and send the letter in parallel, so to speak.
Thanks in advance for your replies.
Answer the question
In order to leave comments, you need to log in
Maybe it's better to try Gearman ? Interested rather cons of such a solution.
I have a mail daemon written in php on my server, there are five tables in the database (in order of importance). When I need to send a letter, I put it in a certain table, depending on the urgency. The demon picks up letters, sends them.
do ignore_user_abort() and send email after content sent / client aborted.
Send a letter to the local MTA on the same server, and he himself will transfer further.
If you disable strict RFC compliance, then local submission should be very fast.
If php-fpm is used and there is no need for complex queue logic, you can use the fastcgi_finish_request () function. The function call forces the response to be sent to the client, and the script continues executing in the background.
And here is an approximate solution to my problem, as I understand it ... link
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question