Page 1 of 1

Detailed Statistics

Posted: Thu Jun 21, 2007 11:19 am
by bkozora
Hey all. I'm in the process of creating a custom marketing newsletter site to replace my company's dependence on Constant Contact (http://www.constantContact.com). For all of the mailing I've opted to go with SwiftMailer, feeling it was the better library out of the available ones.

My problem is CC provides some pretty scary statistics that my company relies on. Some of these statistics include: bounces, opens, forwards, and clicks. Out of bounces they have different types, non existent addresses, undeliverable, mailbox full, vacation/auto reply, other, and blocked.

I have tried to find something similar on this forum, but haven't had too much luck. I think I understand what direction to head towards for some of those stats, opens being read receipts (is there a more reliable way though?), the rest I'm assuming are determined by SMTP error codes returned to the address specified in setReturnPath. Is there any way to retrieve and log the various stats without custom writing something to parse through emails sent to setReturnPath? I really don't have the time to get into something like that, but they need these statistics.[/url]

Posted: Thu Jun 21, 2007 11:28 am
by bkozora
haha, strange enough someone earlier this morning wrote an almost identical question: viewtopic.php?t=69503. So it's looking like I need to write something to automatically gather the errors sent to the return path. For now I'll probably manual retrieve messages and log their results (a very un-programmer like approach, yeah, i know...)

So what would be the best way to go about grabbing results from emails? Don't different email servers send out different bounce messages? I guess I'd have to write some regular expressions to parse the email address and the SMTP error code.

Posted: Thu Jun 21, 2007 12:14 pm
by Chris Corbyn
bkozora wrote:So what would be the best way to go about grabbing results from emails? Don't different email servers send out different bounce messages? I guess I'd have to write some regular expressions to parse the email address and the SMTP error code.
They do. There's sadly no standard or RFC for what format a bounce message should be in. This is what makes it a pain the butt to write :evil:

Automatic Bounce Handling

Posted: Wed Aug 01, 2007 10:03 am
by bkozora
I'm sure it's far from the most stable solution, but I'm working on an automatic bounce handler system based around the PHP Bounce Handler class (http://www.phpclasses.org/browse/package/2691.html or for the newest versions: http://www.anti-spam-man.com/php_bouncehandler/). My tests look rather promising, but it still isn't complete. Once I have it nailed down I'll provide links here (if that's allowed) to help any future developers to capture bounces easier.

In brief, the system uses PHP's IMAP functions to connect to the email address specified in bounce address. It then parses thru all of the emails, creates eml files then deletes the email. From there, the eml files are looped over, getting the parse results from Bounce Handler class. From there its inserted into a database.

I hope to have this completed for my project any day now, so I'll post my findings.

Posted: Wed Aug 01, 2007 11:44 am
by Chris Corbyn
Excellent! Yes, posting links here is perfectly acceptable provided it's a free project and not something for profit ;)