Search code examples
phpemailsmtpphpmailer

Getting this error while connecting to smtp;451 4.7.1 <email@example.com>: Recipient address rejected: Greylisted for 5 minutes


I am trying to send email to an outlook email address using my test SMTP server and got this error. Using PHPMAILER module for making the SMTP connection.


Solution

  • You're being greylisted, and it's working for them!

    Greylisting is an anti-spam measure that attempts to identify badly-behaved mail clients. A large proportion of spambots generate messages and try to send them immediately, and if they fail, they give up (because they don't really care), whereas a well-behaved mail server will heed the response and try again later. To them, your script is looking like just such a badly-behaved client.

    The solution, therefore, is to try sending again a few minutes later, however, this is a pain to do in PHP. The right way to do this is to set up a local mail server and send through that - it will accept your message immediately, and deal with the onward delivery itself with no input from you, including any greylisting and other spam countermeasures.