robotframework-imaplibrary icon indicating copy to clipboard operation
robotframework-imaplibrary copied to clipboard

New keyword to delete all messages

Open chevi opened this issue 10 years ago • 2 comments

Please add new keyword to have possibility delete all messages in email

chevi avatar Mar 31 '14 11:03 chevi

If you send a pull request with the implementation of the keyword i may merge and release it.

memcmp avatar Mar 31 '14 11:03 memcmp

Sorry, I'll just put code here:

    def delete_all_messages(self):
        """
        Delete all received mails
        """
        type, data = self.imap.search(None, 'ALL')
        if not str(data) == "[None]":
           for mail in data[0].split():
               self.imap.store(mail, '+FLAGS', '\Deleted')
           self.imap.expunge()
        else:
           pass 

chevi avatar Mar 31 '14 12:03 chevi