Oct-06-2018, 04:56 PM
I have been working on a script for work that downloads email via IMAP, so I use IMAPClient to do that and I can get the emails and see the content. Now I am trying to figure out how to get the attachment and format the data. The attachment is a Tab delimited file that is in txt format.
Here is as far as I get before getting stuck:
Here is as far as I get before getting stuck:
import pyzmail from imapclient import IMAPClient server = IMAPClient('mail.server.com', use_uid=True, ssl=False) server.login('some.email@address.com', 'VerCrazyPassWord') select_info = server.select_folder('Inbox') server.search(['SINCE', '01-Oct-2018']) rawMessage = server.fetch([157], ['BODY[]', 'FLAGS']) print(rawMessage) message = pyzmail.PyzMessage.factory(rawMessage[157][b'BODY[]'])