Skip to main content

email_extract/
lib.rs

1//! Intelligent email parsing with structured type extraction.
2//!
3//! Built on top of [mailparse](https://crates.io/crates/mailparse), this
4//! library parses raw email bytes into strongly-typed structures with
5//! automatic entity extraction.
6//!
7//! # Features
8//!
9//! - Strong typing for all email components
10//! - Automatic entity extraction (emails, phones, URLs, names, companies,
11//!   monetary amounts, social handles)
12//! - Thread analysis (reply depth, references, in-reply-to)
13//! - Spam indicator detection and scoring
14//! - Signature block separation
15//! - HTML-to-text fallback for HTML-only emails
16//!
17//! # Example
18//!
19//! ```rust
20//! use email_extract::{Email, parse_email};
21//!
22//! let raw = b"From: alice@example.com\r\nSubject: Hello\r\n\r\nCall me at 555-1234";
23//! let email = parse_email(1, raw).unwrap();
24//!
25//! assert_eq!(email.from.address, "alice@example.com");
26//! assert_eq!(email.subject.original, "Hello");
27//! assert!(!email.extracted.phone_numbers.is_empty());
28//! ```
29
30mod error;
31mod extracted;
32mod parser;
33mod types;
34
35pub use error::{ParseError, Result};
36pub use extracted::*;
37pub use parser::parse_email;
38pub use types::*;