Perl-Email-Project / Email-Valid

perl library to validate email addresses
19 stars 19 forks source link

Valid address is invalid with Email-Valid #56

Open jcacqua opened 1 year ago

jcacqua commented 1 year ago

We are using Email::Valid and we see that an email address that looks like :

john.michael.dwayne.lionel@test.com

is not valid with the Email::Valid module, despite the fact that this type of email address is valid

Can you confirm that ? Is it a bug ?

Thanks for your help

johannessen commented 1 year ago

Seems to work fine here with Email-Valid-1.203:

$ perl -mEmail::Valid -E "say Email::Valid->address('john.michael.dwayne.lionel@test.com') ? 'is valid' : 'not valid'"
is valid

If the issue persists for you, I’d suggest you provide a specific example of code that fails.

theotherandre commented 2 months ago

Look where it comes from: perl -mEmail::Valid -E "say Email::Valid->address('john.michael.dwayne.lionel@test.com') ? 'is valid' : 'not valid'" indeed leads to 'valid' Now, as usual on *nix, you would write: perl -MEmail::Valid -E 'say Email::Valid->address("john.michael.dwayne.lionel@test.com") ? "is valid" : "not valid"' i. e. we swap the single quotes with double quotes and vice versa. This leads to: not valid

Now look: perl -MEmail::Valid -E 'say Email::Valid->address("john.michael.dwayne.lionel\@test.com") ? "is valid" : "not valid"' I quote the '@' with a backslash and again, it's valid. The latter also happens when you put an email address inside a $variable. Unless with a quoted '@', the result is 'not valid'.

Inside a real programme (not just command line) you can put it in a $variable which does no harm. I think that was the case here.