Friday, November 4, 2011

Parsing Email with PHP

I was working for a Email Advertisement tool,recently. And the first thing I was put to work with is to develop a parser that parses and incoming email and decides whether it is a bounced back email. After couple of googling I got some fare enough solution that I wanted to use for the solution. The steps I followed for the solution are adopted from the following :
HOWTO: Email Bounce handling with PHP, Exim & CPanel, Catch bounces from non-deliverable emails

And the very basic parser I wrote can be downloaded from the following location:
Download the email parser for bounce management
[Bascially It's a codeIgniter controller, but you can use it as you wanna use it]

However, I had to go some more details parsing, later to decide the type of bounce or the reason for the bounce.First I tried parsing the log file for the exim [exim_mainlog file] and then parsing the entire body of the bounced back emails. I will share two more posts on them in this series.