> 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のWebサイトによると、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の答えを読むべきです。これはかなり良いと思います。ただし、アレイを分割した後は、スリープしてからスロットルする必要があります。