Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python extract email attachment

from imap_tools import MailBox

# get all attachments from INBOX and save them to files
with MailBox('imap.my.ru').login('acc', 'pwd', 'INBOX') as mailbox:
    for msg in mailbox.fetch():
        for att in msg.attachments:
            print(att.filename, att.content_type)
            with open('C:/1/{}'.format(att.filename), 'wb') as f:
                f.write(att.payload)
Comment

PREVIOUS NEXT
Code Example
Python :: append multiple values to 2d list python 
Python :: python for in for in 
Python :: numpy multiply element wise 
Python :: python function docstring 
Python :: python sort multiple keys 
Python :: sortedcontainers sorteddict import 
Python :: How to Get the Union of Sets in Python 
Python :: python includes string 
Python :: send api request python 
Python :: django sign up 
Python :: remove string from list in python 
Python :: how to get SITE_ID in django....shell 
Python :: matplotlib plot in second axis 
Python :: selenium save page as image 
Python :: how to update data in csv file using python 
Python :: drop 0 in np array 
Python :: how to add list as new row to pandas dataframe 
Python :: how to scale an array between two values python 
Python :: python lastmonth 
Python :: get number in string python 
Python :: assert integer python 
Python :: python dictionary pop key 
Python :: module.__dict__ python 
Python :: pandas como quitar comillas simples de una columna 
Python :: how to remove element from list python by index 
Python :: pandas dataframe any along row 
Python :: beautifulsoup getting data from a website 
Python :: handwritten digits data set 
Python :: program to add first and last digit of a number in python 
Python :: Python how to use __lt__ 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =