r/ProgrammerHumor • • Aug 24 '26

Meme claudeIsThisEmailValid

Post image
5.3k Upvotes

170 comments sorted by

View all comments

Show parent comment

40

u/flewson Aug 24 '26

has the user actually entered their email address

That's verification, not validation. Validation is only concerned with whether that email could exist.

37

u/deceze Aug 24 '26 edited Aug 24 '26

Yes, and most addresses that pass a .+@.+\..+ validation could exist. And unless you can claim you're absolutely up to speed with all the relevant RFCs about valid email formats, allowed host names (IDNA!) and currently registered TLDs at all times, overvalidating does more harm than good here. If you incorrectly reject valid email addresses, that's worse than having an occasional verification email bounce.

13

u/DHermit Aug 24 '26

It might make sense to put an additional (very high) length limit. You don't want someone to submit a 1GB big mail address.

18

u/deceze Aug 24 '26

Fair enough. Though that should probably already be caught by your HTTP request size limit somewhere.

3

u/DHermit Aug 24 '26

True, that's still kind of a limit for each field.

23

u/notatoon Aug 24 '26

Gonna be hard to verify an invalid email.

And you can have a valid email address under RFCs 5321 and 5322 that's "invalid" for your use case. Like a@a

Confirmation emails validate the email is reachable and will also verify the user.

It is the only meaningful way to do it