def checkMail(self, REQUEST):
     # Run through the list of registered validators.
     message = self.getMailFromRequest(REQUEST)
     message = message_from_string(message)
     validators = getattr(self, '_check_mail_callback_chain', [])
     # XXX/BBB This is probably wrong, but we need to migrate existing instances.
     #         Perhaps we should look for a class variable flag too?
     if validators == []:
         setDefaultValidatorChain(self)
         validators = getattr(self, '_check_mail_callback_chain')
     try:
         for validator in validators:
             validator(message, self, REQUEST)
     except ValidatorException, e:
         return str(e)
def manage_addMailBoxer(self, id, title='', smtphost='',
                                            REQUEST=None, **kw):
    """ Add a new MailBoxer to current ObjectManager. """

    mb = MailBoxer(id, title)
    self._setObject(id,mb)
    mb = self._getOb(id)

    setMailBoxerProperties(mb, REQUEST, kw)
    addMailBoxerMailHost(mb, smtphost)
    # Add archive-folder
    mb.addMailBoxerFolder(mb, 'archive', 'Archive')
    addMailBoxerCatalog(mb)
    addMailBoxerDTML(mb)
    # Setup the default checkMail validator chain
    setDefaultValidatorChain(mb)

    # Redirect if requested TTW
    if REQUEST:
        return self.manage_main(self, REQUEST, update_menu=1)