Mail::DMARC::opendmarc - Perl extension wrapping OpenDMARC's libopendmarc library
use Mail::DMARC::opendmarc; my $dmarc = Mail::DMARC::opendmarc->new(); # Get spf and dkim auth results from Authentication-Results (RFC5451) header # Store them into the dmarc object together with from domain and let object # query DNS too $dmarc->query_and_store_auth_results( 'mlu.contactlab.it', # From: domain 'example.com', # envelope-from domain Mail::DMARC::opendmarc::DMARC_POLICY_SPF_OUTCOME_NONE, # SPF check result 'neutral', # human-readable SPF check result 'mlu.contactlab.it', # DKIM domain Mail::DMARC::opendmarc::DMARC_POLICY_DKIM_OUTCOME_PASS, # DKIM check result 'ok' # human-readable DKIM check result ); my $result = $dmarc->verify(); # result is a hashref with the following attributes: # 'spf_alignment' # 'dkim_alignment' # 'policy' # 'human_policy' # 'utilized_domain' print "DMARC check result: " . $result->{human_policy} . "\n"; # Diagnostic output of internal libopendmarc structure via this handy function: print $dmarc->dump_policy() if ($debug); # Use it often. Side-effects on the library's internal structure might # interfere if you're trying to optimize call sequences. if ($result->{policy} == Mail::DMARC::opendmarc::DMARC_POLICY_PASS) ...
A very thin layer wrapping Trusted Domain Project's libopendmarc. Please refer to http://www.trusteddomain.org/opendmarc.html for more information on opendmarc
Look into the test suite for more usage examples.
About DMARC: http://www.opendmarc.org
Abount opendmarc and libopendmarc: http://www.trusteddomain.org/opendmarc.html
Davide Migliavacca, <shari@cpan.org>
Copyright (C) 2012, 2013 by Davide Migliavacca and ContactLab
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
This license is not covering the required libopendmarc package from http://www.trusteddomain.org/opendmarc.html. Please refer to appropriate license details for the package.
Please try to have the appropriate amount of fun.
To install Mail::DMARC::opendmarc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::DMARC::opendmarc
CPAN shell
perl -MCPAN -e shell install Mail::DMARC::opendmarc
For more information on module installation, please visit the detailed CPAN module installation guide.