Switch from lettre to async-smtp

This commit is contained in:
Alexander Krotov
2019-12-08 05:05:17 +03:00
committed by Floris Bruynooghe
parent c08a1adc9b
commit 54eb30f3db
5 changed files with 114 additions and 51 deletions

View File

@@ -167,13 +167,15 @@ impl Job {
if let Some(recipients) = self.param.get(Param::Recipients) {
let recipients_list = recipients
.split('\x1e')
.filter_map(|addr| match lettre::EmailAddress::new(addr.to_string()) {
Ok(addr) => Some(addr),
Err(err) => {
warn!(context, "invalid recipient: {} {:?}", addr, err);
None
}
})
.filter_map(
|addr| match async_smtp::EmailAddress::new(addr.to_string()) {
Ok(addr) => Some(addr),
Err(err) => {
warn!(context, "invalid recipient: {} {:?}", addr, err);
None
}
},
)
.collect::<Vec<_>>();
/* if there is a msg-id and it does not exist in the db, cancel sending.