Process Permanent and Transient SMTP errors

This commit is contained in:
Alexander Krotov
2020-02-20 02:04:25 +03:00
committed by holger krekel
parent 4b6963122b
commit 840e321dd9

View File

@@ -207,6 +207,20 @@ impl Job {
res = Status::RetryNow;
}
}
match err {
async_smtp::smtp::error::Error::Permanent(_) => {
res = Status::Finished(Err(format_err!("Permanent SMTP error: {}", err)))
}
async_smtp::smtp::error::Error::Transient(_) => {
// We got a 4xx response from SMTP server.
// Do not retry right now, wait until the error resolves on the server
// side.
res = Status::RetryLater;
}
_ => {}
}
// this clears last_success info
smtp.disconnect();