{"id":13637030,"url":"https://github.com/stalwartlabs/mail-send","last_synced_at":"2025-05-14T19:09:50.896Z","repository":{"id":39614192,"uuid":"496908840","full_name":"stalwartlabs/mail-send","owner":"stalwartlabs","description":"E-mail delivery library for Rust with DKIM support","archived":false,"fork":false,"pushed_at":"2025-05-11T14:48:10.000Z","size":131,"stargazers_count":234,"open_issues_count":13,"forks_count":23,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-11T15:02:18.727Z","etag":null,"topics":["delivery","dkim","email","mail","mime","rust","send","smtp"],"latest_commit_sha":null,"homepage":"https://docs.rs/mail-send/","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/stalwartlabs.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},"funding":{"open_collective":"stalwart","github":"stalwartlabs","ko_fi":null,"patreon":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-05-27T07:55:13.000Z","updated_at":"2025-05-11T14:47:19.000Z","dependencies_parsed_at":"2024-05-05T15:29:19.656Z","dependency_job_id":"21dc45e9-dda9-4b5d-b01c-4a636a65a5e1","html_url":"https://github.com/stalwartlabs/mail-send","commit_stats":{"total_commits":51,"total_committers":4,"mean_commits":12.75,"dds":"0.11764705882352944","last_synced_commit":"f4d58ebf16e0ea6083cfd2d482114ad8ae201c35"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stalwartlabs%2Fmail-send","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stalwartlabs%2Fmail-send/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stalwartlabs%2Fmail-send/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stalwartlabs%2Fmail-send/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stalwartlabs","download_url":"https://codeload.github.com/stalwartlabs/mail-send/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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":["delivery","dkim","email","mail","mime","rust","send","smtp"],"created_at":"2024-08-02T00:01:09.462Z","updated_at":"2025-05-14T19:09:50.145Z","avatar_url":"https://github.com/stalwartlabs.png","language":"Rust","funding_links":["https://opencollective.com/stalwart","https://github.com/sponsors/stalwartlabs"],"categories":["Libraries","库 Libraries"],"sub_categories":["Email","电子邮件 Email"],"readme":"# mail-send\n\n[![crates.io](https://img.shields.io/crates/v/mail-send)](https://crates.io/crates/mail-send)\n[![build](https://github.com/stalwartlabs/mail-send/actions/workflows/rust.yml/badge.svg)](https://github.com/stalwartlabs/mail-send/actions/workflows/rust.yml)\n[![docs.rs](https://img.shields.io/docsrs/mail-send)](https://docs.rs/mail-send)\n[![crates.io](https://img.shields.io/crates/l/mail-send)](http://www.apache.org/licenses/LICENSE-2.0)\n\n_mail-send_ is a Rust library to build, sign and send e-mail messages via SMTP. It includes the following features:\n\n- Generates **e-mail** messages conforming to the Internet Message Format standard (_RFC 5322_).\n- Full **MIME** support (_RFC 2045 - 2049_) with automatic selection of the most optimal encoding for each message body part.\n- DomainKeys Identified Mail (**DKIM**) Signatures (_RFC 6376_) with ED25519-SHA256, RSA-SHA256 and RSA-SHA1 support.\n- Simple Mail Transfer Protocol (**SMTP**; _RFC 5321_) delivery.\n- SMTP Service Extension for Secure SMTP over **TLS** (_RFC 3207_).\n- SMTP Service Extension for Authentication (_RFC 4954_) with automatic mechanism negotiation (from most secure to least secure):\n  - CRAM-MD5 (_RFC 2195_)\n  - DIGEST-MD5 (_RFC 2831_; obsolete but still supported)\n  - XOAUTH2 (Google proprietary)\n  - LOGIN\n  - PLAIN\n- Full async (requires Tokio).\n\n## Usage Example\n\nSend a message via an SMTP server that requires authentication:\n\n```rust\n    // Build a simple multipart message\n    let message = MessageBuilder::new()\n        .from((\"John Doe\", \"john@example.com\"))\n        .to(vec![\n            (\"Jane Doe\", \"jane@example.com\"),\n            (\"James Smith\", \"james@test.com\"),\n        ])\n        .subject(\"Hi!\")\n        .html_body(\"\u003ch1\u003eHello, world!\u003c/h1\u003e\")\n        .text_body(\"Hello world!\");\n\n    // Connect to the SMTP submissions port, upgrade to TLS and\n    // authenticate using the provided credentials.\n    SmtpClientBuilder::new(\"smtp.gmail.com\", 587)\n        .implicit_tls(false)\n        .credentials((\"john\", \"p4ssw0rd\"))\n        .connect()\n        .await\n        .unwrap()\n        .send(message)\n        .await\n        .unwrap();\n```\n\nSign a message with DKIM and send it via an SMTP relay server:\n\n```rust\n    // Build a simple text message with a single attachment\n    let message = MessageBuilder::new()\n        .from((\"John Doe\", \"john@example.com\"))\n        .to(\"jane@example.com\")\n        .subject(\"Howdy!\")\n        .text_body(\"These pretzels are making me thirsty.\")\n        .attachment(\"image/png\", \"pretzels.png\", [1, 2, 3, 4].as_ref());\n\n    // Sign an e-mail message using RSA-SHA256\n    let pk_rsa = RsaKey::\u003cSha256\u003e::from_rsa_pem(TEST_KEY).unwrap();\n    let signer = DkimSigner::from_key(pk_rsa)\n        .domain(\"example.com\")\n        .selector(\"default\")\n        .headers([\"From\", \"To\", \"Subject\"])\n        .expiration(60 * 60 * 7); // Number of seconds before this signature expires (optional)\n\n    // Connect to an SMTP relay server over TLS.\n    // Signs each message with the configured DKIM signer.\n    SmtpClientBuilder::new(\"smtp.gmail.com\", 465)\n        .connect()\n        .await\n        .unwrap()\n        .send_signed(message, \u0026signer)\n        .await\n        .unwrap();\n```\n\nMore examples of how to build messages are available in the [`mail-builder`](https://crates.io/crates/mail-builder) crate.\nPlease note that this library does not support parsing e-mail messages as this functionality is provided separately by the [`mail-parser`](https://crates.io/crates/mail-parser) crate.\n\n## Testing\n\nTo run the testsuite:\n\n```bash\n $ cargo test --all-features\n```\n\nor, to run the testsuite with MIRI:\n\n```bash\n $ cargo +nightly miri test --all-features\n```\n\n## License\n\nLicensed under either of\n\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)\n\nat your option.\n\n## Copyright\n\nCopyright (C) 2020-2022, Stalwart Labs Ltd.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstalwartlabs%2Fmail-send","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstalwartlabs%2Fmail-send","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstalwartlabs%2Fmail-send/lists"}