def METHOD_NAME(self, account):
    """
    Verifies a generic IMAP account by logging in and logging out to both
    the IMAP/ SMTP servers.
    Note:
    Raises exceptions from connect_account(), SMTPClient._get_connection()
    on error.
    Returns
    -------
    True: If the client can successfully connect to both.
    """
    # Verify IMAP login
    conn = self.get_authenticated_imap_connection(account)
    crispin = CrispinClient(
        account.id, account.provider_info, account.email_address, conn
    )
    try:
        conn.list_folders()
        account.folder_separator = crispin.folder_separator
        account.folder_prefix = crispin.folder_prefix
    except Exception as e:
        message = e.args[0] if e.args else ""
        log.error(
            "account_folder_list_failed", account_id=account.id, error=message
        )
        error_message = (
            "Full IMAP support is not enabled for this account. "
            "Please contact your domain "
            "administrator and try again."
        )
        raise UserRecoverableConfigError(error_message)
    finally:
        conn.logout()
    # Verify SMTP login
    try:
        # Check that SMTP settings work by establishing and closing and
        # SMTP session.
        smtp_client = SMTPClient(account)
        with smtp_client._get_connection():
            pass
    except socket.gaierror as exc:
        log.error(
            "Failed to resolve SMTP server domain", account_id=account.id, error=exc
        )
        error_message = (
            "Couldn't resolve the SMTP server domain name. "
            "Please check that your SMTP settings are correct."
        )
        raise UserRecoverableConfigError(error_message)
    except socket.timeout as exc:
        log.error(
            "TCP timeout when connecting to SMTP server",
            account_id=account.id,
            error=exc,
        )
        error_message = (
            "Connection timeout when connecting to SMTP server. "
            "Please check that your SMTP settings are correct."
        )
        raise UserRecoverableConfigError(error_message)
    except Exception as exc:
        log.error(
            "Failed to establish an SMTP connection",
            smtp_endpoint=account.smtp_endpoint,
            account_id=account.id,
            error=exc,
        )
        raise UserRecoverableConfigError(
            "Please check that your SMTP settings are correct."
        )
    # Reset the sync_state to 'running' on a successful re-auth.
    # Necessary for API requests to proceed and an account modify delta to
    # be returned to delta/ streaming clients.
    # NOTE: Setting this does not restart the sync. Sync scheduling occurs
    # via the sync_should_run bit (set to True in update_account() above).
    account.sync_state = "running" if account.sync_state else account.sync_state
    return True