diff --git a/lib/Mail/DMARC.pm b/lib/Mail/DMARC.pm index 8cd57c77..9a3a3bb2 100644 --- a/lib/Mail/DMARC.pm +++ b/lib/Mail/DMARC.pm @@ -45,19 +45,19 @@ sub source_ip { sub envelope_to { return $_[0]->{envelope_to} if 1 == scalar @_; - croak "invalid envelope_to" if !$_[0]->is_valid_domain( $_[1] ); + croak "invalid envelope_to" if !$_[0]->is_valid_domain( lc $_[1] ); return $_[0]->{envelope_to} = $_[1]; } sub envelope_from { return $_[0]->{envelope_from} if 1 == scalar @_; - croak "invalid envelope_from" if !$_[0]->is_valid_domain( $_[1] ); + croak "invalid envelope_from" if !$_[0]->is_valid_domain( lc $_[1] ); return $_[0]->{envelope_from} = $_[1]; } sub header_from { return $_[0]->{header_from} if 1 == scalar @_; - croak "invalid header_from" if !$_[0]->is_valid_domain( $_[1] ); + croak "invalid header_from" if !$_[0]->is_valid_domain( lc $_[1] ); return $_[0]->{header_from} = lc $_[1]; } diff --git a/lib/Mail/DMARC/Base.pm b/lib/Mail/DMARC/Base.pm index e4cf82d6..c25457a6 100644 --- a/lib/Mail/DMARC/Base.pm +++ b/lib/Mail/DMARC/Base.pm @@ -281,7 +281,7 @@ sub is_valid_ip { sub is_valid_domain { my ( $self, $domain ) = @_; return 0 if $domain !~ /^$RE{net}{domain}{-rfc1101}{-nospace}$/x; - my $tld = ( split /\./, lc $domain )[-1]; + my $tld = ( split /\./, $domain )[-1]; return 1 if $self->is_public_suffix($tld); $tld = join( '.', ( split /\./, $domain )[ -2, -1 ] ); return 1 if $self->is_public_suffix($tld); diff --git a/t/00.Dmarc.t b/t/00.Dmarc.t index d8e6b309..543af984 100644 --- a/t/00.Dmarc.t +++ b/t/00.Dmarc.t @@ -225,7 +225,7 @@ sub test_spf { sub test_header_from { - my @good_vals = (qw/ spam-example.com bar.com /); + my @good_vals = (qw/ spam-example.com bar.com test.co.UK test.CO.za /); foreach my $k (@good_vals) { ok( $dmarc->header_from($k), "header_from, $k" ); }