| 1 | package Mail::DMARC::Report::Send::SMTP; | ||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use feature 'try'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | no warnings 'experimental::try'; ## no critic (ProhibitNoWarnings) | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | our $VERSION = '2.20260827'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use Email::MIME; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | #use Mail::Sender; # something to consider | ||||||||||||||||||||||||||||
| 14 | 4 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use POSIX; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 4 | ▶ | use parent 'Mail::DMARC::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | sub get_domain_mx( $self, $domain ) { | ||||||||||||||||||||||||||
|
Subroutine
get_domain_mx: called CC=6 SCAR=19.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 3 | print "getting MX for $domain\n"; | |||||||||||||||||||||||||||
| 21 | 3 | my $query; | |||||||||||||||||||||||||||
| 22 | 3 | try { | |||||||||||||||||||||||||||
| 23 | 3 | $query = $self->get_resolver->send( $domain, 'MX' ); | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | catch ($error) { | ||||||||||||||||||||||||||||
| 26 | 0 | print "\terror: $error"; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | 3 | ▶ | return [] if !$query; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 3 | my @mx; | |||||||||||||||||||||||||||
| 31 | 3 | for my $rr ( $query->answer ) { | |||||||||||||||||||||||||||
| 32 | 4 | ▶ | next if $rr->type ne 'MX'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 4 | push @mx, { pref => $rr->preference, addr => $rr->exchange }; | |||||||||||||||||||||||||||
| 34 | 4 | ▶ | print $rr->exchange if $self->verbose; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | 3 | ▶ | if ( $self->verbose ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | print "found " . scalar @mx . "MX exchanges\n"; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 3 | return \@mx; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 2 | ▶ | sub get_smtp_hosts( $self, $email = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
get_smtp_hosts: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 2 | ▶ | $email or croak "missing email!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | my ($domain) = ( split /@/, $email )[-1]; | |||||||||||||||||||||||||||
| 46 | 3 | my @mx = map { $_->{addr} } | |||||||||||||||||||||||||||
| 47 | 2 | sort { $a->{pref} <=> $b->{pref} } @{ $self->get_domain_mx($domain) }; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 2 | push @mx, $domain; | |||||||||||||||||||||||||||
| 50 | 2 | ▶ | print "\tfound " . scalar @mx . " MX for $email\n" if $self->verbose; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 2 | return @mx; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 12 | ▶ | sub get_subject( $self, $agg_ref ) { | ||||||||||||||||||||||||||
|
Subroutine
get_subject: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 12 | ▶ | my $rid = $$agg_ref->metadata->report_id || $self->time; | ||||||||||||||||||||||||||
|
Condition33%1/3
$$agg_ref->metadata->report_id || $self->time
MC/DC0%0/2
$$agg_ref->metadata->report_id || $self->time
$$agg_ref->metadata->report_id
$self->time
Truth table33%1/3
A || B
A= $$agg_ref->metadata->report_idB= $self->time
| |||||||||||||||||||||||||||||
| 57 | 12 | my $id = POSIX::strftime( "%Y.%m.%d.", localtime $self->time ) . $rid; | |||||||||||||||||||||||||||
| 58 | 12 | my $us = $self->config->{organization}{domain}; | |||||||||||||||||||||||||||
| 59 | 12 | ▶ | if ( $us eq 'example.com' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | die "Please update mail-dmarc.ini"; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | 12 | my $pol_dom = $$agg_ref->policy_published->domain; | |||||||||||||||||||||||||||
| 63 | 12 | return "Report Domain: $pol_dom Submitter: $us Report-ID:$id"; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 12 | ▶ | sub human_summary( $self, $agg_ref ) { | ||||||||||||||||||||||||||
|
Subroutine
human_summary: called CC=5 SCAR=17.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 12 | my $records = scalar @{ $$agg_ref->{record} }; | |||||||||||||||||||||||||||
| 69 | 12 | my $OrgName = $self->config->{organization}{org_name}; | |||||||||||||||||||||||||||
| 70 | my $pass = grep { | ||||||||||||||||||||||||||||
| 71 | 'pass' eq $_->{row}{policy_evaluated}{dkim} | ||||||||||||||||||||||||||||
| 72 | || 'pass' eq $_->{row}{policy_evaluated}{spf} | ||||||||||||||||||||||||||||
| 73 | 12 | ▶ | } @{ $$agg_ref->{record} }; | ||||||||||||||||||||||||||
|
Condition33%1/3
'pass' eq $_->{'row'}{'policy_evaluated'}{'dkim'} || 'pass' eq $_->{'row'}{'policy_evaluated'}{'spf'}
MC/DC0%0/2
'pass' eq $_->{'row'}{'policy_evaluated'}{'dkim'} || 'pass' eq $_->{'row'}{'policy_evaluated'}{'spf'}
'pass' eq $_->{'row'}{'policy_evaluated'}{'dkim'}
'pass' eq $_->{'row'}{'policy_evaluated'}{'spf'}
Truth table33%1/3
A || B
A= 'pass' eq $_->{'row'}{'policy_evaluated'}{'dkim'}B= 'pass' eq $_->{'row'}{'policy_evaluated'}{'spf'}
| |||||||||||||||||||||||||||||
| 74 | my $fail = grep { | ||||||||||||||||||||||||||||
| 75 | 'pass' ne $_->{row}{policy_evaluated}{dkim} | ||||||||||||||||||||||||||||
| 76 | && 'pass' ne $_->{row}{policy_evaluated}{spf} | ||||||||||||||||||||||||||||
| 77 | 12 | ▶ | } @{ $$agg_ref->{record} }; | ||||||||||||||||||||||||||
|
Condition33%1/3
'pass' ne $_->{'row'}{'policy_evaluated'}{'dkim'} && 'pass' ne $_->{'row'}{'policy_evaluated'}{'spf'}
MC/DC0%0/2
'pass' ne $_->{'row'}{'policy_evaluated'}{'dkim'} && 'pass' ne $_->{'row'}{'policy_evaluated'}{'spf'}
'pass' ne $_->{'row'}{'policy_evaluated'}{'dkim'}
'pass' ne $_->{'row'}{'policy_evaluated'}{'spf'}
Truth table33%1/3
A && B
A= 'pass' ne $_->{'row'}{'policy_evaluated'}{'dkim'}B= 'pass' ne $_->{'row'}{'policy_evaluated'}{'spf'}
| |||||||||||||||||||||||||||||
| 78 | 12 | ▶ | my $ver = $Mail::DMARC::Base::VERSION || ''; # undef in author environ | ||||||||||||||||||||||||||
|
Condition50%1/2
$Mail::DMARC::Base::VERSION || ''
MC/DC0%0/1
$Mail::DMARC::Base::VERSION || ''
$Mail::DMARC::Base::VERSION
Truth table50%1/2
A
A= $Mail::DMARC::Base::VERSION
| |||||||||||||||||||||||||||||
| 79 | 12 | ▶ | my $from = $$agg_ref->{policy_published}{domain} or croak; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | return <<"EO_REPORT" | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | This is a DMARC aggregate report for $from | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | $records records. | ||||||||||||||||||||||||||||
| 86 | $pass passed. | ||||||||||||||||||||||||||||
| 87 | $fail failed. | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | Submitted by $OrgName | ||||||||||||||||||||||||||||
| 90 | Generated with Mail::DMARC $ver | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | EO_REPORT | ||||||||||||||||||||||||||||
| 93 | 12 | ; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 12 | ▶ | sub get_filename( $self, $agg_ref ) { | ||||||||||||||||||||||||||
|
Subroutine
get_filename: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | # 2013 DMARC Draft, 12.2.1 Email | ||||||||||||||||||||||||||||
| 99 | # | ||||||||||||||||||||||||||||
| 100 | # filename = receiver "!" policy-domain "!" begin-timestamp "!" | ||||||||||||||||||||||||||||
| 101 | # end-timestamp [ "!" unique-id ] "." extension | ||||||||||||||||||||||||||||
| 102 | # filename="mail.receiver.example!example.com!1013662812!1013749130.gz" | ||||||||||||||||||||||||||||
| 103 | return join( '!', | ||||||||||||||||||||||||||||
| 104 | $self->config->{organization}{domain}, | ||||||||||||||||||||||||||||
| 105 | 12 | ▶ | $$agg_ref->policy_published->domain, | ||||||||||||||||||||||||||
|
Condition33%1/3
$$agg_ref->metadata->report_id || $self->time
MC/DC0%0/2
$$agg_ref->metadata->report_id || $self->time
$$agg_ref->metadata->report_id
$self->time
Truth table33%1/3
A || B
A= $$agg_ref->metadata->report_idB= $self->time
| |||||||||||||||||||||||||||||
| 106 | $$agg_ref->metadata->begin, | ||||||||||||||||||||||||||||
| 107 | $$agg_ref->metadata->end, | ||||||||||||||||||||||||||||
| 108 | $$agg_ref->metadata->report_id || $self->time, | ||||||||||||||||||||||||||||
| 109 | ) . '.xml'; | ||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub assemble_too_big_message_object( $self, $to, $body ) { | ||||||||||||||||||||||||||
|
Subroutine
assemble_too_big_message_object: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my @parts = Email::MIME->create( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | attributes => { | ||||||||||||||||||||||||||||
| 116 | content_type => "text/plain", | ||||||||||||||||||||||||||||
| 117 | disposition => "inline", | ||||||||||||||||||||||||||||
| 118 | charset => "US-ASCII", | ||||||||||||||||||||||||||||
| 119 | }, | ||||||||||||||||||||||||||||
| 120 | body => $body, | ||||||||||||||||||||||||||||
| 121 | ) or croak "unable to add body!"; | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | my $email = Email::MIME->create( | ||||||||||||||||||||||||||||
| 124 | header_str => [ | ||||||||||||||||||||||||||||
| 125 | From => $self->config->{organization}{email}, | ||||||||||||||||||||||||||||
| 126 | 0 | ▶ | To => $to, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | Date => $self->get_timestamp_rfc2822, | ||||||||||||||||||||||||||||
| 128 | Subject => 'DMARC too big report', | ||||||||||||||||||||||||||||
| 129 | ], | ||||||||||||||||||||||||||||
| 130 | parts => [@parts], | ||||||||||||||||||||||||||||
| 131 | ) or croak "unable to assemble message\n"; | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | return $email; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 11 | ▶ | sub assemble_message_object( $self, $agg_ref, $to, $shrunk ) { | ||||||||||||||||||||||||||
|
Subroutine
assemble_message_object: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 11 | my $filename = $self->get_filename($agg_ref); | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | # WARNING: changes made here MAY affect Send::compress. Check it! | ||||||||||||||||||||||||||||
| 141 | # my $cf = ( time > 1372662000 ) ? 'gzip' : 'zip'; # gz after 7/1/13 | ||||||||||||||||||||||||||||
| 142 | 11 | my $cf = 'gzip'; | |||||||||||||||||||||||||||
| 143 | 11 | ▶ | $filename .= $cf eq 'gzip' ? '.gz' : '.zip'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 11 | ▶ | my @parts = Email::MIME->create( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | attributes => { | ||||||||||||||||||||||||||||
| 147 | content_type => "text/plain", | ||||||||||||||||||||||||||||
| 148 | disposition => "inline", | ||||||||||||||||||||||||||||
| 149 | charset => "US-ASCII", | ||||||||||||||||||||||||||||
| 150 | }, | ||||||||||||||||||||||||||||
| 151 | body => $self->human_summary($agg_ref), | ||||||||||||||||||||||||||||
| 152 | ) or croak "unable to add body!"; | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 11 | ▶ | push @parts, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | Email::MIME->create( | ||||||||||||||||||||||||||||
| 156 | attributes => { | ||||||||||||||||||||||||||||
| 157 | filename => $filename, | ||||||||||||||||||||||||||||
| 158 | content_type => "application/$cf", | ||||||||||||||||||||||||||||
| 159 | encoding => "base64", | ||||||||||||||||||||||||||||
| 160 | name => $filename, | ||||||||||||||||||||||||||||
| 161 | }, | ||||||||||||||||||||||||||||
| 162 | body => $shrunk, | ||||||||||||||||||||||||||||
| 163 | ) or croak "unable to add report!"; | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | my $email = Email::MIME->create( | ||||||||||||||||||||||||||||
| 166 | header_str => [ | ||||||||||||||||||||||||||||
| 167 | From => $self->config->{organization}{email}, | ||||||||||||||||||||||||||||
| 168 | 11 | ▶ | To => $to, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | Date => $self->get_timestamp_rfc2822, | ||||||||||||||||||||||||||||
| 170 | Subject => $self->get_subject($agg_ref), | ||||||||||||||||||||||||||||
| 171 | ], | ||||||||||||||||||||||||||||
| 172 | parts => [@parts], | ||||||||||||||||||||||||||||
| 173 | ) or croak "unable to assemble message\n"; | ||||||||||||||||||||||||||||
| 174 | 11 | $email->header_str_set( 'Message-ID' => $self->get_message_id ); | |||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 11 | return $email; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 13 | ▶ | sub get_timestamp_rfc2822( $self, @args ) { | ||||||||||||||||||||||||||
|
Subroutine
get_timestamp_rfc2822: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 180 | 13 | ▶ | my @ts = @args ? @args : localtime $self->time; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 13 | my $locale = setlocale(LC_CTYPE); | |||||||||||||||||||||||||||
| 182 | 13 | setlocale( LC_ALL, 'C' ); | |||||||||||||||||||||||||||
| 183 | 13 | my $timestamp = POSIX::strftime( '%a, %d %b %Y %H:%M:%S %z', @ts ); | |||||||||||||||||||||||||||
| 184 | 13 | setlocale( LC_ALL, $locale ); | |||||||||||||||||||||||||||
| 185 | 13 | return $timestamp; | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 42 | ▶ | sub get_helo_hostname($self) { | ||||||||||||||||||||||||||
|
Subroutine
get_helo_hostname: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 189 | 42 | my $host = $self->config->{smtp}{hostname}; | |||||||||||||||||||||||||||
| 190 | 42 | ▶ | return $host if $host && $host ne 'mail.example.com'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$host and $host ne "mail.example.com"
MC/DC0%0/2
$host and $host ne "mail.example.com"
$host
$host ne "mail.example.com"
Truth table33%1/3
A and B
A= $hostB= $host ne "mail.example.com"
| |||||||||||||||||||||||||||||
| 191 | 42 | return Sys::Hostname::hostname; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 11 | ▶ | sub get_message_id($self) { | ||||||||||||||||||||||||||
|
Subroutine
get_message_id: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 195 | 11 | my $host = $self->get_helo_hostname; | |||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 11 | my ( $ss, $mm, $hh, $mday, $mon, $year, $wday, $yday, $isdst ) | |||||||||||||||||||||||||||
| 198 | = localtime(time); | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | # Generate a "random" Message-ID | ||||||||||||||||||||||||||||
| 201 | 11 | return sprintf( | |||||||||||||||||||||||||||
| 202 | "<%04d%02d%02d%02d%02d.%s\@%s>", | ||||||||||||||||||||||||||||
| 203 | $year + 1900, | ||||||||||||||||||||||||||||
| 204 | $mon + 1, $mday, $hh, $mm, rand(), $host | ||||||||||||||||||||||||||||
| 205 | ); | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 4 | 1; | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | __END__ | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | =pod | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | =head1 NAME | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | Mail::DMARC::Report::Send::SMTP - utility methods for sending reports via SMTP | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | =head1 VERSION | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | version 2.20260827 | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | =head2 SUBJECT FIELD | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | The RFC5322.Subject field for individual report submissions SHOULD conform to the following ABNF: | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | dmarc-subject = %x52.65.70.6f.72.74 1*FWS ; "Report" | ||||||||||||||||||||||||||||
| 227 | %x44.6f.6d.61.69.6e.3a 1*FWS ; "Domain:" | ||||||||||||||||||||||||||||
| 228 | domain-name 1*FWS ; from RFC6376 | ||||||||||||||||||||||||||||
| 229 | %x53.75.62.6d.69.74.74.65.72.3a ; "Submitter:" | ||||||||||||||||||||||||||||
| 230 | 1*FWS domain-name 1*FWS | ||||||||||||||||||||||||||||
| 231 | %x52.65.70.6f.72.74.2d.49.44.3a ; "Report-ID:" | ||||||||||||||||||||||||||||
| 232 | msg-id ; from RFC5322 | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | The first domain-name indicates the DNS domain name about which the | ||||||||||||||||||||||||||||
| 235 | report was generated. The second domain-name indicates the DNS | ||||||||||||||||||||||||||||
| 236 | domain name representing the Mail Receiver generating the report. | ||||||||||||||||||||||||||||
| 237 | The purpose of the Report-ID: portion of the field is to enable the | ||||||||||||||||||||||||||||
| 238 | Domain Owner to identify and ignore duplicate reports that might be | ||||||||||||||||||||||||||||
| 239 | sent by a Mail Receiver. | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =head1 12.2.1 Email | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | In the case of a "mailto" URI, the Mail Receiver SHOULD communicate | ||||||||||||||||||||||||||||
| 244 | reports using the method described in [STARTTLS]. | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | The message generated by the Mail Receiver must be a [MIME] formatted | ||||||||||||||||||||||||||||
| 247 | [MAIL] message. The aggregate report itself MUST be included in one | ||||||||||||||||||||||||||||
| 248 | of the parts of the message. A human-readable portion MAY be | ||||||||||||||||||||||||||||
| 249 | included as a MIME part (such as a text/plain part). | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | The aggregate data MUST be an XML file subjected to GZIP compression. | ||||||||||||||||||||||||||||
| 252 | The aggregate data MUST be present using the media type "application/ | ||||||||||||||||||||||||||||
| 253 | gzip", and the filenames SHOULD be constructed using the following | ||||||||||||||||||||||||||||
| 254 | ABNF: | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | filename = receiver "!" policy-domain "!" begin-timestamp "!" | ||||||||||||||||||||||||||||
| 257 | end-timestamp [ "!" unique-id ] "." extension | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | unique-id = token | ||||||||||||||||||||||||||||
| 260 | ; "token" is imported from [MIME] | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | receiver = domain | ||||||||||||||||||||||||||||
| 263 | ; imported from [MAIL] | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | policy-domain = domain | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | begin-timestamp = 1*DIGIT | ||||||||||||||||||||||||||||
| 268 | ; seconds since 00:00:00 UTC January 1, 1970 | ||||||||||||||||||||||||||||
| 269 | ; indicating start of the time range contained | ||||||||||||||||||||||||||||
| 270 | ; in the report | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | end-timestamp = 1*DIGIT | ||||||||||||||||||||||||||||
| 273 | ; seconds since 00:00:00 UTC January 1, 1970 | ||||||||||||||||||||||||||||
| 274 | ; indicating end of the time range contained | ||||||||||||||||||||||||||||
| 275 | ; in the report | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | extension = "xml" / "gzip" | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | For the GZIP file itself, the extension MUST be "gz"; for the XML | ||||||||||||||||||||||||||||
| 280 | report, the extension MUST be "xml". | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =over 4 | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | =item * | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | Matt Simerson <msimerson@cpan.org> | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =item * | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | Davide Migliavacca <shari@cpan.org> | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =item * | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | Marc Bradshaw <marc@marcbradshaw.net> | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | =back | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | This software is copyright (c) 2026 by Matt Simerson. | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 305 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | =cut | ||||||||||||||||||||||||||||