Hi,
I am new to this, so please excuse any rookie mistakes.
I have tried to use Email Validators and found it failing if the Display Name exists, as described in the rfc https://tools.ietf.org/html/rfc2822#section-3.4
Below, you can find some attempts.
My best guess is that the regex used are simplistic. I did not dig into that because the regex already looks ugly/perfect enough (whatever you want to call it).
What can tell me about this? What would you recommend?
Thanks
malcata
>>> def validateEmail( email ):
... from django.core.validators import validate_email
... from django.core.exceptions import ValidationError
... try:
... validate_email( email )
... return True
... except ValidationError:
... return False
...
...
>>>
>>> print(validateEmail('someone@domain.com'))
True
>>> print(validateEmail('Display Name <someone@domain.com>'))
False
>>> print(validateEmail('"Display Name" <someone@domain.com>'))
False
>>> print(validateEmail('\"Display Name\" <someone@domain.com>'))
False
>>> print(validateEmail('<someone@domain.com>'))
False
>>> print(validateEmail('someone@domain.com'))
True
>>> print(validateEmail('someone+1@domain.com'))
True