K
K
kirchevsky2013-04-16 10:49:54
PHP
kirchevsky, 2013-04-16 10:49:54

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

7 answer(s)
K
kirchevsky, 2013-04-16
@kirchevsky

Maybe it's better to try Gearman ? Interested rather cons of such a solution.

U
uadeveloper, 2013-04-16
@uadeveloper

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.

M
Max, 2013-04-16
@7workers

do ignore_user_abort() and send email after content sent / client aborted.

M
mayorovp, 2013-04-16
@mayorovp

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.

A
ajaxtelamonid, 2013-04-16
@ajaxtelamonid

Cron per minute, tables with queues of letters.

K
Kirill Boldyrev, 2013-04-16
@usetester

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.

K
kirchevsky, 2013-04-16
@kirchevsky

And here is an approximate solution to my problem, as I understand it ... link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question