All Projects → jonhoo → Rust Imap

jonhoo / Rust Imap

Licence: other
IMAP client library for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rust Imap

Vmime
VMime Mail Library
Stars: ✭ 218 (-8.02%)
Mutual labels:  library, email, imap
Mail
Mail app designed for elementary OS
Stars: ✭ 130 (-45.15%)
Mutual labels:  email, imap
Mailspring
💌 A beautiful, fast and fully open source mail client for Mac, Windows and Linux.
Stars: ✭ 11,953 (+4943.46%)
Mutual labels:  email, imap
Mailu
Insular email distribution - mail server as Docker images
Stars: ✭ 3,151 (+1229.54%)
Mutual labels:  email, imap
Imapcopy
Recursively copy all e-mail messages and folders from one IMAP account to another.
Stars: ✭ 52 (-78.06%)
Mutual labels:  email, imap
Inbrief
InBrief is a personal briefing app and dashboard powered by Electron and React
Stars: ✭ 90 (-62.03%)
Mutual labels:  email, imap
Mattermail
Email Integration for Mattermost
Stars: ✭ 145 (-38.82%)
Mutual labels:  email, imap
Imap
Object-oriented, fully tested PHP IMAP library
Stars: ✭ 678 (+186.08%)
Mutual labels:  email, imap
Mailio
mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols. It is based on standard C++ 17 and Boost library.
Stars: ✭ 166 (-29.96%)
Mutual labels:  library, imap
Imap tools
Work with email and mailbox by IMAP
Stars: ✭ 167 (-29.54%)
Mutual labels:  email, imap
Emailintentbuilder
An Android Library for the creation of SendTo Intents with mailto: URI
Stars: ✭ 168 (-29.11%)
Mutual labels:  library, email
How to get emails imap tutorial
How to get emails including there attachments and how to extract various attributes from those emails. See https://youtu.be/zFEEGkvo6O8 for a more detailed information.
Stars: ✭ 30 (-87.34%)
Mutual labels:  email, imap
Nioimapclient
High performance, async IMAP client implementation
Stars: ✭ 28 (-88.19%)
Mutual labels:  email, imap
Opaquemail
.NET email library and proxy supporting IMAP, POP3, and SMTP with S/MIME and PGP.
Stars: ✭ 91 (-61.6%)
Mutual labels:  email, imap
Kanmail
📥 An email client that functions like a kanban board.
Stars: ✭ 833 (+251.48%)
Mutual labels:  email, imap
Magma
The magma server daemon, is an encrypted email system with support for SMTP, POP, IMAP, HTTP and MOLTEN,. Additional support for DMTP and DMAP is currently in active development.
Stars: ✭ 1,740 (+634.18%)
Mutual labels:  email, imap
Sieve
Sieve Script Editor
Stars: ✭ 452 (+90.72%)
Mutual labels:  email, imap
Deltachat Desktop
Email-based instant messaging for Desktop.
Stars: ✭ 526 (+121.94%)
Mutual labels:  email, imap
Mnm
The legitimate email replacement — n-identity, decentralized, store-and-forward, open protocol, open source. (Server)
Stars: ✭ 162 (-31.65%)
Mutual labels:  email, imap
Lumail
A console-based mail-client with integrated Lua scripting support.
Stars: ✭ 187 (-21.1%)
Mutual labels:  email, imap

imap

Crates.io Documentation Crate License Build Status Cirrus CI Build Status Codecov Dependency status

This crate lets you connect to and interact with servers that implement the IMAP protocol (RFC 3501 and various extensions). After authenticating with the server, IMAP lets you list, fetch, and search for e-mails, as well as monitor mailboxes for changes. It supports at least the latest three stable Rust releases (possibly even older ones; check the CI results).

This crate is looking for maintainers — reach out to @jonhoo if you're interested.

To connect, use the [connect] function. This gives you an unauthenticated [Client]. You can then use [Client::login] or [Client::authenticate] to perform username/password or challenge/response authentication respectively. This in turn gives you an authenticated [Session], which lets you access the mailboxes at the server.

The documentation within this crate borrows heavily from the various RFCs, but should not be considered a complete reference. If anything is unclear, follow the links to the RFCs embedded in the documentation for the various types and methods and read the raw text there!

Below is a basic client example. See the examples/ directory for more.

extern crate imap;
extern crate native_tls;

fn fetch_inbox_top() -> imap::error::Result<Option<String>> {
    let domain = "imap.example.com";
    let tls = native_tls::TlsConnector::builder().build().unwrap();

    // we pass in the domain twice to check that the server's TLS
    // certificate is valid for the domain we're connecting to.
    let client = imap::connect((domain, 993), domain, &tls).unwrap();

    // the client we have here is unauthenticated.
    // to do anything useful with the e-mails, we need to log in
    let mut imap_session = client
        .login("[email protected]", "password")
        .map_err(|e| e.0)?;

    // we want to fetch the first email in the INBOX mailbox
    imap_session.select("INBOX")?;

    // fetch message number 1 in this mailbox, along with its RFC822 field.
    // RFC 822 dictates the format of the body of e-mails
    let messages = imap_session.fetch("1", "RFC822")?;
    let message = if let Some(m) = messages.iter().next() {
        m
    } else {
        return Ok(None);
    };

    // extract the message's body
    let body = message.body().expect("message did not have a body!");
    let body = std::str::from_utf8(body)
        .expect("message was not valid utf-8")
        .to_string();

    // be nice to the server and log out
    imap_session.logout()?;

    Ok(Some(body))
}

Opting out of native_tls

For situations where using openssl becomes problematic, you can disable the default feature which provides integration with the native_tls crate. One major reason you might want to do this is cross-compiling. To opt out of native_tls, add this to your Cargo.toml file:

[dependencies.imap]
version = "<some version>"
default-features = false

Even without native_tls, you can still use TLS by leveraging the pure Rust rustls crate. See the example/rustls.rs file for a working example.

Running the test suite

To run the integration tests, you need to have GreenMail running. The easiest way to do that is with Docker:

$ docker pull greenmail/standalone:1.6.2
$ docker run -t -i -e GREENMAIL_OPTS='-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose' -p 3025:3025 -p 3110:3110 -p 3143:3143 -p 3465:3465 -p 3993:3993 -p 3995:3995 greenmail/standalone:1.6.2

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].