From d1f9d0829163a7bd0d05ed978e770b14917889bb Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Mon, 10 Apr 2000 17:25:03 +0000 Subject: Jim Tittsler reminds me that he posted a bounce detector for Exim, which uses the X-Failed-Recipients header. His implementation was better than mine, but I like this one even better because it avoids the lambda (and corresponding function call overhead). --- Mailman/Bouncers/Exim.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'Mailman/Bouncers/Exim.py') diff --git a/Mailman/Bouncers/Exim.py b/Mailman/Bouncers/Exim.py index 4568c87f3..5dd955662 100644 --- a/Mailman/Bouncers/Exim.py +++ b/Mailman/Bouncers/Exim.py @@ -14,22 +14,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -"""Parse messages that contain X-Failed-Recipients headers. -What MTA generates these? -""" +"""Parse bounce messages generated by Exim. -import string +Exim adds an X-Failed-Recipients: header to bounce messages containing +an `addresslist' of failed addresses. +""" def process(mlist, msg): - failures = msg.getallmatchingheaders('x-failed-recipients') - if not failures: - return None addrs = [] - for failed in failures: - i = string.find(failed, ':') - if i < 0: - continue - addrs.append(string.strip(failed[i+1:])) + for fullname, addr in msg.getaddrlist('x-failed-recipients'): + addrs.append(addr) return addrs or None -- cgit v1.2.3-70-g09d2