{"id":13439218,"url":"https://github.com/staktrace/mailparse","last_synced_at":"2025-05-16T03:05:11.183Z","repository":{"id":8844052,"uuid":"59927945","full_name":"staktrace/mailparse","owner":"staktrace","description":"Rust library to parse mail files","archived":false,"fork":false,"pushed_at":"2025-02-27T23:24:50.000Z","size":988,"stargazers_count":197,"open_issues_count":2,"forks_count":41,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-08T15:05:59.751Z","etag":null,"topics":["email","mail","mailparser","parser","rust","rust-library"],"latest_commit_sha":null,"homepage":"https://docs.rs/mailparse/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/staktrace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2016-05-29T05:29:16.000Z","updated_at":"2025-05-06T18:59:57.000Z","dependencies_parsed_at":"2024-01-17T04:52:44.004Z","dependency_job_id":"ca6155f7-fc57-48dc-80e8-381f55be5a1f","html_url":"https://github.com/staktrace/mailparse","commit_stats":{"total_commits":263,"total_committers":26,"mean_commits":"10.115384615384615","dds":0.55893536121673,"last_synced_commit":"693535d1f12576c48c79e52a74f289e9e520a70a"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staktrace%2Fmailparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staktrace%2Fmailparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staktrace%2Fmailparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staktrace%2Fmailparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staktrace","download_url":"https://codeload.github.com/staktrace/mailparse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"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":["email","mail","mailparser","parser","rust","rust-library"],"created_at":"2024-07-31T03:01:12.051Z","updated_at":"2025-05-16T03:05:06.175Z","avatar_url":"https://github.com/staktrace.png","language":"Rust","readme":"mailparse\n===\n![Build Status](https://github.com/staktrace/mailparse/actions/workflows/test.yml/badge.svg)\n[![Crate](https://img.shields.io/crates/v/mailparse.svg)](https://crates.io/crates/mailparse)\n\nA simple parser for MIME email messages.\n\nAPI\n---\nThe primary entry point for this library is the following function:\n\n```rust\n    parse_mail(\u0026[u8]) -\u003e Result\u003cParsedMail, MailParseError\u003e\n```\n\nThis function takes the raw message data, including headers and body, and returns a structured object to more easily access pieces of the email message.\nThere are other public functions that allow parsing smaller parts of the message as well; refer to the [full documentation](https://docs.rs/mailparse/).\n\nThe library is designed to process real-world email data such as might be obtained by using the FETCH command on an IMAP server, or in a Maildir.\nAs such, this library should successfully handle any valid MIME-formatted message, although it may not follow all the strict requirements in the various specifications that cover the format (predominantly IETF RFCs 822, 2045, 2047, 2822, and 5322).\nAs an example, this library accepts raw message data which uses \\n (ASCII LF) as line delimiters rather than the RFC-mandated \\r\\n (ASCII CRLF) line delimiters.\n\nExample usage\n---\n\n```rust\n    use mailparse::*;\n    let parsed = parse_mail(concat!(\n            \"Subject: This is a test email\\n\",\n            \"Content-Type: multipart/alternative; boundary=foobar\\n\",\n            \"Date: Sun, 02 Oct 2016 07:06:22 -0700 (PDT)\\n\",\n            \"\\n\",\n            \"--foobar\\n\",\n            \"Content-Type: text/plain; charset=utf-8\\n\",\n            \"Content-Transfer-Encoding: quoted-printable\\n\",\n            \"\\n\",\n            \"This is the plaintext version, in utf-8. Proof by Euro: =E2=82=AC\\n\",\n            \"--foobar\\n\",\n            \"Content-Type: text/html\\n\",\n            \"Content-Transfer-Encoding: base64\\n\",\n            \"\\n\",\n            \"PGh0bWw+PGJvZHk+VGhpcyBpcyB0aGUgPGI+SFRNTDwvYj4gdmVyc2lvbiwgaW4g \\n\",\n            \"dXMtYXNjaWkuIFByb29mIGJ5IEV1cm86ICZldXJvOzwvYm9keT48L2h0bWw+Cg== \\n\",\n            \"--foobar--\\n\",\n            \"After the final boundary stuff gets ignored.\\n\").as_bytes())\n        .unwrap();\n    assert_eq!(parsed.headers.get_first_value(\"Subject\"),\n        Some(\"This is a test email\".to_string()));\n    assert_eq!(parsed.subparts.len(), 2);\n    assert_eq!(parsed.subparts[0].get_body().unwrap(),\n        \"This is the plaintext version, in utf-8. Proof by Euro: \\u{20AC}\");\n    assert_eq!(parsed.subparts[1].headers[1].get_value(), \"base64\");\n    assert_eq!(parsed.subparts[1].ctype.mimetype, \"text/html\");\n    assert!(parsed.subparts[1].get_body().unwrap().starts_with(\"\u003chtml\u003e\"));\n    assert_eq!(dateparse(parsed.headers.get_first_value(\"Date\").unwrap().as_str()).unwrap(), 1475417182);\n```\n\nDocumentation\n---\nSee the rustdoc at [docs.rs](https://docs.rs/mailparse/).\n\nMSRV policy\n---\nCurrently the minimum supported Rust version (MSRV) is 1.51.0.\nMSRV increases will be kept to a minimum, and will always be accompanied with a minor version bump.\n\nSupport mailparse\n---\nIf you want to support development of `mailparse`, please do so by donating your money, time, and/or energy to fighting climate change.\nA quick and easy way is to send a donation to [Replant.ca Environmental](http://www.replant-environmental.ca/donate.html), where every dollar gets a tree planted!\n","funding_links":[],"categories":["Libraries","库 Libraries","Code","库","Rust"],"sub_categories":["Email","电子邮件 Email","Library","电子邮件","邮件 Email"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaktrace%2Fmailparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaktrace%2Fmailparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaktrace%2Fmailparse/lists"}