#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Bristol, UK
    Posts
    479
    Rep Power
    12

    Detecting Bounces


    I am thinking babout creating a new mailing list management package for my site (using php/mysql) and I have decided it would be nice to have a feature that autodeleted addresses that bounce.

    My initial thinking is to pipe the reply address of the mailing list to a script that reads in the mail, decides whether it's a bouncer and if so which email address is bouncing and takes appropriate action. Obviously certain precautions would be taken to ensure that address that just have tmeporary probalems don't get deleted.

    Emails to that address that aren't bounce messages will be sent somewhere else.

    My question is, does any one have any experince of this? For instance, what would be the best way to determine if the mails a bounce or not e.t.c? Is there an easier way to do it than with a script?

    The other bonus of using this sytem would be that I can have a meaningfull reply-address without having lots of bounces cluttering my mail servers.

    Thanks for any suggestions.
  2. #2
  3. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    16
    http://cr.yp.to/proto/qsbmf.txt details the bounce format for qmail. Shortcut: if the body begins with "Hi. This is the" then the message is a bounce from qmail - though that could concievably be written by a human, so it's best to check for "Hi. This is the qmail-send" instead.

    http://www.rfc-archive.org/getrfc?rfc=1894 details the format for DSN (delivery status notification) which is used by most other MTA's to notify the sender of bounces. Apparently it's "machine parsable" but it is somewhat convoluted. Note with DSN, some failures are not permanent. Sendmail will send a non-fatal DSN if it can't deliver the message after 4 hours, but it will continue to try delivering the message.

    Rather than re-inventing the wheel, you might want to look at using an existing mailing-list manager, which will already have done the hard work of handling automatic bounces, verifying subscriptions, etc. See ezmlm and ezmlm-idx (add-ons for ezmlm) and ezmlm-web (a web-based interface for ezmlm).
    Alex
    (http://www.alex-greg.com)
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Bristol, UK
    Posts
    479
    Rep Power
    12
    Cheers for the reply Alex.

    I should really have been more clear, I guess I don't mean a mailing list manager as such more just a newsletter system - allowing users to subscribe to receive my newsletter online and then send bulk (dare I call it that) mails to all (with a facility to unsubscribe easily of course).

    The problem is that as it is I enevitably get quite a few bounces every time a mail goes out and would like to have a sscript process them. I've seen a few tutorials about this sort of thing - not all of which are helpfull. And I have searched hard and lng for some kind of ready made script that will do what I want but haven't succeeded.

    I guess I am re-inveting the wheel but mainly because I enjoy the challenge of doing so and because I like to have full control over what features are available and what is happening.

    Anyway, back to the point of this thread, The DFC specifications are probably a little on the long winded side for my liking. Alternatively, I have found a reasonably long list of word strings typically used in bounced messages all with an identifier to specify a hard bounce or a soft bounce. I am intending to use myscript to search through the body for one or more of these strings and if it finds it consider it a hard/soft bounce respectively.

    Non- bounced email will be forwarded to my email address so if any of them are bounces but without one of my identifiying strings, I can add an identifying few words from the body to my list and so hopefully similar messages will be considered bounces.

    My two main problems now are these:

    1. How can I force all bounced email back to one address? Is it enough just to send it from that address or with a reply-to address or do I need to specify a suitable return path header?

    2. Is there a better way of finding out which email has bounced than to regexp my bouce email for an address?

    Any suggestions regarding the above or pointers towards tutorials, classes, scripts e.t.c. are very welcome.

    thanks again.
    Last edited by banks; February 18th, 2004 at 04:34 PM.

IMN logo majestic logo threadwatch logo seochat tools logo