mail attachment with non-ascii name

  • Thread starter =?ISO-8859-15?Q?Bernard_Delm=E9e?=
  • Start date
?

=?ISO-8859-15?Q?Bernard_Delm=E9e?=

I am using the "email" module to decode incoming messages.
(with msg = email.message_from_file( msg_file ))
Sometimes an attachment has its name (as returned by
msg.walk().part.get_filename()) not in ASCII (e.g.
'=?iso-8859-1?q?somefile=2ezip?=') How can I turn that into
simply 'somefile.zip' ? I have looked into email.Utils and
codecs, but cannot find what should work.

TIA,

Bernard.
 
N

Neil Hodgson

Bernard Delmée:
I am using the "email" module to decode incoming messages.
(with msg = email.message_from_file( msg_file ))
Sometimes an attachment has its name (as returned by
msg.walk().part.get_filename()) not in ASCII (e.g.
'=?iso-8859-1?q?somefile=2ezip?=') How can I turn that into
simply 'somefile.zip' ? I have looked into email.Utils and
codecs, but cannot find what should work.
[('somefile.zip', 'iso-8859-1')]

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top