MTA: Log when messages are rejected or discarded by the spam classifier.

This commit is contained in:
Maurus Decimus
2026-05-19 19:06:54 +02:00
parent 79907f018d
commit 08b02c9e91
2 changed files with 17 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
- Yandex Cloud DNS
- DNS updater: Log DNS record types and values.
- Sieve: Allow User Sieve scripts to access `orcpt`.
- MTA: Log when messages are rejected or discarded by the spam classifier.
## Changed
- Bump JMAP File Storage to [draft-ietf-jmap-filenode-14](https://datatracker.ietf.org/doc/html/draft-ietf-jmap-filenode-14).
@@ -85,6 +86,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
- Allow internal TLDs in e-mail addresses.
- Websocket: Perform case insensitive matching during upgrade.
- LDAP: Synchronize accounts when expanding mailing list recipients.
- Sieve: `replace` action adds an extra `From` header.
## [0.16.5] - 2026-05-11

View File

@@ -44,7 +44,7 @@ use std::{
borrow::Cow,
time::{Instant, SystemTime},
};
use trc::SmtpEvent;
use trc::{SmtpEvent, SpamEvent};
use utils::DomainPart;
impl<T: SessionStream> Session<T> {
@@ -453,10 +453,24 @@ impl<T: SessionStream> Session<T> {
}
}
SpamFilterAction::Discard => {
trc::event!(
Spam(SpamEvent::Classify),
SpanId = self.data.session_id,
Result = "discard",
Reason = "Message discarded due to excessive spam score.",
);
self.data.messages_sent += 1;
return (b"250 2.0.0 Message queued for delivery.\r\n"[..]).into();
}
SpamFilterAction::Reject => {
trc::event!(
Spam(SpamEvent::Classify),
SpanId = self.data.session_id,
Result = "reject",
Reason = "Message rejected due to excessive spam score.",
);
self.data.messages_sent += 1;
return (b"550 5.7.1 Message rejected due to excessive spam score.\r\n"[..])
.into();