vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit 9e1f030a80b97288090827113f80f609f3bec0db
parent 04922f6aa0ea26e476985496df203773c2017004
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Thu,  7 Mar 2019 20:21:10 +0100

Explicitly close SMTP connection in case of error.

Diffstat:
Msrc/mail.rs | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mail.rs b/src/mail.rs @@ -137,8 +137,14 @@ fn send_email(address: &str, subject: &str, body_html: &str, body_text: &str) -> .build() .map_err(|e| Error::new("Error building email", e.to_string()))?; - mailer() + let mut transport = mailer(); + + let result = transport .send(email.into()) .map_err(|e| Error::new("Error sending email", e.to_string())) - .and(Ok(())) + .and(Ok(())); + + // Explicitly close the connection, in case of error + transport.close(); + result }