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 :: keras model predict list of input tensors 
Python :: while my_input != "exit": 
Python :: pandas data frame from part of excel openpyxl 
Python :: get list of all document in django-elasticsearch-dsl 
Python :: multiplication table in python 
Python :: gizeh python 
Python :: python http handler iis 
Python :: print start time in python 
Python :: set application taskbar icon 
Python :: TypeError: get() takes 1 positional argument but 2 were given 
Python :: reset all weights tensorflow 
Python :: django celery email 
Python :: python strong type 
Python :: how to store only the first and last item of a list in variable python 
Python :: sensing keyboard shortcuts using python 
Python :: python variable type casting 
Python :: install cs50 library python 
Python :: python copy list from index 
Python :: pandas reverse explode 
Python :: python check vpn ip address 
Python :: move a file in python 
Python :: How to sort a list by even or odd numbers using a filter? 
Python :: program to print areas in python 
Python :: check true false in python 
Python :: django url wildcard 
Python :: split string and remove some and re-create again 
Python :: list comperhension condition in python 
Python :: python first letter to capitalize 
Python :: how to reorder columns in pandas 
Python :: python polyfit with errors 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =