Created
August 21, 2017 21:21
-
-
Save guoqiao/1e0d1806bf75b6a4fe8349b824329920 to your computer and use it in GitHub Desktop.
validate email with django builtin functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_email(email): | |
from django.core.validators import EmailValidator | |
from django.core.exceptions import ValidateError | |
try: | |
EmailValidator()(email) | |
except ValidateError: | |
return False | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment