Skip to content

Commit

Permalink
Process Permanent and Transient SMTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Krotov authored and hpk42 committed Feb 20, 2020
1 parent 4b69631 commit 840e321
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 840e321

Please sign in to comment.