{"id":13822814,"url":"https://github.com/jonhoo/rust-imap","last_synced_at":"2025-05-13T23:03:57.457Z","repository":{"id":33480268,"uuid":"158763360","full_name":"jonhoo/rust-imap","owner":"jonhoo","description":"IMAP client library for Rust","archived":false,"fork":false,"pushed_at":"2025-04-08T02:08:48.000Z","size":1073,"stargazers_count":518,"open_issues_count":44,"forks_count":88,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-07T09:56:16.819Z","etag":null,"topics":["crate","email","imap","library","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonhoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-11-23T00:49:52.000Z","updated_at":"2025-04-22T12:49:53.000Z","dependencies_parsed_at":"2024-04-21T10:31:41.081Z","dependency_job_id":"0fbdfff7-a137-40ea-a1b3-b24ab5ea7235","html_url":"https://github.com/jonhoo/rust-imap","commit_stats":{"total_commits":634,"total_committers":68,"mean_commits":9.323529411764707,"dds":0.5709779179810726,"last_synced_commit":"a7d22f04867f3d3abddd27fcd1d08f6522c33950"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Frust-imap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Frust-imap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Frust-imap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Frust-imap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonhoo","download_url":"https://codeload.github.com/jonhoo/rust-imap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254040348,"owners_count":22004511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crate","email","imap","library","rust"],"created_at":"2024-08-04T08:02:19.012Z","updated_at":"2025-05-13T23:03:57.392Z","avatar_url":"https://github.com/jonhoo.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# imap\n\n[![Crates.io](https://img.shields.io/crates/v/imap.svg)](https://crates.io/crates/imap)\n[![Documentation](https://docs.rs/imap/badge.svg)](https://docs.rs/imap/)\n[![Crate License](https://img.shields.io/crates/l/imap.svg)](https://crates.io/crates/imap)\n[![codecov](https://codecov.io/gh/jonhoo/rust-imap/graph/badge.svg?token=2cO5sjtmyR)](https://codecov.io/gh/jonhoo/rust-imap)\n[![Dependency status](https://deps.rs/repo/github/jonhoo/rust-imap/status.svg)](https://deps.rs/repo/github/jonhoo/rust-imap)\n\nThis crate lets you connect to and interact with servers that implement the IMAP protocol ([RFC\n3501](https://tools.ietf.org/html/rfc3501) and various extensions). After authenticating with\nthe server, IMAP lets you list, fetch, and search for e-mails, as well as monitor mailboxes for\nchanges. It supports at least the latest three stable Rust releases (possibly even older ones;\ncheck the [CI\nresults](https://dev.azure.com/jonhoo/jonhoo/_build/latest?definitionId=11\u0026branchName=master)).\n\n**This crate is looking for maintainers — reach out to [@jonhoo] if you're interested.**\n\n[@jonhoo]: https://thesquareplanet.com/\n\nTo connect, use the [`ClientBuilder`]. This gives you an unauthenticated [`Client`]. You can\nthen use [`Client::login`] or [`Client::authenticate`] to perform username/password or\nchallenge/response authentication respectively. This in turn gives you an authenticated\n[`Session`], which lets you access the mailboxes at the server.\n\nThe documentation within this crate borrows heavily from the various RFCs, but should not be\nconsidered a complete reference. If anything is unclear, follow the links to the RFCs embedded\nin the documentation for the various types and methods and read the raw text there!\n\nBelow is a basic client example. See the `examples/` directory for more.\n\n```rust\nfn fetch_inbox_top() -\u003e imap::error::Result\u003cOption\u003cString\u003e\u003e {\n\n    let client = imap::ClientBuilder::new(\"imap.example.com\", 993).connect()?;\n\n    // the client we have here is unauthenticated.\n    // to do anything useful with the e-mails, we need to log in\n    let mut imap_session = client\n        .login(\"me@example.com\", \"password\")\n        .map_err(|e| e.0)?;\n\n    // we want to fetch the first email in the INBOX mailbox\n    imap_session.select(\"INBOX\")?;\n\n    // fetch message number 1 in this mailbox, along with its RFC822 field.\n    // RFC 822 dictates the format of the body of e-mails\n    let messages = imap_session.fetch(\"1\", \"RFC822\")?;\n    let message = if let Some(m) = messages.iter().next() {\n        m\n    } else {\n        return Ok(None);\n    };\n\n    // extract the message's body\n    let body = message.body().expect(\"message did not have a body!\");\n    let body = std::str::from_utf8(body)\n        .expect(\"message was not valid utf-8\")\n        .to_string();\n\n    // be nice to the server and log out\n    imap_session.logout()?;\n\n    Ok(Some(body))\n}\n```\n\n### Opting out of `native_tls`\n\nFor situations where using openssl becomes problematic, you can disable the\ndefault feature which provides integration with the `native_tls` crate. One major\nreason you might want to do this is cross-compiling. To opt out of native_tls, add\nthis to your Cargo.toml file:\n\n```toml\n[dependencies.imap]\nversion = \"\u003csome version\u003e\"\ndefault-features = false\n```\n\nEven without `native_tls`, you can still use TLS by leveraging the pure Rust `rustls`\ncrate, which is enabled with the `rustls-tls` feature. See the example/rustls.rs file\nfor a working example.\n\n## Running the test suite\n\nTo run the integration tests, you need to have [GreenMail\nrunning](http://www.icegreen.com/greenmail/#deploy_docker_standalone). The\neasiest way to do that is with Docker:\n\n```console\n$ docker pull greenmail/standalone:1.6.15\n$ 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\n```\n\nAnother alternative is to test against cyrus imapd which is a more complete IMAP implementation that greenmail (supporting quotas and ACLs).\n\n```\n$ docker pull outoforder/cyrus-imapd-tester\n$ docker run -it --rm -p 3025:25 -p 3110:110 -p 3143:143 -p 3465:465 -p 3993:993 outoforder/cyrus-imapd-tester:latest\n```\n\n## License\n\nLicensed under either of\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonhoo%2Frust-imap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonhoo%2Frust-imap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonhoo%2Frust-imap/lists"}