1

I have some PHP code that help send emails. The way it works is that there is a list of unique keys, every key has to be sent to a different email address. Sometimes we need to be able to send 1000 of these key out at once, and hence, 1000 emails.

I am using the Pear Mail SMTP code found in this post with gmail. It works very well when sending just a small number of keys. However when I try to send many keys (over 100), i often get this error:

enter image description here

From what I have read, this means that for whatever reason, the SMTP server isn't taking emails right now, and denies the transfer, suggesting to try back later. I am not quite sure what to do here to handle this problem. Should I make the script pause for a few seconds and try again? Does the error mean something different? What am I to do?

Community
  • 1
  • 1
jeffery_the_wind
  • 17,048
  • 34
  • 98
  • 160
  • 1
    Do you get that error from the same host most of the time? You might be getting rate limited or temporarily blocked by an SMTP server. – drew010 Jul 13 '12 at 22:56

2 Answers2

5

Don't use Gmail for bulk mail. It's a personal email service, not a bulk mailer.

There are plenty of commercial bulk mail services available. Here are a few; there are others.

3

Send out the keys in batches of 50, with a small time-interval between each batch. The error means that you are trying to open too many SMTP connections at the same time.

pyrometer
  • 890
  • 1
  • 8
  • 17