sub extract_valid_address {
my $address = shift;
my $local_part_regexp = '[^<>"\s@]+';
- my $domain_regexp = '[^.<>"\s@]+\.[^<>"\s@]+';
+ my $domain_regexp = '[^.<>"\s@]+(?:\.[^.<>"\s@]+)+';
# check for a local address:
return $address if ($address =~ /^($local_part_regexp)$/);