Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.02 KB

README.md

File metadata and controls

38 lines (26 loc) · 1.02 KB

License

typed-imap

A typesafe client library for the IMAP protocol.

Currently in the fledgling stages. Entirely not working, no stable API.

Example

extern crate typed_imap;

use typed_imap::client::*;
use typed_imap::connection::IMAPConnection;

fn main() {
    let client = {
        let conn = IMAPConnection::new_tls("outlook.office365.com", 993).unwrap();
        NotAuthenticated::new(conn).unwrap()
    };

    let client = client.login("username", "passwd").unwrap();

    let mut client = client.select("inbox").unwrap();

    // We need to act on the mailbox in a new scope to prevent a situation where
    // a client has a mailbox but moves to a new state.
    {
        let mut mailbox = client.borrow_mailbox();
        let emails = mailbox.fetch("2:4", "BODY").unwrap();
    }

    client.logout();
}

See examples/ for more.