Last active
August 29, 2015 14:14
-
-
Save robsmith1776/8e350782d5364c1b8040 to your computer and use it in GitHub Desktop.
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
class CSOFEmail(object): | |
def __init__(self): | |
self.mail = imaplib.IMAP4_SSL('outlook.office365.com', port='993') | |
self.mail.login('[email protected]', 'Hardcore8*') | |
print("logged in") | |
self.folder_info = defaultdict(dict) | |
def grab_folder_list(self): | |
response, dir_list = self.mail.list(directory='INBOX/CSOF.NET/') | |
for x in dir_list: | |
name = x.split("/")[-1] | |
email_folder = str(x).split(' ')[-1] | |
directory = "emails/" + email_folder.split("/")[-1] | |
self.folder_info[name]['Original'] = x | |
self.folder_info[name]['Email Folder'] = email_folder | |
self.folder_info[name]['Directory'] = directory | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment