diff options
| author | bwarsaw | 2000-09-09 03:32:23 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-09-09 03:32:23 +0000 |
| commit | 7c81624ff362d13423b3092c55031634bc1fb81f (patch) | |
| tree | 136591fcb3622775804f8904add5903c9cdb120a | |
| parent | 73d3a0c4902f4a5b6a0e239707b24f0baf830e62 (diff) | |
| download | mailman-7c81624ff362d13423b3092c55031634bc1fb81f.tar.gz mailman-7c81624ff362d13423b3092c55031634bc1fb81f.tar.zst mailman-7c81624ff362d13423b3092c55031634bc1fb81f.zip | |
New bounce detector for what I think is called "Microsoft SMTPSVC",
certainly what MSN and a few other services use.
| -rw-r--r-- | Mailman/Bouncers/Microsoft.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Mailman/Bouncers/Microsoft.py b/Mailman/Bouncers/Microsoft.py new file mode 100644 index 000000000..76f226ad1 --- /dev/null +++ b/Mailman/Bouncers/Microsoft.py @@ -0,0 +1,61 @@ +# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +"""Microsoft's `SMTPSVC' nears I kin tell.""" + +import string +import re +import multifile + +from Mailman.pythonlib.StringIO import StringIO + +scre = re.compile(r'transcript of session follows', re.IGNORECASE) + + + +def process(msg): + if msg.gettype() <> 'multipart/mixed': + return None + boundary = msg.getparam('boundary') + msg.fp.seek(0) + mfile = multifile.MultiFile(msg.fp) + mfile.push(boundary) + # find the first subpart, which has no mime type + try: + more = mfile.next() + except multifile.Error: + # the message *looked* like a DSN, but it really wasn't :( + return None + if not more: + # we didn't find it + return None + addrs = [] + # simple state machine + # 0 == nothng seen yet + # 1 == tag line seen + state = 0 + while 1: + line = mfile.readline() + if not line: + break + line = string.strip(line) + if state == 0: + if scre.search(line): + state = 1 + if state == 1: + if '@' in line: + addrs.append(line) + return addrs or [] |
