Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How and with what speed should emails be sent?
I'm trying to organize mailing of letters (not spam) to users. For each recipient, an original letter is generated (such as a special offer). How I did: I
collected an array
[["email", "ФИО", "данные"],
["email", "ФИО", "данные"]
...
]
$mail = new PHPMailer\PHPMailer\PHPMailer();
try {
$mail->isSMTP();
$mail->CharSet = "UTF-8";
...
$t = microtime(1);e(microtime(1) - $t);
Answer the question
In order to leave comments, you need to log in
Please tell me what am I doing wrong?
If you send via an external SMTP server (via yandex or mail.ru, for example), you won’t be able to speed up much (firstly, a remote connection, and secondly, mailers can limit the speed of receiving letters). It is possible to try to save on a connection/authorization in this case. To do this, don't create a new PHPMailer instance for each email, just change the Body/Subject/To/etc. and do send() - it should use one connection.
You can send faster if you use local SMTP (like Postfix on Linux). It can be configured to send both through an external relay (yandex, etc.) and directly (this case requires configuration, otherwise the letters will not reach or fall into spam).
In reality, all this will not be sent much faster (because postfix will queue messages and send them in the background), but at least your script will work out much faster.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question