Use lettre 0.8 with native tls 0.2.0

HI
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()
        .to("amichelins@hotmail.com")
        .from("amichelins@gmail.com")
        .subject("Example RUST")
        .text("Example RUST p' frente")
        .build()
        .unwrap();

let mut tls_builder = TlsConnector::builder().unwrap();
    tls_builder.supported_protocols(&[Protocol::Tlsv10]).unwrap();

let tls_parameters =
        ClientTlsParameters::new(
            "smtplw.com.br".to_string(),
            tls_builder.build().unwrap()
        );


let mut mailer = SmtpTransportBuilder::new(("smtplw.com.br", 587), ClientSecurity::Wrapper(tls_parameters))
        .expect("Failed to create transport")
        .authentication_mechanism(Mechanism::Login)
        .credentials(Credentials::new( "login".to_string(), "password".to_string() ))
        .connection_reuse(ConnectionReuseParameters::ReuseUnlimited)
        .build();

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

}

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:

tls_builder.supported_protocols(&[Protocol::Tlsv10]).unwrap();

Error:
"
error[E0599]: no method named supported_protocols found for type native_tls::TlsConnectorBuilder in the current scope
--> src\main.rs:31:17
|
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