0

I have a website that let users subscribe with their email IDs.

I want to create a cron job that checks the bounced emails via imap connection, and I am using PHP class for that.

The cron job's script supposed to search for emails from "Mail delivery system" and scan the body of the email to detect the invalid email ID in order to mark it in mysql database.

I don't have any problem with IMAP connection or search, but the problem is: I can't find the pattern that the script should look for to define where is the invalid email ID written in the message.

Could you please help me what shall the script look for? (e.g. some word that the email ID will come after or before? Or maybe an HTML tag in the body of the message that carries the invalid email ID)

Thanks for the help

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Mostafa
  • 111
  • 2
  • 12
  • 1
    Possible duplicate of [Bounce Email handling with PHP?](https://stackoverflow.com/questions/1011714/bounce-email-handling-with-php) – Aziz Saleh Oct 20 '17 at 22:35
  • Thanks for the help, but my question is: what is the pattern (the line) that must be in any (Undelivered Mail System) message that will point at the bounced email, my code now look for (rfc822;) then copy the string after that to the end of the line, it works for most of cases to extract the email ID, but in some cases it returns my server's domain name, because some messages might be structured differently. – Mostafa Oct 21 '17 at 08:08

0 Answers0