summaryrefslogtreecommitdiff
path: root/src/mail.rs
diff options
context:
space:
mode:
authorDaniel García <[email protected]>2021-03-22 20:00:57 +0100
committerDaniel García <[email protected]>2021-03-22 20:00:57 +0100
commitf9ebb780f92c44b63b1cab6be79ff120f183fc4c (patch)
tree0bafe21b0e0e5d778f8cb7caacc6c81340d42ad3 /src/mail.rs
parent1fc6c30652b59a9dd7495393075df2a22246fa02 (diff)
downloadvaultwarden-f9ebb780f92c44b63b1cab6be79ff120f183fc4c.tar.gz
vaultwarden-f9ebb780f92c44b63b1cab6be79ff120f183fc4c.zip
Update dependencies
Diffstat (limited to 'src/mail.rs')
-rw-r--r--src/mail.rs28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mail.rs b/src/mail.rs
index f1e81b26..cd9edd9e 100644
--- a/src/mail.rs
+++ b/src/mail.rs
@@ -332,21 +332,19 @@ fn send_email(address: &str, subject: &str, body_html: String, body_text: String
match mailer().send(&email) {
Ok(_) => Ok(()),
// Match some common errors and make them more user friendly
- Err(e) => match e {
- lettre::transport::smtp::Error::Client(x) => {
- err!(format!("SMTP Client error: {}", x));
- },
- lettre::transport::smtp::Error::Transient(x) => {
- err!(format!("SMTP 4xx error: {:?}", x.message));
- },
- lettre::transport::smtp::Error::Permanent(x) => {
- err!(format!("SMTP 5xx error: {:?}", x.message));
- },
- lettre::transport::smtp::Error::Io(x) => {
- err!(format!("SMTP IO error: {}", x));
- },
- // Fallback for all other errors
- _ => Err(e.into())
+ Err(e) => {
+
+ if e.is_client() {
+ err!(format!("SMTP Client error: {}", e));
+ } else if e.is_transient() {
+ err!(format!("SMTP 4xx error: {:?}", e));
+ } else if e.is_permanent() {
+ err!(format!("SMTP 5xx error: {:?}", e));
+ } else if e.is_timeout() {
+ err!(format!("SMTP timeout error: {:?}", e));
+ } else {
+ Err(e.into())
+ }
}
}
}