From 7d270815da46da220eb5b5e238844e4fed12976a Mon Sep 17 00:00:00 2001 From: baalajimaestro Date: Thu, 17 Jun 2021 11:08:17 +0000 Subject: [PATCH] Inline with 3.0 IMAP changes Signed-off-by: baalajimaestro --- Cargo.lock | 1 - Cargo.toml | 1 - src/main.rs | 6 ++---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e69ce1d..3ce7f97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,7 +190,6 @@ version = "0.1.0" dependencies = [ "base64", "imap", - "native-tls", "regex", "rustls-connector", ] diff --git a/Cargo.toml b/Cargo.toml index 23f482f..e609661 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ edition = "2018" [dependencies] imap = "3.0.0-alpha.4" -native-tls = "0.2.7" base64 = "0.13.0" regex = "1.5.4" rustls-connector = "0.13.1" diff --git a/src/main.rs b/src/main.rs index 6e188d1..c213a22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,6 @@ // use imap; -use native_tls; use regex::Regex; fn main() { @@ -18,12 +17,11 @@ fn main() { fn fetch_inbox_top() -> imap::error::Result> { let domain = "imap.mail.com"; - let tls = native_tls::TlsConnector::builder().build().unwrap(); - let client = imap::connect((domain, 993), domain, &tls).unwrap(); + let client = imap::ClientBuilder::new(domain, 993).native_tls()?; let mut imap_session = client .login("mail username", "mail pwd") .map_err(|e| e.0)?; - let inbox = imap_session.select("Spam")?; + let inbox = imap_session.select("Inbox")?; for i in 1 as u32..inbox.exists { let messages = imap_session.fetch( (inbox.exists-i).to_string(), "RFC822")?;