How to validate an Email address in Django? [duplicate]

from django.core.exceptions import ValidationError
from django.core.validators import validate_email

value = "[email protected]"

try:
    validate_email(value)
except ValidationError as e:
    print("bad email, details:", e)
else:
    print("good email")

Leave a Comment