Example #1
0
    def delete(self, msg):
        SMTPEmailAccount.delete(self, msg)
        conn = self.conn

        if self.uidlworks:
            uidl = conn.uidl()
            #check if response is ok
            mids = [
                mid for mid, uid in [tuple(tup.split()) for tup in uidl[1]]
                if uid == msg.id
            ]
            if mids:
                mid = mids[0]
                conn.dele(mid)
        else:
            hash, msgid, _ = msg.id.split("SHA")
            newmsg = conn.retr(msgid)
            #check if response is ok
            newstring = "\n".join(newmsg[1])
            newhash = sha1(newstring).hexdigest()
            if hash == newhash:
                conn.dele(msgid)
            else:
                num_emails, box_size = conn.stat()
                num_emails = int(num_emails)
                for i in xrange(num_emails):
                    emailhash = sha1("\n".join(conn.retr(
                        str(i))[1])).hexdigest()
                    if hash == emailhash:
                        conn.dele(msgid)
                        break
Example #2
0
    def delete(self, msg):
        SMTPEmailAccount.delete(self, msg)
        conn = self.conn

        if self.uidlworks:
            uidl = conn.uidl()
            #check if response is ok
            mids = [mid for mid, uid in
                    [tuple(tup.split()) for tup in uidl[1]]
                    if uid == msg.id]
            if mids:
                mid = mids[0]
                conn.dele(mid)
        else:
            hash, msgid, _ = msg.id.split("SHA")
            newmsg = conn.retr(msgid)
            #check if response is ok
            newstring = "\n".join(newmsg[1])
            newhash = sha1(newstring).hexdigest()
            if hash == newhash:
                conn.dele(msgid)
            else:
                num_emails, box_size = conn.stat()
                num_emails = int(num_emails)
                for i in xrange(num_emails):
                    emailhash = sha1("\n".join(conn.retr(str(i))[1])).hexdigest()
                    if hash == emailhash:
                        conn.dele(msgid)
                        break
Example #3
0
 def _delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self.imap.delete(msg, error = lambda:self.on_error(lambda:self.delete(msg)))
Example #4
0
 def delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self._delete(msg)
Example #5
0
 def _delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self.imap.delete(msg,
                      error=lambda: self.on_error(lambda: self.delete(msg)))
Example #6
0
 def delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self._delete(msg)