Werner Spirk wrote:

>
>Mails sent from outlook exchange will not be sent to a closed list
>when there is a German umlaut within the name like
>
>From: =?iso-8859-1?Q?Mai=2C_G=FCnter?= <guenter....@lrz.de>
>
>in general:
>
>Mail sent
>From: =?iso-8859-1?Q?Surname=2C_Givenname?= <addr...@lrz.de>
>
>causes an undeliverable message by mailman sent to
>surn...@mailman.lrz-muenchen.de, if the list in a closed list:


It is not the umlaut that causes the problem. It is the comma.


>Outlook Exchange goes conform with RFC 2047 .


You are correct, but this is tricky. The intent of RFC 2047 section 5,
rule 3 is that an encoded word such as
=?iso-8859-1?Q?Mai=2C_G=FCnter?= when used as the real name portion of
an address will not contain any of the characters which are not
allowed unquoted in this context, and this is true of that encoded
word.

However, Mailman looks at the From: header, and because of the way it
processes this, it sees an ascii decoded header value which looks like
'Mai, G?nter <guenter....@lrz.de>'. It then parses this and gets two
email addresses, 'mai' and 'guenter....@lrz.de' because of the
unquoted comma.

For some purposes, such as determining whether a post is from a list
member, Mailman considers all the addresses and will determine that
this  is from a list member if 'guenter....@lrz.de' is a member, but
if the post is held for some reason such as 'guenter....@lrz.de' is
moderated, the notice to the user will be sent to only the first
address 'mai' which is invalid.

So, yes, you are correct that Mailman is not doing the right thing here.

I've developed a patch that I think will fix this without any other
side effects. I've attached that as rfc2047.patch.txt. Please try this
patch and see if it solves your problems.

-- 
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

--- f:/test-mailman-2.1/Mailman/Message.py      2009-08-01 14:25:34.000000000 
-0700
+++ f:/test-mailman/Mailman/Message.py  2011-01-11 10:49:12.375000000 -0800
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2009 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2011 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
@@ -151,7 +151,9 @@
             # Work around bug in email 2.5.8 (and ?) involving getaddresses()
             # from multi-line header values.  Note that cset='us-ascii' is OK
             # since the address itself can't be RFC 2047 encoded.
-            fieldval = Utils.oneline(fieldval, 'us-ascii')
+            # Actually, just get the raw header as one line in case the
+            # decoded words contain a comma.
+            fieldval = Utils.oneline(fieldval, 'us-ascii', raw=True)
             addrs = email.Utils.getaddresses([fieldval])
             try:
                 realname, address = addrs[0]
@@ -207,7 +209,7 @@
                 if fieldvals:
                     # See comment above in get_sender() regarding
                     # getaddresses() and multi-line headers
-                    fieldvals = [Utils.oneline(fv, 'us-ascii')
+                    fieldvals = [Utils.oneline(fv, 'us-ascii', raw=True)
                                  for fv in fieldvals]
                     pairs.extend(email.Utils.getaddresses(fieldvals))
         authors = []
--- f:/test-mailman-2.1/Mailman/Utils.py        2010-09-09 06:57:56.000000000 
-0700
+++ f:/test-mailman/Mailman/Utils.py    2011-01-11 10:22:44.718750000 -0800
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2011 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
@@ -886,7 +886,10 @@
     return str(EMPTYSTRING.join(a))
 
 
-def oneline(s, cset):
+def oneline(s, cset, raw=False):
+    if raw:
+        # Just return the header as one line without decoding
+        return EMPTYSTRING.join(s.splitlines())
     # Decode header string in one line and convert into specified charset
     try:
         h = email.Header.make_header(email.Header.decode_header(s))
------------------------------------------------------
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Reply via email to