Update readme to use native_tls

This commit is contained in:
Greizgh 2017-10-15 14:54:21 +02:00 committed by Jon Gjengset
parent c7a1fa647e
commit a29874d41b
No known key found for this signature in database
GPG key ID: D64AC9D67176DC71

View file

@ -16,9 +16,9 @@ IMAP Client for Rust
Here is a basic example of using the client. See the examples directory for more examples.
```rust
extern crate imap;
extern crate openssl;
extern crate native_tls;
use openssl::ssl::{SslConnectorBuilder, SslMethod};
use native_tls::TlsConnector;
use imap::client::Client;
// To connect to the gmail IMAP server with this you will need to allow unsecure apps access.
@ -28,7 +28,7 @@ fn main() {
let domain = "imap.gmail.com";
let port = 993;
let socket_addr = (domain, port);
let ssl_connector = SslConnectorBuilder::new(SslMethod::tls()).unwrap().build();
let ssl_connector = TlsConnector::builder().unwrap().build().unwrap();
let mut imap_socket = Client::secure_connect(socket_addr, domain, ssl_connector).unwrap();
imap_socket.login("username", "password").unwrap();