EmailValidator: Strict e-mail checking.

Invalid e-mail addresses such as "foo@bar.com((((" would be valid because of the regexp.
master
Jag Talon 2013-11-12 22:00:28 -05:00
parent eea0cafebe
commit 8839403302
1 changed files with 6 additions and 6 deletions

View File

@ -26,18 +26,18 @@ my $message_part = {
handle remainder => sub {
return if !$_;
$_ =~ /\b([^\s]+@[^\s]+)\b/g ;
$_ =~ /^([^\s]+@[^\s]+)$/g;
my $address = $1;
return if !$address;
my $email_valid = Email::Valid->new(
-tldcheck => 1,
);
# Danger: address returns possible modified string!
my $result = $email_valid->address($address);
if (!$result) {
my $message = '';
if(defined $message_part->{$email_valid->details}) {
@ -47,7 +47,7 @@ handle remainder => sub {
return $message || "E-mail address $address is invalid."
}
return "$result seems to be valid.";
return "$address is valid.";
};
1;