0

I am trying to make a regexp to match a gmail bounce of a address that doesn't exist to use it with PHPMailer-BHM.

Here is the message

<majsha77665251001@gmail.com>: host
gmail-smtp-in-v4v6.l.google.com[173.194.70.26] said: 550-5.1.1 The email
account that you tried to reach does not exist. Please try 550-5.1.1
double-checking the recipient's email address for typos or 550-5.1.1
unnecessary spaces. Learn more at 550 5.1.1
http://support.google.com/mail/bin/answer.py?answer=6596 n7si4762785wiy.46
(in reply to RCPT TO command)

I want the rule to match the email and the message "The email account that you tried to reach does not exist", or at least "account that you tried to reach does not exist".

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108

1 Answers1

0

I have found it by myself, php code:

preg_match ("/<(\S+@\S+\w)>.*\n?.*\n?.*account that you tried to reach does not exist/i",$body,$match)
  • 3
    That's a very specific, hard-coded REGEX. What if the error message changes or is returned in a different language? – Mitya Jul 11 '12 at 15:32
  • Hi Utkanos, that is one rule, to add to the list of rules of PHPMailer-BHM script. http://sourceforge.net/projects/bmh/ So it purpose is to add another rule, not to match all possible errors. – Alexandru Trandafir Catalin Jul 13 '12 at 13:57