def validate_email_domain(email):
    """ Validates email domain by blacklist. """
    try:
        domain = email.split('@', 1)[1].lower().strip()
    except IndexError:
        return
    if domain in dju_settings.DJU_EMAIL_DOMAIN_BLACK_LIST:
        raise ValidationError(_(u'Email with domain "%(domain)s" is disallowed.'),
                              code='banned_domain', params={'domain': domain})
Validates email domain by blacklist.