This is a Python script that uses the imaplib
and email
modules to download email attachments from a specified email account.
- Python 3.x
imaplib
email
- Install the required modules .
- Open the script in a text editor and set the
MAIL_ADDRESS
,MAIL_PASSWORD
, andimap_server
variables to the appropriate values for your email account. - Set the
mailList
variable to a dictionary where the keys are folder names and the values are lists of email addresses. Emails from addresses in these lists will have their attachments downloaded to the corresponding folder.
- Run the script by navigating to its directory in your terminal and running
python <script_name>.py
. - The script will download attachments from emails in the specified email account and save them to folders named after the keys in the
mailList
dictionary.
- The script currently only checks the most recent 3 emails in the inbox. You can change this by modifying the value of the
N
variable in thecheck_mail
function. - The script only downloads attachments from emails sent by addresses specified in the
mailList
dictionary.