Skip to content

Commit

Permalink
Merge pull request #224 from fastmailops/too_big_report_fix
Browse files Browse the repository at this point in the history
Reports: Fix the email sent when reports are too large
  • Loading branch information
marcbradshaw authored Mar 13, 2024
2 parents fdda8f3 + 0ca1eab commit e61e268
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Mail/DMARC/Report/Sender.pm
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ sub send_report {
$report->store->delete_report($aggregate->metadata->report_id);
}
else {
$self->send_too_big_email(\@too_big, $xml_compressed_bytes, $aggregate);
my $send_errors = $report->config->{smtp}->{send_errors} // 1;
$self->send_too_big_email(\@too_big, $xml_compressed_bytes, $aggregate) if $send_errors;
$report->store->delete_report($aggregate->metadata->report_id);
};

alarm(0);
Expand All @@ -346,7 +348,7 @@ sub send_too_big_email {
report_domain=> $aggregate->policy_published->domain,
}
);
my $mime_object = $report->sendit->smtp->assemble_too_big_message_object($aggregate, $to, $body);
my $mime_object = $report->sendit->smtp->assemble_too_big_message_object($to, $body);
$self->email({ to => $to, mime => $mime_object });
};
return;
Expand Down
5 changes: 5 additions & 0 deletions share/mail-dmarc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ smarthost =
smartuser =
smartpass =

; Send error report emails, if set, we will send a simple report to
; any report handler when we were unable to send an aggregate report
; This currently covers errors where the report was too large to send.
send_errors = 1

[imap]
server = mail.example.com
port = 993
Expand Down

0 comments on commit e61e268

Please sign in to comment.