PHPMailer 中的持久 SMTP 连接

发布于 2024-08-23 03:02:01 字数 75 浏览 8 评论 0原文

如何在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

悲念泪 2024-08-30 03:02:01

我们真的不在乎您的服务器是否被列入黑名单,对吗?这就是如何实现你想要的。只需将 SMTPKeepAlive 属性设置为 true,并在批量发送后隐式调用 SmtpClose() 方法。

$phpMailer = New PHPMailer();
$phpMailer->isSMTP();
$phpMailer->SMTPKeepAlive = true;

for ( ... ) {
    // Send your emails right away
    [ ... ]
}

$phpMailer->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 the SMTPKeepAlive property and after the bulk sending, call implicitly the SmtpClose() method.

$phpMailer = New PHPMailer();
$phpMailer->isSMTP();
$phpMailer->SMTPKeepAlive = true;

for ( ... ) {
    // Send your emails right away
    [ ... ]
}

$phpMailer->SmtpClose();
素年丶 2024-08-30 03:02:01

通过优化电子邮件的发送,您可能会被认为是垃圾邮件发送者,从而导致网络服务器阻止您的 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.

谎言月老 2024-08-30 03:02:01

持久 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.

感受沵的脚步 2024-08-30 03:02:01

当您批量发送并希望更快地发送时,持久 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文