Use lettre 0.8 with native tls 0.2.0

I new to RUST

I am tring to use lettre 0.8 to send a email.

When i use native tls 0.1.5 package compiled with this version does not send email.

Try change the [dependencies] to native-tls = “0.2.2”.
But it does not compile.

extern crate lettre;
extern crate lettre_email;
extern crate native_tls;

use native_tls::TlsConnector;
use native_tls::{Protocol};
use lettre::smtp::authentication::{Credentials, Mechanism};
use lettre::{EmailTransport, ClientTlsParameters, ClientSecurity};
use lettre::smtp::ConnectionReuseParameters;
use lettre::smtp::{SmtpTransportBuilder};
use lettre_email::EmailBuilder;

fn main() {
    let email = EmailBuilder::new()
        .subject("Example RUST")
        .text("Example RUST p' frente")

let mut tls_builder = TlsConnector::builder().unwrap();

let tls_parameters =

let mut mailer = SmtpTransportBuilder::new(("", 587), ClientSecurity::Wrapper(tls_parameters))
        .expect("Failed to create transport")
        .credentials(Credentials::new( "login".to_string(), "password".to_string() ))

    println!("{:?}", mailer.send(&email) );


When native tls is 0.2.2 this line gives error:

let mut tls_builder = TlsConnector::builder().unwrap();

For native tls is 0.2.2 this line is:
let mut tls_builder = TlsConnector::builder();

In this form the erro jumps to this line:


error[E0599]: no method named supported_protocols found for type native_tls::TlsConnectorBuilder in the current scope
–> src\
31 | tls_builder.supported_protocols(&[Protocol::Tlsv10]).unwrap();
| ^^^^^^^^^^^^^^^^^^^

How to solve this issue?

thanks in advance

In Rust, by convention, packages with versions 0.x and 0.y have breaking changes and are not compatible. The change of tls 0.1 to 0.2 is not simple, and will require upgrading/rewriting code that uses it.

I suggest sticking to recommended version 0.1 of tls and investigating why lettre isn’t working.

Hi Kornel.

My problem is that i need some features present in 0.2.x version of native-tls
One of them is TlsConnector => danger_accept_invalid_certs
becouse my smtp server requires this