PHP 批量电子邮件 - 专用 IP 最大?
有没有什么方法可以让我从一个 php 脚本请求发送大约 3000 多封电子邮件,而不会使专用 IP 超载……最多每小时 500 封?
如果你不明白我的意思..这里有详细信息:)
我每小时只能通过我的专用 IP 通过 PHP 中的 mail() 函数发送 500 封电子邮件,有什么办法我可以发送例如 3000 行从一个电子邮件地址,但将 mail() 函数错开,每小时 500 个...
已经谢谢了!
Is there any way i can send out about 3000+ emails from one php script request without overloading a dedicated IP... the max would be 500 per hour?
If you dont get me.. here is detailed :)
I can only send out 500 emails via the mail() function in PHP per hour via my dedicated IP, is there any way i could send out for example 3000 rows of emails pulled from an email address but stagger the mail() functions out for 500 per hour...
Thanks already!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
创建 2 个表,一张用于电子邮件,一张用于收件人列表。
然后创建一个由 cron 运行的脚本,检查消息表中是否有新消息,如果有,则将一批电子邮件发送给下一组收件人。邮件发送后标记每个收件人。
然后,您为客户端创建一个 Web 界面,以创建消息并将收件人附加到消息,一旦用户将消息标记为准备就绪,您的 cron 作业就会拾取它并处理它。
如果没有任何消息要发送,您的 cron 作业不会执行任何操作。
Create 2 tables, one for the email message and one for the list of recipients.
Then create a script to be run by cron that checks if there is a new message in the message table and if so sends a batch of email to the next set of recipients. Marking each recipient after the mail is sent.
Then you create a web interface for your client to create a message and attach recipients to the message once the user marks the message as ready to go your cron job picks it up and processes it.
If there aren't any messages to be sent your cron job doesn't do anything.
您可以在两次通话之间休息一下,或者,如果它们已经在数据库中,则可以在其中添加一个字段来说明它们的发送时间。然后您选择尚未发送的邮件,并从那里开始。
You could sleep between the calls, or, if they're already in a database, put a field in there that says when they were sent. Then you select the ones that haven't been sent, and start from there.
我会在数据库中放置一个字段来显示最后一封电子邮件发送给每个用户的时间以及它是什么电子邮件。我还会有另一个数据库表来显示您发送的每封电子邮件以及它是否已发送给所有用户。
I would put a field in the DB to show when the last email was sent to each user and what email it was. I would also have another DB table to show each email you sent and if it has been sent to all users yet.
感谢所有的答案!
我发现的最好方法实际上是使用 sleep() 在调用之间简单地 sleep() 因为我测试了 400 封邮件,这花了 17 秒:)
用户发送的邮件不太可能超过 450 封限制...但如果他们这样做我在 while() 结束之前有一个 if 语句,检查是否有超过 450 行,如果是的话,它将在每行之间休眠...这无需繁琐的数据库即可工作:)
谢谢!
Thanks for all the answers!
The best way i found was actually to simply sleep() between calls using the sleep() as i tested 400 mails, this took 17 seconds :)
It is unlikely the user will send more than the 450 limit ... but if they do i have an if statement before the while() ends checking if there are more than 450 rows, if so it will sleep between each... this works without fiddly databases :)
Thanks!
经过一些数学计算后,您可以每 8.3 秒(498/小时)发送一封电子邮件,但这并不能解决问题。我认为另一种方法是使用数据库,查询 500 并让 CRON 作业每小时运行一次脚本。
因此,在数据库表中,您可以让脚本在电子邮件发送后更新字段,以便下一个 cron 作业将查询并获取接下来需要发送的 500 封电子邮件。
well after doing some math you could send an email every 8.3 seconds (498/hr) but it doesn't solve the problem. I think another approach would be to use a DB, query for the 500 and have a CRON job run the script every hour.
So in the DB table you could have the script update a field after the email has been sent so the next cron job will query and get the next 500 emails that need to be sent.