views:

343

answers:

2

I am building a symfony module for sending newsletters. the idea is to build a queue list of adreeses to receice the mail and then ,with a cron job, send let's say 50 at a time.

What i don't now how to do is to read the Mail Delivery reports that are sent back by the server when an email adress doesn't exist or the mail is full. The idea is to store these error reports an clean the adress list.

Any ideea how to implement that?

+2  A: 

You can use a reply to address while sending. So bouned emails will be sent to this id. You can also create another PHP script which will read this "reply to" email inbox and get the id from it. You can then remove this id from the list you have.

Shoban
Remember to also set the Return-Path because some MTAs won't send MDF mails to Reply-To or may not accept the mail at all (or trash it later) if Return-Path is missing.
Energiequant
A: 

When reading the "bounced inbox", you can use a class like this to actually parse the mail and see what status was returned (e.g. permanent or temporary error):

http://www.phpclasses.org/browse/package/2691.html

To really parse a mail accurately will give you a hard time, as not all mailservers are alike and some will send you a "mailbox full"-error marked with a "permanent" flag while others may tell you that the error "user doesn't exist" is "temporary".

I tried a solution for this once and ended up setting up my own parser connected to a huge database containing possible server replies (and their "real" meaning :).

Select0r