egulias/EmailValidator

test @testmail.com is marked as a valid email

Closed this issue · 2 comments

Hi

In my opinion test @testmail.com should be marked as an invalid e-mail since space are not allowed in a non quoted string.
However the isValid returns true, with a warning
object(Egulias\EmailValidator\Warning\CFWSNearAt)#167407 (2) { ["message":protected]=> string(37) "Deprecated folding white space near @" ["rfcNumber":protected]=> int(0) }
Should I handle this warning myself - or should the isValid return false in this case?

Hi @thomashohn !
Indeed, however, given the broad specification and how old emails are, this kind of holds true in very limited cases. This is an inherited behaviour from older versions of the library. I'll keep it in my list to give it a thought whether to deprecate them in the next major version.

Meanwhile, you can use NoRFCWarnings validator on top of the RFCValidator. It will handle for you any warning (most warnings are likely to be similar in fashion to this one) and render invalid any email with warnings. It ultimately depends on your use case. If this is the only warning that worries you, you can always implement the EmailValidation interface to customise what get's validated.

Hopes this helps!

Thx. for the answer - will look into that :-)