Skip to content
Snippets Groups Projects
Unverified Commit 9e1f030a authored by Daniel García's avatar Daniel García
Browse files

Explicitly close SMTP connection in case of error.

parent 04922f6a
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment