Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > tiff via email-module

Reply
Thread Tools

tiff via email-module

 
 
Arenz, Ralph
Guest
Posts: n/a
 
      02-17-2005
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
 
Reply With Quote
 
 
 
 
Max M
Guest
Posts: n/a
 
      02-17-2005
Arenz, Ralph wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert TIFF-YC to TIFF-RGB Rubaiyat of Omar Bradley Digital Photography 11 06-27-2010 04:23 PM
BMP to TIFF or TIFF to BMP- any loss? Jenna Topping Digital Photography 5 01-23-2005 01:18 AM
Tool for converting 12-bit TIFF images to 16-bit TIFF-images? Peter Frank Digital Photography 11 12-13-2004 02:41 AM
jpeg to tiff and back to tiff ARosenblat Digital Photography 6 01-09-2004 08:53 PM
Image::Info::TIFF - multi-page tiff images page count ifiaz Perl Misc 1 11-19-2003 05:25 AM



Advertisments