Answer the question
In order to leave comments, you need to log in
What is the best way to send notifications from php?
What is the best way to send letters: via mail() or external smtp (google/yandex)?
Notifications will be quite a lot. Probably every minute or more.
Answer the question
In order to leave comments, you need to log in
mail(). The function will kick sendmail, which will simply queue the message for later processing by a daemon (sendmail, qmail, postfix, you name it) and quickly return control to the application. And setting up an SMTP connection with a remote host like Yandex and Google is a rather slow operation, as practice shows.
Through external it’s good, but you can run into a limit on the number of outgoing messages per unit of time (in particular, Google has it). It is better to use your mail server (if any). However, in this scenario, you can get into the spam list, with such and such a frequency.
Make a notification pool, and a separate script that sorts and sends messages from the pool. So for sure nothing will be lost and there will be no slowness)
the hoster also suggested that it is better to use mail (). if there really is such a big queue, I will make a pool
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question