> The following script doesn't seem to work: What does it do/how does it fail? The script looks almost identical to this one: https://stackoverflow.com/questions/703185/using-email-headerparser-with-imaplib-fetch-in-python
Sent with ProtonMail Secure Email. ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, July 30, 2019 6:39 PM, Michael Christopher Robinson <[email protected]> wrote: > I have my email hosted by Eskimo North. I want to write a python > script to go through the spam folder and email me every subject of > every email in it. Properly encoded of course as ASCII text. > > Looks like I want to use imaplib. > > I would like to eventually process the spam folder and move dangerous > emails... would be nice if I could grab a subject list and say > quarantine message 10, 30, and 49 out of say 100 spam messages. > I'd also like to quarantine dangerous attachments or at least sanitize > them... > > Been trying to get the subject list part done, not doing too well > though. > > The following script doesn't seem to work: > > #! /usr/bin/env python > > import imaplib > from email.parser import HeaderParser > > conn = imaplib.IMAP4('mail.eskimo.com') > conn.login('fakeusername','fakepassword') > conn.select() > conn.search(None, 'ALL') > data = conn.fetch(1, '(BODY[HEADER])') > > header_data = data[1][0][1] > > parser = HeaderParser() > msg = parser.parsestr(header_data) > > print msg.keys() > > fakeusername and fakepassword are placeholders of course... > > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
