PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 31, 2022

[FIXED] What to do in case of SMTP 421 error?

 August 31, 2022     gmail, pear, php, smtp     No comments   

Issue

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?


Solution

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.



Answered By - pyrometer
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing