Opened 9 years ago

Closed 9 years ago

#23224 closed Bug (fixed)

Document EmailValidator domain whitelist parameter

Reported by: egberts Owned by: nobody
Component: Documentation Version: 1.7-alpha-2
Severity: Normal Keywords: SMTP email syntax
Cc: areski@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I am unable to validate "webmaster@lab" email address using EmailField() validator.

Examination of Test framework (TEST_DATA in shows that it won't take the "abc@bar" email format.

 (validate_email, 'abc@bar', ValidationError)

Did I miss something new amongst the vast IETF specifications regarding this new restrictive email syntax? Or must we expand our 20yo Lab domain name to something like 'lab.test'?

Tarball File Used:

Change History (6)

comment:1 Changed 9 years ago by Collin Anderson

as a data point: yes, django 1.6 gives the same error message

>>> from django import forms
>>> forms.EmailField().clean('webmaster@lab')
ValidationError: [u'Enter a valid email address.']

comment:2 Changed 9 years ago by Areski Belaid

Cc: areski@… added

FYI this is where django implement the email validation:
documentation on validators:

From this, you will notice that there is an easy way to validate abc@bar:

from django.forms import EmailField
from django.core.validators import EmailValidator

class MyEmailField(EmailField):
    default_validators = [EmailValidator(whitelist=['bar'])]


comment:3 Changed 9 years ago by Tim Graham

Component: Testing frameworkDocumentation
Summary: Unable to validate "webmaster@lab" via EmailField() validationDocument EmailValidator domain whitelist parameter
Triage Stage: UnreviewedAccepted

We should document the solution described by areski.

comment:4 Changed 9 years ago by Areski Belaid

Here a PR for to document the solution

Last edited 9 years ago by Areski Belaid (previous) (diff)

comment:5 Changed 9 years ago by Tim Graham

Has patch: set

comment:6 Changed 9 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 2a4492aecb50122f7cc2c643f7ea5b086f301165:

Fixed #23224 - Documented EmailValidator.

Note: See TracTickets for help on using tickets.
Back to Top