mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
feat: improve SMTP logging
This commit is contained in:
@@ -552,7 +552,7 @@ pub(crate) async fn send_msg_to_smtp(
|
|||||||
}
|
}
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
"Try number {} to send message {} over SMTP", retries, msg_id
|
"Try number {retries} to send message {msg_id} (entry {rowid}) over SMTP"
|
||||||
);
|
);
|
||||||
|
|
||||||
let recipients_list = recipients
|
let recipients_list = recipients
|
||||||
@@ -576,7 +576,7 @@ pub(crate) async fn send_msg_to_smtp(
|
|||||||
{
|
{
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
"Sending of message {} was cancelled by the user.", msg_id
|
"Sending of message {msg_id} (entry {rowid}) was cancelled by the user."
|
||||||
);
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -649,6 +649,8 @@ pub(crate) async fn send_smtp_messages(context: &Context, connection: &mut Smtp)
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
info!(context, "Selected rows from SMTP queue: {rowids:?}.");
|
||||||
for rowid in rowids {
|
for rowid in rowids {
|
||||||
send_msg_to_smtp(context, connection, rowid)
|
send_msg_to_smtp(context, connection, rowid)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -64,9 +64,11 @@ impl Smtp {
|
|||||||
if let Some(ref mut transport) = self.transport {
|
if let Some(ref mut transport) = self.transport {
|
||||||
transport.send(mail).await.map_err(Error::SmtpSend)?;
|
transport.send(mail).await.map_err(Error::SmtpSend)?;
|
||||||
|
|
||||||
context.emit_event(EventType::SmtpMessageSent(format!(
|
let info_msg = format!(
|
||||||
"Message len={message_len_bytes} was smtp-sent to {recipients_display}"
|
"Message len={message_len_bytes} was SMTP-sent to {recipients_display}"
|
||||||
)));
|
);
|
||||||
|
info!(context, "{info_msg}.");
|
||||||
|
context.emit_event(EventType::SmtpMessageSent(info_msg));
|
||||||
self.last_success = Some(std::time::SystemTime::now());
|
self.last_success = Some(std::time::SystemTime::now());
|
||||||
} else {
|
} else {
|
||||||
warn!(
|
warn!(
|
||||||
|
|||||||
Reference in New Issue
Block a user