Subject: | Email::Valid accepts host parts starting or ending with hyphens |
Email::Valid seems to accept email addresses where parts of the hostname
begin or end with hyphens.
I'm 99% sure that is not valid for any part of a domain name, and
neither is more than one hyphen together, but I can't find a definitive
reference for that... my Google-fu must be weak today.
Examples which version 0.15 of Email::Valid accepts, which I feel it
shouldn't:
my @emails = qw(
bob@-example.com bob@example-.com
bob@-host.example.com bob@host-.example.com
bob@double--dash.example.com
);
Attached to this report is a simple test script which illustrates that
the adddresses are accepted.
Using: perl v5.8.7 built for i486-linux
Any further info required, let me know. I could attempt to provide a
patch if helpful.
Many thanks
David Precious
Subject: | test_emailvalid.pl |
#!/usr/bin/perl
use Email::Valid;
my @emails = qw(
bob@-example.com bob@example-.com
bob@-host.example.com bob@host-.example.com
bob@double--dash.example.com
);
for my $email (@emails) {
if (Email::Valid->address($email)) {
print "$email is valid!\n";
}
}