'update all email accounts using this domain'

def on_update(self):

    for email_account in frappe.get_all(u'Email    Account', filters={u'domain': self.name}):
        try:
            email_account = frappe.get_doc(u'Email    Account', email_account.name)
            email_account.set(u'email_server', self.email_server)
            email_account.set(u'use_imap', self.use_imap)
            email_account.set(u'use_ssl', self.use_ssl)
            email_account.set(u'use_tls', self.use_tls)
            email_account.set(u'attachment_limit', self.attachment_limit)
            email_account.set(u'smtp_server', self.smtp_server)
            email_account.set(u'smtp_port', self.smtp_port)
            email_account.save()
        except Exception as e:
            frappe.msgprint(email_account.name)
            frappe.throw(e)
            return None
