From 926f476194a66d6854d302f9f846e71b7880b72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Mon, 12 Apr 2021 00:37:05 +0200 Subject: [PATCH] increase smtp timeout (#87) --- CHANGELOG.md | 5 +++++ src/smtp.rs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ca3614..c2adf37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- SMTP timeout [#87] + ## [0.2.5] - 2021-04-12 ### Fixed @@ -153,4 +157,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#75]: https://github.com/soywod/himalaya/issues/75 [#79]: https://github.com/soywod/himalaya/issues/79 [#83]: https://github.com/soywod/himalaya/issues/83 +[#87]: https://github.com/soywod/himalaya/issues/87 [#89]: https://github.com/soywod/himalaya/issues/89 diff --git a/src/smtp.rs b/src/smtp.rs index 6ef588a..feb132b 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use error_chain::error_chain; use lettre::{self, transport::smtp::SmtpTransport, Transport}; @@ -21,6 +23,7 @@ pub fn send(account: &Account, msg: &lettre::Message) -> Result<()> { smtp_relay(&account.smtp_host)? .credentials(account.smtp_creds()?) + .timeout(Some(Duration::new(1000, 0))) .build() .send(msg)?;