Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

New keyword to delete all messages #20

Open
chevi opened this issue Mar 31, 2014 · 2 comments
Open

New keyword to delete all messages #20

chevi opened this issue Mar 31, 2014 · 2 comments

Comments

@chevi
Copy link

chevi commented Mar 31, 2014

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

@memcmp
Copy link
Contributor

memcmp commented Mar 31, 2014

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

@chevi
Copy link
Author

chevi commented Mar 31, 2014

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 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants