Brand Indicators for Message Identification (BIMI) retrieval, validation, and processing
=head1 SYNOPSIS
# Assuming we have a message, and have verified it has exactly one From Header domain, and passes
# any other BIMI and local site requirements not related to BIMI record validation...
# For example, relevant DKIM coverage of any BIMI-Selector header
my $message = ...Specifics of adding headers and Authentication-Results is left to the reader...
my $domain = "example.com"; # domain from From header
my $selector = "default"; # selector from From header
my $spf = Mail::SPF->new( ...See Mail::SPF POD for options... );
my $dmarc = Mail::DMARC::PurePerl->new( ...See Mail::DMARC POD for options... );
$dmarc->validate;
my $bimi = Mail::BIMI->new(
dmarc_object => $dmarc,
spf_object => $spf,
domain => $domain,
selector => $selector,
);
my $auth_results = $bimi->get_authentication_results_object;
my $bimi_result = $bimi->result;
$message->add_auth_results($auth_results); # See Mail::AuthenticationResults POD for usage
if ( $bimi_result->result eq 'pass' ) {
my $headers = $result->headers;
if ($headers) {
$message->add_header( 'BIMI-Location', $headers->{'BIMI-Location'} if exists $headers->{'BIMI-Location'};
$message->add_header( 'BIMI-Indicator', $headers->{'BIMI-Indicator'} if exists $headers->{'BIMI-Indicator'};
}
}
=head1 INPUTS
These values are used as inputs for lookups and verifications, they are typically set by the caller based on values found in the message being processed
=head2 dmarc_object
is=rw
Validated Mail::DMARC::PurePerl object from parsed message
=head2 domain
is=rw
Domain to lookup/domain record was retrieved from
=head2 resolver
is=rw
Net::DNS::Resolver object to use for DNS lookups; default used if not set
=head2 selector
is=rw
Selector to lookup/selector record was retrieved from
=head2 spf_object
is=rw
Mail::SPF::Result object from parsed message
=head1 ATTRIBUTES
These values are derived from lookups and verifications made based upon the input values, it is however possible to override these with other values should you wish to, for example, validate a record before it is published in DNS, or validate an Indicator which is only available locally