Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30071

Download attachment from mail using python

$
0
0

I have multiple emails that contain an attachment. I would like to download the attachment for unread emails and with a specific subject line.

for example, I got an email that has a subject "EXAMPLE" and contains an attachment. So how it would be Below code, I tried but it is not working"it's a Python code

#Subject line can be "EXAMPLE"      for subject_line in lst_subject_line:                 # typ, msgs = conn.search(None,'(UNSEEN SUBJECT "'+ subject_line +'")')             typ, msgs = conn.search(None,'("UNSEEN")')             msgs = msgs[0].split()             print(msgs)             outputdir = "C:/Private/Python/Python/Source/Mail Reader"             for email_id in msgs:                    download_attachments_in_email(conn, email_id, outputdir)

Thank You


Viewing all articles
Browse latest Browse all 30071

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>