tiff via email-module

A

Arenz, Ralph

hi all,

my problem is to get a tiff-file-attachment out of an email sent by a
fax-server.
When i try this with "get_payload(decode='True')" i get additional
informations, looks like binary-mixed header-information, enveloping the
tiff-data.

I tried the following: Sending the email from outlook to a postfix-user and
a file on the postfix-host as well. The file shows the stucture mentioned
above. The mail for the postfix-user is deliverd correctly. So postfix must
fetch the raw tiff-data too!?.

Is there a way to get the raw tiff-data using the email-module?


Any ideas?

ralph
 
M

Max M

hi all,

my problem is to get a tiff-file-attachment out of an email sent by a
fax-server.
When i try this with "get_payload(decode='True')" i get additional
informations, looks like binary-mixed header-information, enveloping the
tiff-data.

get_payload(decode=1) returns the decoded data. eg. the "binary" value
of a file attachement.

If you get additional information there is most likely something wrong
with your message, or you are not traversing it correctly.

You should do something like::

# untested

def getAttachments(message):
"Returns attachments from message"
maintype = message.get_type()
if maintype == 'application/octet-stream' :
return [message.get_payload(decode=1)]
if message.is_multipart():
attachments = []
for part in message.walk():
attachments.append(part.get_payload(decode=1))
return attachments
return []


--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top