Emit an event when SMTP fails (the same is already done for IMAP)

This commit is contained in:
Hocuri
2020-04-04 12:13:50 +02:00
committed by Alexander Krotov
parent 24f4cbbb27
commit 711f3f69da

View File

@@ -169,7 +169,11 @@ impl Smtp {
.timeout(Some(Duration::from_secs(SMTP_TIMEOUT)));
let mut trans = client.into_transport();
trans.connect().await.map_err(Error::ConnectionFailure)?;
trans.connect().await.map_err(|err| {
emit_event!(context, Event::ErrorNetwork(err.to_string()));
Error::ConnectionFailure(err)
})?;
self.transport = Some(trans);
self.last_success = Some(Instant::now());