| Server IP : 104.21.93.65 / Your IP : 104.23.243.50 Web Server : Apache System : Linux server.localhost.com 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64 User : pahana ( 1029) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/usr/bin/ |
Upload File : |
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Getopt::Long;
use Pod::Usage;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
use lib 'lib';
use Mail::DMARC::PurePerl;
my %command_line_options = (
'domain:s' => \my $domain,
'verbose' => \my $verbose,
);
GetOptions (%command_line_options);
$verbose = 1 if ! defined $verbose;
$domain ||= $ARGV[0];
$domain or pod2usage;
my $dmarc = Mail::DMARC::PurePerl->new;
$dmarc->verbose($verbose);
$dmarc->header_from($domain);
my $policy = $dmarc->discover_policy() or
die "no DMARC policy published for $domain\n";
print Dumper( $policy );
if ( $policy->rua ) {
print "\n";
my $uri_count = $dmarc->has_valid_reporting_uri( $policy->rua );
print "valid report URI: ";
print $uri_count ? "yes\n" : "no\n";
};
exit;
__END__
=pod
=head1 NAME
dmarc_lookup - look up DMARC policy for a domain
=head1 SYNOPSIS
dmarc_lookup example.com [ --verbose ]
=head1 DESCRIPTION
Query the DNS for a DMARC policy for a (sub)domain. Displays any found results as the DNS record as a perl object. In the simplest case, where the domain name in the email From header matches the I<Organizational Domain>, this is roughly equivalent to the following commands:
dig +short _dmarc.example.com TXT
print $_->txtdata."\n"
for Net::DNS::Resolver->new(dnsrch=>0)->send('_dmarc.example.com','TXT')->answer;
When the domain name in the email From header (header_from) is not an Organizational Domain (ex: www.example.com), an attempt is made to determine the O.D. using the Mozilla Public Suffix List. When the O.D. differs from the header_from, a second DNS query is sent to _dmarc.[O.D.].
=head1 EXAMPLES
A DMARC record in DNS format looks like this:
v=DMARC1; p=reject; adkim=s; aspf=s; rua=mailto:[email protected]; pct=100;
DMARC records are stored as TXT resource records in the DNS, at _dmarc.example.com.
Other ways to retrieve a DMARC record for a domain are:
=head1 SEE ALSO
L<Mail::DMARC::Policy>
=head1 AUTHORS
=over 4
=item *
Matt Simerson <[email protected]>
=item *
Davide Migliavacca <[email protected]>
=item *
Marc Bradshaw <[email protected]>
=back
=cut