The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::BIMI - BIMI object

VERSION

version 3.20240402

DESCRIPTION

Brand Indicators for Message Identification (BIMI) retrieval, validation, and processing

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'};
  }
}

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

dmarc_object

is=rw

Validated Mail::DMARC::PurePerl object from parsed message

domain

is=rw

Domain to lookup/domain record was retrieved from

resolver

is=rw

Net::DNS::Resolver object to use for DNS lookups; default used if not set

selector

is=rw

Selector to lookup/selector record was retrieved from

spf_object

is=rw

Mail::SPF::Result object from parsed message

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

dmarc_pp_object

is=rw

Relevant Mail::DMARC::PurePerl object

dmarc_result_object

is=rw

Relevant Mail::DMARC::Result object

errors

is=rw

options

is=rw

Options class

record

is=rw

Mail::BIMI::Record object

result

is=rw

Mail::BIMI::Result object

time

is=ro

time of retrieval - useful in testing

warnings

is=rw

CONSUMES

EXTENDS

METHODS

finish()

Finish and clean up, write cache if enabled.

log_verbose()

Output given text if in verbose mode.

REQUIRES

AUTHOR

Marc Bradshaw <marc@marcbradshaw.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Marc Bradshaw.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.