This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download all csv file attachments from an IMAP mailbox, save in working dir, delete email(s) afterwards. | |
# IMPORTANT: all emails are deleted, even the ones that do not have (csv) attachments. | |
# Usage: python3 download_mailbox_csv_attachments.py {imap_host} {username} {password} | |
import imaplib, email, os, sys, random | |
if len(sys.argv) != 4: | |
print('Invalid number of arguments') | |
exit(1) |