ye_qca
Last Updated: October 19, 2016
·
9.955K
· leech
Yo nueva

Validate email address in Django

from django.core.validators import email_re

if email_re.match(email_address):
    # Email valid!
else:
    # Email not valid!

It's used by the EmailField validation, but you can use anywhere.

Say Thanks
Respond

2 Responses
Add your response

17893
None

thats deprecated now. use:

from django.core.validators import validate_email
try:
    validate_email(username)
    valid_email = True
except validate_email.ValidationError:
    valid_email = False
over 1 year ago ·
17894
Yo nueva

@radlws Thanks for the update!

over 1 year ago ·