1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! # rusmes-core — Mailet Processing Engine for RusMES
//!
//! `rusmes-core` is the central mail-processing library for [RusMES], providing a composable
//! pipeline of *matchers* and *mailets* that evaluate and transform incoming mail messages.
//! It is modelled after the Apache James mailet API but implemented from scratch in async Rust.
//!
//! ## Architecture
//!
//! Mail processing flows through a [`Processor`] that applies a sequence of
//! [`ProcessingStep`]s. Each step pairs a [`Matcher`] (decides *whether* to act) with a
//! [`Mailet`] (decides *what* to do).
//!
//! ```text
//! ┌─────────┐ ┌───────────────────────────────────────────────────┐
//! │ Mail │────▶│ Processor │
//! └─────────┘ │ Step 1: Matcher → Mailet (e.g. SpfCheck) │
//! │ Step 2: Matcher → Mailet (e.g. DkimVerify) │
//! │ Step 3: Matcher → Mailet (e.g. SieveMailet) │
//! │ Step N: … │
//! └───────────────────────────────────────────────────┘
//! ```
//!
//! ## Included Mailets
//!
//! | Mailet | Purpose |
//! |--------|---------|
//! | [`mailets::AddHeaderMailet`] | Append arbitrary headers |
//! | [`mailets::BounceMailet`] | RFC 3464 DSN bounce generation |
//! | [`mailets::DkimVerifyMailet`] | DKIM signature verification (RFC 6376) |
//! | [`mailets::DmarcVerifyMailet`] | DMARC policy enforcement (RFC 7489) |
//! | [`mailets::DnsblMailet`] | DNS-based block-list lookups |
//! | [`mailets::ForwardMailet`] | Forwarding with loop detection |
//! | [`mailets::GreylistMailet`] | Greylisting anti-spam |
//! | [`mailets::LegalisMailet`] | Legal archiving with RFC 3161 timestamps |
//! | [`mailets::LocalDeliveryMailet`] | Local mailbox delivery |
//! | `mailets::OxifyMailet` | AI-powered mail enrichment |
//! | [`mailets::RemoteDeliveryMailet`] | SMTP relay delivery (Pure Rust / rustls) |
//! | [`mailets::RemoveMimeHeaderMailet`] | Strip MIME headers by pattern |
//! | [`mailets::SieveMailet`] | RFC 5228 Sieve script filtering |
//! | [`mailets::SpamAssassinMailet`] | SpamAssassin integration |
//! | [`mailets::SpfCheckMailet`] | SPF policy checking (RFC 7208) |
//! | [`mailets::VirusScanMailet`] | ClamAV / virus-scan integration |
//!
//! ## Included Matchers
//!
//! | Matcher | Purpose |
//! |---------|---------|
//! | `CompositeAll` / `CompositeAny` | Boolean composition of other matchers |
//! | `HasAttachment` | True when mail has MIME attachments |
//! | `HeaderContains` | True when a header contains a substring |
//! | `IsInBlacklist` | Sender/recipient on a configurable deny-list |
//! | `IsInWhitelist` | Sender/recipient on a configurable allow-list |
//! | `RecipientIsLocal` | True when recipient is a local domain |
//! | `RemoteAddress` | True when client IP matches a CIDR range |
//! | `SenderIs` | Exact or wildcard sender address match |
//! | `SizeGreaterThan` | True when message exceeds a byte threshold |
//!
//! ## Protocol Support
//!
//! - **SMTP** – mail reception and relay (`rusmes-smtp`)
//! - **IMAP4** – mail access (`rusmes-imap`)
//! - **JMAP** – JSON Meta Application Protocol (`rusmes-jmap`)
//! - **POP3** – legacy mail retrieval (`rusmes-pop3`)
//!
//! ## Feature Flags
//!
//! This crate currently has no optional feature flags; all components are always compiled.
//!
//! ## Quick-start Example
//!
//! ```rust,no_run
//! use rusmes_core::{Processor, ProcessingStep};
//! use rusmes_proto::MailState;
//! use std::sync::Arc;
//!
//! # async fn build_processor() {
//! // Build a basic processor that evaluates mail in the Root state
//! let mut processor = Processor::new("transport", MailState::Root);
//!
//! // Steps are (matcher, mailet) pairs; add them via add_step(ProcessingStep::new(…))
//! // See individual mailet and matcher types in the rusmes_core::mailets /
//! // rusmes_core::matchers modules for concrete implementations.
//! # }
//! ```
//!
//! [RusMES]: https://github.com/cool-japan/rusmes
pub use generate_bounce;
pub use ;
pub use Matcher;
pub use ;
pub use ;
pub use ;
pub use MailProcessorRouter;
pub use ;
pub use ;