mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 11:00:19 +00:00
allow insecure tls option, second try (#105)
This commit is contained in:
parent
dd45b4bbc2
commit
9317e6b8a5
1 changed files with 9 additions and 8 deletions
17
src/smtp.rs
17
src/smtp.rs
|
@ -1,11 +1,8 @@
|
||||||
use error_chain::error_chain;
|
use error_chain::error_chain;
|
||||||
use lettre::{self,
|
use lettre::{
|
||||||
transport::{
|
self,
|
||||||
smtp::SmtpTransport,
|
transport::{smtp::client::Tls, smtp::client::TlsParameters, smtp::SmtpTransport},
|
||||||
smtp::client::Tls,
|
Transport,
|
||||||
smtp::client::TlsParameters
|
|
||||||
},
|
|
||||||
Transport
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::config::model::Account;
|
use crate::config::model::Account;
|
||||||
|
@ -34,7 +31,11 @@ pub fn send(account: &Account, msg: &lettre::Message) -> Result<()> {
|
||||||
|
|
||||||
smtp_relay(&account.smtp_host)?
|
smtp_relay(&account.smtp_host)?
|
||||||
.port(account.smtp_port)
|
.port(account.smtp_port)
|
||||||
.tls(Tls::Wrapper(tls))
|
.tls(if account.smtp_starttls() {
|
||||||
|
Tls::Required(tls)
|
||||||
|
} else {
|
||||||
|
Tls::Wrapper(tls)
|
||||||
|
})
|
||||||
.credentials(account.smtp_creds()?)
|
.credentials(account.smtp_creds()?)
|
||||||
.build()
|
.build()
|
||||||
.send(msg)?;
|
.send(msg)?;
|
||||||
|
|
Loading…
Reference in a new issue