Exemplo n.º 1
0
    def handle_noargs(self, **options):
        from djpostman.models import EmailBox, Message, Contact
        from djpostman.receiver import ImapMailReceiver

        try:
            mr = ImapMailReceiver()
            print "IMAP Sync: %s" % mr.get_connection()
            mr.connect()
            count = mr.fetch_mail()
            mr.disconnect()
            print "%s mails fetched" % count
        except Exception, e:
            print "ERROR: %s" % str(e)
Exemplo n.º 2
0
 def synchronize(self):
     from djpostman.receiver import ImapMailReceiver
     
     if self.last_sync:
         since_date = self.last_sync
     else:
         since_date = date(2000, 1, 1)
     
     mr = ImapMailReceiver(config=self, since_date=since_date)
     mr.connect()
     self.boxes = '\n'.join(mr.get_boxes())
     count = mr.fetch_mail()
     mr.disconnect()
     self.last_sync = date.today()
     self.save()
     
     return count
Exemplo n.º 3
0
def backend_cleanup():
    mr = ImapMailReceiver()
    mr.fetch_mail()