> Now, to not overflow sendgrids servers
> or get caught in spam filters I would
> like to only send batches of 100
> emails at a time, how can I grab 100
> emails from my big array, put them
> into this array, run through the
> sendgrid login, send email, then go
> back, grab the next 100 and run the
> loop again.
就像其他用户在评论中所说的那样,我认为您不应该担心 sendgrid 溢出,因为他们使用消息队列发送电子邮件或不杀死那里的服务器,因为您不是唯一使用 sendgrid 的用户。根据 Sendgrid 网站,他们有一些非常大的网站,例如 Slideshare/Hootsuite/Get Satisfaction/FourSquare,它们发送了大量电子邮件。
在你说的评论中:
> The list is actually about 1100 people
> (just edited the original question),
> also sendgrid wants you to break the
> lines at 1000 characters, so i'm
> guessing sticking all 1000 emails will
> break that. Marc, do you know how to
> change it to BCC?
根据smtp 最佳实践:
您必须确保将页眉折叠到 1,000 个字符以下的行长。不这样做可能会导致中间 MTA 在非空格边界上为您拆分标题,这将导致在最终生成的电子邮件中插入空格。
我假设 PHP 库会自动为您执行此操作,您甚至不必担心。如果您担心,您应该发送support@sendgrid.com
一封电子邮件询问:)??
但是,如果您真的想拆分,则应该阅读cwallenpoole 的答案,我认为这非常好。但是在拆分阵列后,您还应该休眠然后进行节流。