Perl-Email-Project / Email-Valid

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

'localhost' should be a valid domain name #49

Closed tomascohen closed 3 years ago

tomascohen commented 3 years ago

I noticed on our dev environment that root@localhost is considered invalid. Is it something that comes from the RFC? Or a bug?

rjbs commented 3 years ago
~$ perl -MEmail::Valid -E 'say "invalid" unless Email::Valid->address(q{root@loc
alhost}); say Email::Valid->details'
invalid
fqdn

->details returns why something is invalid.

    fqdn ( <TRUE>|<FALSE> )
        Specifies whether addresses passed to address() must contain a fully
        qualified domain name (FQDN). The default is true.

        Please note! FQDN checks only occur for non-domain-literals. In
        other words, if you have set "allow_ip" and the address ends in a
        bracketed IP address, the FQDN check will not occur.
tomascohen commented 3 years ago

Thank you!