procmail
[Top] [All Lists]

Re: Filtering e-mail address from bounced mail

2001-06-20 10:39:41
At 17:58 2001-06-20 +0200, Jeroen Reynders wrote:

Question:
How can I filter the body for a e-mail address so that if we get a bounced
email back we can send the email address of the user to a external
program?

This is nearly impossible:

* There really isn't a standard format for bounce messages, though the bounces that sendmail produces would, by the merit of it having been the largest MTA, probably be considered as an unofficial standard of sorts.

* Many corporate mail servers don't adhere to anything resembling a standard -- some don't even identify what address they're bouncing on.

* Some users will have forwarding services -- so the address they provided to you may be valid, but the mailbox that it forwards to might not be. If you get a bounce from one of these, and manage to extract an address, it will not be the address that was provided to you.


The most successfull form of automated bounce handling is when the sent message has a return address which is unique to the recipient. That way, if their server bounces it (even if it is a forward), it should come back to you at an address which can then be used to determine what address it had been sent to - then, short of possibly scanning the message body for a reason, you can pretty much ignore the message body.

Of course, not all MTAs follow the rules, and as such, they sometimes send bounces to the wrong address from the headers. Those bounces will have to be handled manually. They should be a smaller portion of the total however.

To deal with morons who cannot enter their own email address correctly (you must have a lot of AOL and MSN users? <g>), your subscription process should include a step where the user emails an acknowledgement code to a specific address at your service. That could pair up their actual address with the one they're providing. Nine times out of ten, even a moron will have their email client set up properly (though it's been known to happen that they'll botch that). You could instead mail them a message they must reply to (thus demonstrating they're receiving the message and not just capable of sending from the account), and check for bounces on THAT message too.

  :0 B
   * ^To: *\/(_dot_)*(_at_)?(_dot_)*
   | echo $MATCH >> test_date_filter

Although you're piping to an echo, you're eventually outputting to a file, so you should add a lockfile flag (:) to the flags line.

I ran this against a folder of known bounces, and it seemed to do pretty well -- so long as the headers of the bounced message appeared within the bounce, and the To: of the bounced message was the address in question (I imagine the latter will hold true for your purposes, though it often doesn't for others).

The message headers from the original message are frequently not included in bounces from some MTAs.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>