Beispiel #1
0
 def getFolderList(self):
     result = list()
     if self.Server == "imap.andrew.cmu.edu":    # For CMU campus mail.
         for folder in self.session.list()[1]:
             if parseListResponse(folder)[2].lower()[:5] == "inbox":
                 result.append(parseListResponse(folder)[2])
     else:
         for folder in self.session.list()[1]:
             result.append(parseListResponse(folder)[2])
     return result
Beispiel #2
0
 def getSentFolder(self):
     sentFolders = list()
     if self.Server == "imap.andrew.cmu.edu":    # For CMU campus mail.
         FolderList = self.session.list("INBOX")[1]
     else:
         FolderList = self.session.list()[1]
     for folder in FolderList:
         if parseListResponse(folder.lower())[2].find("sent") != -1:
             sentFolders.append(parseListResponse(folder)[2])
     return sentFolders
Beispiel #3
0
 def getTrashFolder(self):
     trashFolder = ""
     if self.Server == "imap.andrew.cmu.edu":
         FolderList = self.session.list("INBOX")[1]
         isGoogle = False
     elif self.Server in ["imap.gmail.com", "imap.googlemail.com"]:
         FolderList = self.session.list("")[1]
         isGoogle = True
     else:
         FolderList = self.session.list("")[1]
         isGoogle = False
     for folder in FolderList:
         if not isGoogle:
             if (folder.lower().find("trash") != -1 or 
                     folder.lower().find("deleted") != -1):
                 return parseListResponse(folder)[2]
         # This case is for gmail only.
         elif folder.lower().find("\\all") != -1:
             return parseListResponse(folder)[2]
Beispiel #4
0
 def getInboxFolder(self):
     FolderList = self.session.list()[1]
     for folder in FolderList:
         if parseListResponse(folder.lower())[2] == "inbox":
             return parseListResponse(folder)[2]