Inline with 3.0 IMAP changes

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2021-06-17 11:08:17 +00:00
parent d6c6910b02
commit 7d270815da
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
3 changed files with 2 additions and 6 deletions

1
Cargo.lock generated
View file

@ -190,7 +190,6 @@ version = "0.1.0"
dependencies = [
"base64",
"imap",
"native-tls",
"regex",
"rustls-connector",
]

View file

@ -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"

View file

@ -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<Option<String>> {
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")?;