common_reports.schemas.emails.context
EmailContext — the per-account defaults the engine layers onto each message.
A message (contracts/emails/EmailMessage) carries WHAT to send; the context
carries the account-level WHO/HOW that’s the same across messages:
from_addr the From address (defaults to the SMTP/Gmail login user)from_name an optional display name for Fromreply_to a default Reply-To, when the message doesn't set onesignature_html HTML appended to every body (e.g. an Origin Edge sign-off)default_recipients the fallback To list when a send specifies none — mirrors AlgoReports' ``recipients.yaml`` default list, but supplied by config, not hardcodedextra_headers headers stamped on every message (e.g. List-Unsubscribe)attachment_note HTML part appended after file attachments (the AlgoReports "download the attachments" note by default; None disables)This is a mutable config object (defaults get tuned at runtime), unlike the
frozen message contract. The engine (emails/base.py) merges it onto each
:class:EmailMessage before handing the result to a provider.
Classes
EmailContext
Bases: BaseModel
Account-level send defaults merged onto each outbound message.
Fields and properties declared here; inherited members belong to the bases above.
attachment_note
attachment_note: Optional[str] = Field(default=ATTACHMENT_TRAILER_HTML, description='HTML part appended after file attachments; None disables it')default_recipients
default_recipients: list[str] = Field(default_factory=list, description='Fallback To list when a send specifies no recipients')extra_headers
extra_headers: dict[str, str] = Field(default_factory=dict, description='Headers stamped on every message')from_addr
from_addr: Optional[str] = Field(default=None, description='From address (falls back to the login user)')from_name
from_name: Optional[str] = Field(default=None, description='From display name')reply_to
reply_to: Optional[str] = Field(default=None, description='Default Reply-To address')signature_html
signature_html: Optional[str] = Field(default=None, description='HTML appended to every message body')apply_signature
def apply_signature(html: str) -> strAppend the signature HTML to a body, if one is configured.
resolve_from
def resolve_from(login_user: str) -> strThe effective From: explicit from_addr else the transport login user.
Types and values
ATTACHMENT_NOTE_SLOT
ATTACHMENT_NOTE_SLOT = ('<!--nc:attachment-note-->', '<!--/nc:attachment-note-->')ATTACHMENT_TRAILER_HTML
ATTACHMENT_TRAILER_HTML = '<h2>The interactive HTML Performance Reports have been attached. Please DOWNLOAD the attachments and open them in a web browser to ensure full functionality.</h2>'