diff options
| author | bwarsaw | 2001-08-04 06:43:58 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-08-04 06:43:58 +0000 |
| commit | 5383a56c11b86a9c742c20b4a5e312ab4dc07457 (patch) | |
| tree | 464f6daa082affae4de2b8d8d05924d531a261f9 | |
| parent | 329e22c306b749e85f690852affc19131a67a427 (diff) | |
| download | mailman-5383a56c11b86a9c742c20b4a5e312ab4dc07457.tar.gz mailman-5383a56c11b86a9c742c20b4a5e312ab4dc07457.tar.zst mailman-5383a56c11b86a9c742c20b4a5e312ab4dc07457.zip | |
It seems that all SMTP32 mailers have an
X-Mailer: <SMTP32 v....
header. Also, different prefix sentences before the address have been
spotted in the wild.
| -rw-r--r-- | Mailman/Bouncers/SMTP32.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Mailman/Bouncers/SMTP32.py b/Mailman/Bouncers/SMTP32.py index 9e7732a63..bbd129325 100644 --- a/Mailman/Bouncers/SMTP32.py +++ b/Mailman/Bouncers/SMTP32.py @@ -17,19 +17,37 @@ """Something which claims X-Mailer: <SMTP32 vXXXXXX> -What the heck is this thing? +What the heck is this thing? Here's a recent host: + +% telnet 207.51.255.218 smtp +Trying 207.51.255.218... +Connected to 207.51.255.218. +Escape character is '^]'. +220 X1 NT-ESMTP Server 208.24.118.205 (IMail 6.00 45595-15) + """ import re -from mimelib import MsgReader +from mimelib.MsgReader import MsgReader ecre = re.compile('original message follows', re.IGNORECASE) -acre = re.compile(r'user mailbox[^:]*:\s*(?P<addr>.*)', re.IGNORECASE) +acre = re.compile(r''' + ( # several different prefixes + user\ mailbox[^:]*: # have been spotted in the + |delivery\ failed[^:]*: # wild... + |undeliverable\ to + ) + \s* # space separator + (?P<addr>.*) # and finally, the address + ''', re.IGNORECASE | re.VERBOSE) def process(msg): - mi = MsgReader.MsgReader(msg) + mailer = msg['x-mailer'] + if not mailer.startswith('<SMTP32 v'): + return + mi = MsgReader(msg) addrs = {} while 1: line = mi.readline() |
