PHPMailer 中的持久 SMTP 连接
如何在 PHPMailer 中启用持久 SMTP 连接?
我会发送很多电子邮件,因此通过持久连接,我可能会获得性能提升。
How to enable persistent SMTP connections in PHPMailer?
I will send many emails, so with persistent connections probably I will get performance gain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我们真的不在乎您的服务器是否被列入黑名单,对吗?这就是如何实现你想要的。只需将
SMTPKeepAlive
属性设置为true
,并在批量发送后隐式调用SmtpClose()
方法。We really don't care here if your server gets blacklisted, right? This is how to achieve what you want. Just set to
true
theSMTPKeepAlive
property and after the bulk sending, call implicitly theSmtpClose()
method.通过优化电子邮件的发送,您可能会被认为是垃圾邮件发送者,从而导致网络服务器阻止您的 IP。
您要发送多少封电子邮件?实际限制发送的电子邮件可能比加快速度更好。
By optimising the sending of emails, you might open yourself up as being identified as spamming and so cause web servers to block your IP.
How many emails are you sending? It may be better to actually throttle emails sent rather than speed up.
持久 SMTP 连接是什么意思?
首先如果您发送电子邮件,您将连接到服务器,直到它完成作业。
其次如果您想发送很多电子邮件(可能您的服务器将在黑名单中),
您在 PHP 代码中编写一个循环,它获取所有电子邮件地址并将它们传递给 phpmailer,最后发送它们。
这就是我发送群发邮件的方式。
What do you mean by persistent SMTP connection?
First if you send a Email you are connected to the Server until it finishes the job.
Secondly if you wanna send many emails (Probably your server will be in the blacklist),
you write a loop in your PHP code, whitch fetches all Email adresses and passes them to the phpmailer and finaly sendts them.
Thats how i would send mass mails.
当您批量发送并希望更快地发送时,持久 SMTP 连接适合,为了加快发送速度,在特定数量的电子邮件发送期间保持 SMTP 连接处于活动状态是一个好主意。在循环内频繁交替 SMTP 连接可以是在 IP 预热会话期间更加受控发送的方法。
https://www.mumara.com/persistent-smtp-连接和非持久循环/
Persistent SMTP connection is suitable when you are sending bulk and want to send faster, keeping the SMTP connection alive for specific number of email sends is the good idea, for faster sending. Frequently alternating SMTP connection within the loop can be the way for more controlled sending during IP warming sessions.
https://www.mumara.com/persistent-smtp-connection-and-non-persistent-loop/