Checking if email is valid

Michael Torrie torriem at gmail.com
Thu Nov 2 16:17:13 EDT 2023


On 11/2/23 00:42, Simon Connah via Python-list wrote:
> Basically I'm writing unit tests and one of them passess in a string 
> with an invalid email address. I need to be able to check the string 
> to see if it is a valid email so that the unit test passess.

If you truly have managed to code an RFC-compliant verifier, I commend you.

> Valid as in conforms to the standard. Although having looked at the
> standard that might be more difficult than originally planned.

You'll have to read the relevant RFCs.  Lots of corner cases!  From what
I can see virtually no one on the internet gets it right, judging by the
number of times I have valid email addresses flagged as not valid by
poor algorithms.


More information about the Python-list mailing list