EmailValidator fails for display name

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

Interesting. I agree, that from what I can see of the EmailValidator that it would not handle the display name component.

Just off the cuff, if I had to validate an email address in that format, I’d probably write a wrapper function around it to check to see if the address is of the form (pretty much anything) , and extract the component between the less-than greater-than symbols and pass that to the EmailValidator.