Skip to content

# Message

## `` mail_intake.models.message

### Summary

Message domain models for Mail Intake.

This module defines the canonical, provider-agnostic representation of an individual email message as used internally by the Mail Intake ingestion pipeline.

Models in this module are safe to persist and must not contain any provider-specific fields or semantics.

### Classes

#### `` MailIntakeMessage `dataclass`

    1

    MailIntakeMessage(message_id: str, thread_id: str, timestamp: datetime, from_email: str, from_name: Optional[str], subject: str, body_text: str, snippet: str, raw_headers: Dict[str, str])

Canonical internal representation of a single email message.

Notes

Guarantees:

    1
    2
    3

    - This model represents a fully parsed and normalized email message.
    - It is intentionally provider-agnostic and suitable for
      persistence, indexing, and downstream processing.

Constraints:

    1
    2

    - No provider-specific identifiers, payloads, or API semantics
      should appear in this model.

##### Attributes

###### `` body_text `instance-attribute`

    1

    body_text: str

Extracted plain-text body content of the message.

###### `` from_email `instance-attribute`

    1

    from_email: str

Sender email address.

###### `` from_name `instance-attribute`

    1

    from_name: Optional[str]

Optional human-readable sender name.

###### `` message_id `instance-attribute`

    1

    message_id: str

Provider-specific message identifier.

###### `` raw_headers `instance-attribute`

    1

    raw_headers: Dict[str, str]

Normalized mapping of message headers (header name → value).

###### `` snippet `instance-attribute`

    1

    snippet: str

Short provider-supplied preview snippet of the message.

###### `` subject `instance-attribute`

    1

    subject: str

Raw subject line of the message.

###### `` thread_id `instance-attribute`

    1

    thread_id: str

Provider-specific thread identifier to which this message belongs.

###### `` timestamp `instance-attribute`

    1

    timestamp: datetime

Message timestamp as a timezone-naive UTC datetime.