fix(logs): Log From address instead of envelope MAIL FROM. (#66)

Fixes #64

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
Jagoda Estera Ślązak
2026-02-24 11:58:28 +01:00
committed by GitHub
parent 52208c42b6
commit e1841cb590
2 changed files with 8 additions and 12 deletions
+3 -3
View File
@@ -35,8 +35,6 @@ impl SmtpHandler for IncomingBeforeQueueHandler {
}
async fn check_data(&self, envelope: &Envelope) -> Result<(), String> {
log::debug!("Processing DATA message from {}", envelope.mail_from);
let message = match parse_mail(&envelope.data) {
Ok(m) => m,
Err(e) => return Err(format!("500 Failed to parse message: {}", e)),
@@ -53,6 +51,8 @@ impl SmtpHandler for IncomingBeforeQueueHandler {
return Err(format!("500 Invalid FROM header: {from_header}"));
};
log::debug!("Processing DATA message from {from_addr}");
let from_domain = AddressDomain::from_str(&from_addr).map_err(|e| e.smtp_response())?;
match from_domain {
@@ -108,7 +108,7 @@ impl SmtpHandler for IncomingBeforeQueueHandler {
for recipient in &envelope.rcpt_to {
if !self.config.is_cleartext_ok(recipient) {
log::warn!("Rejected unencrypted mail from: {}", envelope.mail_from);
log::warn!("Rejected unencrypted mail from: {from_addr}");
return Err(ENCRYPTION_NEEDED_523.to_string());
}
}