简体   繁体   English

使用PEAR :: Mail在php中发送批量邮件?

[英]Sending bulk mail using PEAR::Mail in php?

I am new to PEAR::Mail, and I am looking for a tutorial that can teach me how to send bulk mails(10K+ emails). 我是PEAR :: Mail的新手,我正在寻找一个可以教我如何发送批量邮件(超过10K电子邮件)的教程。 "Using mail() in php is not efficient, as its open and close the smtp sockets", this is what I read from internet sources (could not find link now, grrr). “在php中使用mail()效率不高,因为它打开和关闭了smtp套接字”,这就是我从互联网上看到的内容(grrr,现在找不到链接)。

Thus, I am thinking of doing it manually and using mail library that are available for PHP, and I found this PEAR:Mail. 因此,我正在考虑手动执行此操作,并使用可用于PHP的邮件库,因此找到了PEAR:Mail。 On the PEAR site itself, there is "Sending Multiple Recipients" simple tutorial, all recipients will be inserted into an array and then send. 在PEAR网站本身上,有一个“发送多个收件人”的简单教程,所有收件人都将插入一个数组中然后发送。 Is this the way of sending 10k++ emails? 这是发送10k ++电子邮件的方式吗? I remember something called "mail queue", but really dont how to use it in PEAR:Mail, can anyone help me? 我记得一个叫做“邮件队列”的东西,但是真的不怎么在PEAR:Mail中使用它,有人可以帮我吗?

I dont think Facebook will use for loop to send bulk emails (notifications) right? 我不认为Facebook将使用for循环发送批量电子邮件(通知),对吗? (well, this is what I thought) (嗯,这就是我的想法)

There's more to bulk email than which language you implement your sender in. As far as the library suggested by rich goes you would be looking at using an SMTP relay to queue and throttle your mails. 大量电子邮件比实现发件人所使用的语言要复杂得多。就Rich所建议的库而言,您可能正在考虑使用SMTP中继对邮件进行排队和限制。

As I discovered when I wrote the mass mailer for my company the major problem any bulk mailer faces is the speed at which mails can be punted out into the ether and how it manages retries for mails that have been graylisted or whatever. 正如我在为公司编写群发邮件程序时发现的那样任何群发邮件程序都面临的主要问题是将邮件打入以太网的速度以及它如何管理对已列入灰名单或其他内容的邮件的重试。

So number one you need a good solid SMTP server which can run the mailout job. 因此,排名第一的是您需要一台性能良好的SMTP服务器,该服务器可以运行mailout作业。 You will also want some way to throttle the service and monitor it. 您还将需要某种方式来限制服务并对其进行监视。 On a standard Windows Server running IIS and connected to a reasonably large pipe we can clear 5k mails every 15 minutes. 在运行IIS并连接到相当大的管道的标准Windows Server上,我们每15分钟可以清除5k邮件。 If you're looking to implement all that in 48 hours you're going to be pushed. 如果您希望在48小时内实现所有这些目标,那么您将被推崇。

The fact is there are hard limits to how fast you can push data and further artificial limits imposed by ISPs and so on and so forth. 事实是,您可以多快地推送数据有严格的限制,并且还有ISP等施加的其他人为限制。 This makes throttling, correct DNS records and the like absolutely vital if you don't want the job to run at snail's pace. 如果您不希望这项工作如蜗牛般步履蹒跚,那么进行节流,正确的DNS记录等绝对至关重要。 The minimum time I could push 10k mails out the door (and the mails are about 50kb in size so that gives you a further idea on throughput) is half an hour and we've got top of the line kit and a connection into a vast distribution pipe backing us up. 我可以将10k邮件推出门的最短时间(邮件的大小约为50kb,这样可以使您进一步了解吞吐量)是半小时,我们已经拥有最先进的工具包和大量连接配电管支持我们。

In the early days of our company when they used to mail the stuff out from our local broadband it took about 12-14 hours to send 7000 mails. 在我们公司成立之初,当他们用来从本地宽带中邮寄邮件时,大约要花12到14个小时才能发送7000封邮件。 So you've got to understand that physical resources are really important. 因此,您必须了解物理资源确实非常重要。

Also you will inevitably end up with a minimum of about 50 mails per 10k that just won't deliver first time out. 同样,您将不可避免地最终每10k至少收到约50封邮件,而这些邮件将不会首次发送出去。 And about 10 of those are not going anywhere ever. 而且其中约有10个永远不会消失。 The existence of these mails in the retry queue can have a bit of a drag effect on the delivery of further batches of mail, it's minimal but significant. 这些邮件在重试队列中的存在可能会对进一步的邮件传递产生一些拖累效果,虽然影响很小,但意义重大。

Also you can't just bang 10k mail files into any server and expect it to be entirely happy about it. 同样,您不能仅将10k邮件文件放入任何服务器,并期望它对此感到完全满意。 We've found through experimentation that dripping 1k mails every three minutes gives us the optimal queue to send ratio. 通过实验我们发现,每三分钟发送1000封邮件可以为我们提供最佳的队列发送比例。 Your mileage will vary depending on your hardware. 您的里程会因硬件而异。

Frankly, your choice of software library is the least of your worries at this stage. 坦白说,在此阶段,您对软件库的选择最少。

Be reallyREALLY careful with email stuff, there is a hell of a lot to think about with reguards to spam and data protection. 对于电子邮件,请务必非常小心,对于垃圾邮件和数据保护的防范措施,有很多事情要考虑。 With Pear, there is little useful documentation anywhere it seems, though this may help you: 使用Pear,似乎没有什么有用的文档,尽管这可能会帮助您:

http://www.phpmaniac.net/wiki/index.php/Pear_Mail http://www.phpmaniac.net/wiki/index.php/Pear_Mail

Though maybe you may be better off using something like Campaign Monitor, espescially if you are short on time. 虽然也许使用Campaign Monitor之类的方法可能会更好一些,尤其是在时间紧迫的情况下。

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

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