On Mon, Oct 12, 2015 at 6:17 PM, Anthony Papillion
<anth...@cajuntechie.org> wrote:
> I'm writing a script that will have email with attachments passed to it via 
> Postfix.  Postfix is properly passing the email to the script but I'm not 
> quite sure how to get at the attachment.  What I need to do is save the 
> attachment out to the filesystem.
>
> Can anyone point me in the right direction?

If I understand the situation correctly, you're getting a
MIME-formatted email, and want to decode it into a usable attachment -
right?

Python includes a package for teasing apart RFC[2]822 format emails:

https://docs.python.org/3/library/email.html

Check out the email.parser module, or the convenience function
email.message_from_string - you should be able to get at the different
parts (including attachments) from there.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to