This works for me with Mailman 2.1.15 and email 4.0.1. Does it fail for you with Mailman 2.1.x? If so, what Mailman and email versions?
[msapiro@MSAPIRO ~]$ python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import email
>>> email.__version__
'4.0.1'
>>> import sys
>>> sys.path.insert('/cygdrive/f/test-mailman/')
>>> from Mailman import Message
>>> msg = email.message_from_string("""Message-ID: <email address hidden>
... Content-Type: multipart/mixed; boundary="------------050607040206050605060208"
...
... This is a multi-part message in MIME format.
... --------------050607040206050605060208
... Content-Type: text/plain; charset=UTF-8
... Content-Transfer-Encoding: quoted-printable
...
... Test message containing an attachment with an accented filename
...
... --------------050607040206050605060208
... Content-Type: text/plain; charset=UTF-8;
... name="=?UTF-8?B?dG9kby1kw6lqZXVuZXIudHh0?="
... Content-Transfer-Encoding: base64
... Content-Disposition: attachment;
... filename*=UTF-8''%74%6F%64%6F%2D%64%C3%A9%6A%65%75%6E%65%72%2E%74%78%74
...
... VmlhbmRlCk1lbnRoZQpQYWluClZpbgoKQ3Vpc2luZTogcHLDqXBhcmVyIGwnYXDDqXJvLCBj
... b3VwZXIgZXQgZmFpcmUgcmlzc29sZXIgbGVzIHBhdGF0ZXMsIGV0IGZhaXJlIGxlcyBjb29r
... aWVzCg==
... --------------050607040206050605060208--
... """, Message.Message)
>>> msg
From nobody Wed Oct 3 08:43:13 2012
Message-ID: <email address hidden>
Content-Type: multipart/mixed; boundary="------------050607040206050605060208"
This is a multi-part message in MIME format.
--------------050607040206050605060208
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Test message containing an attachment with an accented filename
This works for me with Mailman 2.1.15 and email 4.0.1. Does it fail for you with Mailman 2.1.x? If so, what Mailman and email versions?
[msapiro@MSAPIRO ~]$ python insert( '/cygdrive/ f/test- mailman/ ') from_string( """Message- ID: <email address hidden> "------ ------050607040 206050605060208 " ------- 050607040206050 605060208 Transfer- Encoding: quoted-printable ------- 050607040206050 605060208 ?UTF-8? B?dG9kby1kw6lqZ XVuZXIudHh0? =" Transfer- Encoding: base64 Disposition: attachment; =UTF-8' '%74%6F% 64%6F%2D% 64%C3%A9% 6A%65%75% 6E%65%72% 2E%74%78% 74 oZQpQYWluClZpbg oKQ3Vpc2luZTogc HLDqXBhcmVyIGwn YXDDqXJvLCBj pcmUgcmlzc29sZX IgbGVzIHBhdGF0Z XMsIGV0IGZhaXJl IGxlcyBjb29r ------- 050607040206050 605060208- - "------ ------050607040 206050605060208 "
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import email
>>> email.__version__
'4.0.1'
>>> import sys
>>> sys.path.
>>> from Mailman import Message
>>> msg = email.message_
... Content-Type: multipart/mixed; boundary=
...
... This is a multi-part message in MIME format.
... -------
... Content-Type: text/plain; charset=UTF-8
... Content-
...
... Test message containing an attachment with an accented filename
...
... -------
... Content-Type: text/plain; charset=UTF-8;
... name="=
... Content-
... Content-
... filename*
...
... VmlhbmRlCk1lbnR
... b3VwZXIgZXQgZmF
... aWVzCg==
... -------
... """, Message.Message)
>>> msg
From nobody Wed Oct 3 08:43:13 2012
Message-ID: <email address hidden>
Content-Type: multipart/mixed; boundary=
This is a multi-part message in MIME format. ------- 050607040206050 605060208 Transfer- Encoding: quoted-printable
-------
Content-Type: text/plain; charset=UTF-8
Content-
Test message containing an attachment with an accented filename
------- ------- 050607040206050 605060208
name=" =?UTF-8? B?dG9kby1kw6lqZ XVuZXIudHh0? =" Transfer- Encoding: base64 Disposition: attachment;
filename* =UTF-8' '%74%6F% 64%6F%2D% 64%C3%A9% 6A%65%75% 6E%65%72% 2E%74%78% 74
Content-Type: text/plain; charset=UTF-8;
Content-
Content-
VmlhbmRlCk1lbnR oZQpQYWluClZpbg oKQ3Vpc2luZTogc HLDqXBhcmVyIGwn YXDDqXJvLCBj pcmUgcmlzc29sZX IgbGVzIHBhdGF0Z XMsIGV0IGZhaXJl IGxlcyBjb29r ------- 050607040206050 605060208- -
b3VwZXIgZXQgZmF
aWVzCg==
-------
>>> att = msg.get_ payload( )[1]
name=" =?UTF-8? B?dG9kby1kw6lqZ XVuZXIudHh0? =" Transfer- Encoding: base64 Disposition: attachment;
filename* =UTF-8' '%74%6F% 64%6F%2D% 64%C3%A9% 6A%65%75% 6E%65%72% 2E%74%78% 74
>>> att
From nobody Wed Oct 3 08:43:44 2012
Content-Type: text/plain; charset=UTF-8;
Content-
Content-
VmlhbmRlCk1lbnR oZQpQYWluClZpbg oKQ3Vpc2luZTogc HLDqXBhcmVyIGwn YXDDqXJvLCBj pcmUgcmlzc29sZX IgbGVzIHBhdGF0Z XMsIGV0IGZhaXJl IGxlcyBjb29r d\xe9jeuner. txt'
b3VwZXIgZXQgZmF
aWVzCg==
>>> att.get_filename()
u'todo-