egulias / EmailValidator

PHP Email address validator
MIT License
11.44k stars 208 forks source link

Email addresses with hyphens as the first or last letter in the domain part #317

Closed FrancisMawn closed 2 years ago

FrancisMawn commented 2 years ago

Hi,

I am currently using v3.1.2 and we have failed jobs trying to send emails to domain like foo@bar.-baz.com These emails have passed the validation although the SMTP transactions are failing reporting an invalid email domain. Is this supposed to be considered valid?

FrancisMawn commented 2 years ago

I think the current validation does not account for subdomain fragments... ?

egulias commented 2 years ago

Hi, thanks for your patience. As far as I can tell, a dash/hyphen - after a dot . is not valid for domains parts according to RFC 1035. While it migh be valid according to the various "email" RFCs, this library changed to validate against the domain RFC since v3.

FrancisMawn commented 2 years ago

Thank you for your response @egulias.

I'm not sure I understand your reply... Are you acknowledging the issue? The current version does not mark the email as invalid when it should.

ercanertan commented 1 week ago

Why this issue closed? I think including subdomain is essential.