Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

rust-imap

> 编程语言
Open source

IMAP client library for Rust

580 stars0 likes0 views
WebsiteGitHub

About

IMAP client library for Rust

imap

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 [ClientBuilder]. 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.

…

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:

toml
[dependencies.imap]
version = ""
default-features = false

Even without native_tls, you can still use TLS by leveraging the pure Rust rustls crate, which is enabled with the rustls-tls feature. 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:

bash
$ docker pull greenmail/standalone:1.6.15
$ docker run -it --rm -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.15

Another alternative is to test against cyrus imapd which is a more complete IMAP implementation that greenmail (supporting quotas and ACLs).

$ docker pull outoforder/cyrus-imapd-tester
$ docker run -it --rm -p 3025:25 -p 3110:110 -p 3143:143 -p 3465:465 -p 3993:993 outoforder/cyrus-imapd-tester:latest

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustcrateemailimaplibrary

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言