def on_new_mailbox(self): self.binder.update() mb = Mailbox.create() mb.local = self.find('new-mailbox-local').value mb.domain = self.find('new-mailbox-domain').value or self.find('new-mailbox-domain-custom').value mb.owner = self.context.session.identity mb.password = '' if not mb.local: self.context.notify('error', _('Invalid mailbox name')) return if not mb.domain: self.context.notify('error', _('Invalid mailbox domain')) return for existing in self.manager.config.mailboxes: if existing.name == mb.name: self.context.notify('error', _('This address is already taken')) return self.find('new-mailbox-local').value = '' self.manager.config.mailboxes.append(mb) self.manager.save() self.binder.populate()
def on_new_mailbox(self): self.binder.update() mb = Mailbox.create() mb.local = self.find('new-mailbox-local').value mb.domain = self.find('new-mailbox-domain').value or self.find('new-mailbox-domain-custom').value mb.password = '' self.find('new-mailbox-local').value = '' if not mb.local: self.context.error(_('Invalid mailbox name')) if not mb.domain: self.context.error(_('Invalid mailbox domain')) self.manager.config.mailboxes.append(mb) self.manager.save() self.binder.populate()
def on_new_mailbox(self): self.binder.update() mb = Mailbox.create() mb.local = self.find('new-mailbox-local').value mb.domain = self.find('new-mailbox-domain').value or self.find( 'new-mailbox-domain-custom').value mb.password = '' self.find('new-mailbox-local').value = '' if not mb.local: self.context.error(_('Invalid mailbox name')) if not mb.domain: self.context.error(_('Invalid mailbox domain')) self.manager.config.mailboxes.append(mb) self.manager.save() self.binder.populate()