#imap #email


IMAP protocol parser and data structures

24 releases (13 breaking)

0.14.3 Jun 1, 2021
0.14.1 Apr 19, 2021
0.14.0 Mar 14, 2021
0.12.1 Dec 31, 2020
0.2.0 Nov 13, 2017

#7 in Email

Download history 826/week @ 2021-04-07 1055/week @ 2021-04-14 734/week @ 2021-04-21 1039/week @ 2021-04-28 677/week @ 2021-05-05 428/week @ 2021-05-12 416/week @ 2021-05-19 471/week @ 2021-05-26 523/week @ 2021-06-02 585/week @ 2021-06-09 383/week @ 2021-06-16 506/week @ 2021-06-23 446/week @ 2021-06-30 393/week @ 2021-07-07 401/week @ 2021-07-14 519/week @ 2021-07-21

2,762 downloads per month
Used in 12 crates (6 directly)



imap-proto and tokio-imap

Build status Join the chat at https://gitter.im/djc/tokio-imap MIT license Apache License 2.0

All feedback welcome. Feel free to file bugs, requests for documentation and any other feedback to the issue tracker or tweet me.

tokio-imap and imap-proto were created by and are maintained by Dirkjan Ochtman. If you are in a position to support ongoing maintenance and further development or use it in a for-profit context, please consider supporting my open source work on Patreon.

tokio-imap: futures-based IMAP client

crates.io, downloads crates.io, latest release API docs, latest release

A Tokio stack-based, fully asynchronous IMAP library, with strong focus on following the relevant specs, mainly IMAP4rev1, but with limited support for the Conditional STORE extension. The type system is used to help enforce correctness where possible. So far, there is only client code and lots of infrastructure that supposedly could be shared -- no server yet. (If you want a tokio-based server, look at IMAPServer.)

Feature highlights

  • Fully asynchronous by using tokio-core and tokio-io
  • Uses the type system to help enforce correct operation according to spec
  • nom-based parser (in imap-proto), so far only used for server response messages


  • Alpha-level implementation -- no tests yet, limited protocol coverage
  • Server is totally unimplemented at this stage

How to get started

Have a look at the mailsync crate for example usage.

imap-proto: IMAP types and protocol parser

crates.io, downloads crates.io, latest release API docs, latest release

imap-proto is a low-level IMAP protocol support crate, using the type system to provide a safe API. It was extracted from tokio-imap into a separate crate so that different protocol implementations can share it as common infrastructure (as proposed by rust-imap contributors). The code tries to closely follow the IMAP4rev1 RFC, plus extensions.

Protocol support is implemented in three parts:

  • Types that attempt to closely reflect specification requirements
  • A parser implementation to help consume protocol messages
  • Builder types to help produce protocol messages


  • Client
    • Parser: many common server responses implemented
    • Types: most common types implemented
    • Message builder: most common commands implemented
  • Server
    • Parser: not started
    • Types: not started
    • Message builder: not started


~37K SLoC