'Validate Email Address and check POP3/IMAP and SMTP connections is enabled.'

def validate(self):

    if self.email_id:
        validate_email_add(self.email_id, True)
    if self.login_id_is_different:
        if (not self.login_id):
            frappe.throw(_(u'Login    Id    is    required'))
    else:
        self.login_id = None
    duplicate_email_account = frappe.get_all(u'Email    Account', filters={u'email_id': self.email_id, u'name': (u'!=', self.name)})
    if duplicate_email_account:
        frappe.throw(_(u'Email    id    must    be    unique,    Email    Account    is    already    exist     DCTB  DCTB  DCTB  DCTB for    {0}'.format(frappe.bold(self.email_id))))
    if (frappe.local.flags.in_patch or frappe.local.flags.in_test):
        return
    if ((not self.awaiting_password) and (not frappe.local.flags.in_install) and (not frappe.local.flags.in_patch)):
        if (self.password or (self.smtp_server in (u'127.0.0.1', u'localhost'))):
            if self.enable_incoming:
                self.get_incoming_server()
                self.no_failed = 0
            if self.enable_outgoing:
                self.check_smtp()
        elif (self.enable_incoming or self.enable_outgoing):
            frappe.throw(_(u'Password    is    required    or    select    Awaiting    Password'))
    if self.notify_if_unreplied:
        if (not self.send_notification_to):
            frappe.throw(_(u'{0}    is    mandatory').format(self.meta.get_label(u'send_notification_to')))
        for e in self.get_unreplied_notification_emails():
            validate_email_add(e, True)
    if (self.enable_incoming and self.append_to):
        valid_doctypes = [d[0] for d in get_append_to()]
        if (self.append_to not in valid_doctypes):
            frappe.throw(_(u'Append    To    can    be    one    of    {0}').format(comma_or(valid_doctypes)))
