Extracting TIFF from emails

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Wed Sep 3 12:01:21 EDT 2003


On 3 Sep 2003 07:04:17 -0700, rumours say that ryan at ryanswift.com (Ryan
Swift) might have written:

>Hi, I'm new to Python, so this may be an easy solution.  I'm having
>trouble extracting TIFF files from incoming emails.  Actually, I think
>the root of my problem is that I'm having trouble reading the email
>header.  Does anyone have an easy solution?  Thanks in advance.

Check the email package.  Read about the following:

* email.message_from_file
(Assuming you have your incoming mail in a text file)
* class email.Message, its walk method

For each part in the .walk() call, check the .get_content_type() result,
and if it's an 'image/tiff', you have the image data calling
.get_payload(decode=True)

Roughly :)
-- 
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.




More information about the Python-list mailing list