Skip to main content

Crate email_extract

Crate email_extract 

Source
Expand description

Intelligent email parsing with structured type extraction.

Built on top of mailparse, this library parses raw email bytes into strongly-typed structures with automatic entity extraction.

§Features

  • Strong typing for all email components
  • Automatic entity extraction (emails, phones, URLs, names, companies, monetary amounts, social handles)
  • Thread analysis (reply depth, references, in-reply-to)
  • Spam indicator detection and scoring
  • Signature block separation
  • HTML-to-text fallback for HTML-only emails

§Example

use email_extract::{Email, parse_email};

let raw = b"From: alice@example.com\r\nSubject: Hello\r\n\r\nCall me at 555-1234";
let email = parse_email(1, raw).unwrap();

assert_eq!(email.from.address, "alice@example.com");
assert_eq!(email.subject.original, "Hello");
assert!(!email.extracted.phone_numbers.is_empty());

Structs§

AuthenticationResults
Email authentication results
Body
Email body content
CategoryHint
Category hint for email classification
Email
A fully parsed email with extracted entities and metadata
EmailAddress
Email address with optional display name
EmailMetadata
Email metadata and analysis results
ExtractedEmail
Extracted email address
ExtractedEntities
All entities extracted from email content
ExtractedUrl
Extracted URL with analysis
Headers
Email headers
MessageId
Message ID wrapper type
MonetaryAmount
Monetary amount
PersonName
Parsed person name
PhoneNumber
Phone number with type detection
SocialHandle
Social media handle
SpamIndicator
Spam indicator
Subject
Email subject with analysis
ThreadInfo
Thread information

Enums§

AuthResult
Authentication result status
ParseError
Errors that can occur during email parsing
PhoneType
Type of phone number
Priority
Email priority level
Sentiment
Sentiment analysis result
SocialPlatform
Social media platform
Urgency
Urgency level
UrlType
Type of URL

Functions§

parse_email
Parse raw email bytes into a structured Email

Type Aliases§

Result
Result type for email parsing operations