Reader
mail_intake.ingestion.reader
Summary
High-level mail ingestion orchestration for Mail Intake.
This module provides the primary, provider-agnostic entry point for reading and processing mail data.
It coordinates:
- Mail adapter access.
- Message and thread iteration.
- Header and body parsing.
- Normalization and model construction.
No provider-specific logic or API semantics are permitted in this layer.
Classes
MailIntakeReader
High-level read-only ingestion interface.
Notes
Responsibilities:
1 2 3 4 5 6 7 | |
Constraints:
1 2 | |
Initialize the mail reader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter |
MailIntakeAdapter
|
Mail adapter implementation used to retrieve raw messages and threads from a mail provider. |
required |
Functions
iter_messages
Iterate over parsed messages matching a provider query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query |
str
|
Provider-specific query string used to filter messages. |
required |
Yields:
| Name | Type | Description |
|---|---|---|
MailIntakeMessage |
MailIntakeMessage
|
Fully parsed and normalized |
Raises:
| Type | Description |
|---|---|
MailIntakeParsingError
|
If a message cannot be parsed. |
iter_threads
Iterate over threads constructed from messages matching a query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query |
str
|
Provider-specific query string used to filter messages. |
required |
Yields:
| Name | Type | Description |
|---|---|---|
MailIntakeThread |
MailIntakeThread
|
An iterator of |
Raises:
| Type | Description |
|---|---|
`MailIntakeParsingError`
|
If a message cannot be parsed. |
Notes
Guarantees:
1 2 | |