Logo Search packages:      
Sourcecode: zope-coreblog version File versions

def zope-coreblog-1.0::COREBlog::COREBlog::receive (   self  ) 

Receive mails

Definition at line 1414 of file COREBlog.py.

01414                      :
        """Receive mails"""
        #create a POP3 client instance
        m = POP3(self.getProperty("mailhost"))
        #Authenticate
        rt = newrotor(self._rotorkey)
        passwd = rt.decrypt(decodestring(self._moblog_password))
        if self.getProperty("useapop"):
            m.apop(self.getProperty("moblog_user"),passwd)
        else:
            m.user(self.getProperty("moblog_user"))
            m.pass_(passwd)

        #get number of total message.
        total = len(m.list()[1])

        #get uid list
        l = m.uidl()[1]
        #make valid uid list
        suidls = []
        for uidline in l:
            ut = split(uidline," ")
            if len(ut) > 0:
                suidls.append(ut[len(ut)-1])
            else:
                suidls.append(uidline)

        if not hasattr(self,"uidls"):
            self.uidls = []
            self._p_changed = 1

        cnt = 1
        uidl_changed = 0
        for uid in suidls:
            if uid not in self.uidls:
                #New mail arrived...
                ml = m.retr(cnt)[1]
                buf = StringIO(join(ml,"\n"))
                mail = Message(buf,self.getProperty("management_page_charset"))
                self.add_mail_entry(mail)
                uidl_changed = 1
            cnt = cnt + 1
        if uidl_changed:
            self.uidls = suidls
            self._p_changed = 1

        m.quit()


    security.declarePrivate('add_mail_entry')
    def add_mail_entry(self,mail):


Generated by  Doxygen 1.6.0   Back to index