Skip to content

Commit 991089d

Browse files
committed
feat: improve SMTP logging
1 parent c7a250d commit 991089d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/smtp.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ pub(crate) async fn send_msg_to_smtp(
552552
}
553553
info!(
554554
context,
555-
"Try number {} to send message {} over SMTP", retries, msg_id
555+
"Try number {retries} to send message {msg_id} (entry {rowid}) over SMTP"
556556
);
557557

558558
let recipients_list = recipients
@@ -576,7 +576,7 @@ pub(crate) async fn send_msg_to_smtp(
576576
{
577577
info!(
578578
context,
579-
"Sending of message {} was cancelled by the user.", msg_id
579+
"Sending of message {msg_id} (entry {rowid}) was cancelled by the user."
580580
);
581581
return Ok(());
582582
}
@@ -649,6 +649,8 @@ pub(crate) async fn send_smtp_messages(context: &Context, connection: &mut Smtp)
649649
},
650650
)
651651
.await?;
652+
653+
info!(context, "Selected rows from SMTP queue: {rowids:?}.");
652654
for rowid in rowids {
653655
send_msg_to_smtp(context, connection, rowid)
654656
.await

src/smtp/send.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ impl Smtp {
6464
if let Some(ref mut transport) = self.transport {
6565
transport.send(mail).await.map_err(Error::SmtpSend)?;
6666

67-
context.emit_event(EventType::SmtpMessageSent(format!(
68-
"Message len={message_len_bytes} was smtp-sent to {recipients_display}"
69-
)));
67+
let info_msg = format!(
68+
"Message len={message_len_bytes} was SMTP-sent to {recipients_display}"
69+
);
70+
info!(context, "{info_msg}.");
71+
context.emit_event(EventType::SmtpMessageSent(info_msg));
7072
self.last_success = Some(std::time::SystemTime::now());
7173
} else {
7274
warn!(

0 commit comments

Comments
 (0)