简体   繁体   English

Cron + PHPMailer Email 队列

[英]Cron + PHPMailer Email Queue

I have a doubt, I am thinking of making an email queue and using cron job for this task, but on my website there is an email verification system, I wanted these verification emails to be delivered as quickly as possible, as I could make work?我有一个疑问,我正在考虑制作一个 email 队列并使用 cron 作业来完成这项任务,但是在我的网站上有一个 email 验证系统,我希望尽快发送这些验证电子邮件,因为我可以工作? I don't need a code, just an opinion我不需要代码,只是一个意见

Don't do it.不要这样做。 There are these really clever things that do an excellent job of queueing and delivering email messages, handling rejections, throttling, temporary outages, and lots more, and they are way, way faster than anything you'll write in PHP.这些非常聪明的东西在排队和传递 email 消息、处理拒绝、节流、临时中断等等方面做得非常出色,而且它们比你在 PHP 中编写的任何东西都要快得多。 They are called "mail servers".它们被称为“邮件服务器”。

Install a local mail server (eg postfix), then send into that directly from your PHP scripts (using SMTP to localhost, as it's faster and safer than using mail() ).安装本地邮件服务器(例如 postfix),然后直接从您的 PHP 脚本发送到该服务器(使用 SMTP 到 localhost,因为它比使用mail()更快更安全)。 Your scripts will run very fast, and the mail server will deal with onward delivery.您的脚本将运行得非常快,并且邮件服务器将处理转发。 Beyond that, read the PHPMailer docs on improving delivery .除此之外,请阅读有关改进交付的 PHPMailer 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM