Email repository (central MSSQL)#
Purpose: Ingest auto-response emails for the pipeline (Step 1 in main.py).
Code: src/auto_responder/services/email_repository.py
Configuration#
| Setting | Notes |
|---|---|
EMAIL_REPOSITORY_CONNECTION_STRING | Required for a real repository (unless you only run dry-run with mocks). |
default_max_email_results | Cap on rows returned (bounded in code to a safe maximum). |
default_date_range_days | Lookback window for ReceivedDate. |
email_pull_start_date, email_pull_end_date | Optional explicit UTC bounds. When both are set, they override default_date_range_days. |
email_repository_query_timeout_seconds | Command/query timeout for the SELECT. |
Data store touch#
| Operation | When | What |
|---|---|---|
| SELECT | Every run that uses EmailRepository | SELECT TOP (?) … FROM emails WITH (NOLOCK) with ReceivedDate range, body keyword filters (e.g. out-of-office style phrases), ordered by ReceivedDate |
Columns read: Id, AccountName, Subject, Body, SenderEmail, ReceivedDate, InsertedDateTime.
The database name is whatever your connection string targets; the pipeline assumes an emails table in that database.
Writes#
None. The connector only reads. It does not INSERT, UPDATE, or mark rows processed.
Dry-run behavior#
- Default:
MockEmailRepositoryreturns fixtures (no SQL). - If
dry_run_use_real_email_repository=true, the real repository is used even in dry-run mode.
Downstream use#
AccountNamebecomesinbox_sourceonAutoResponseEmail; used later for SFMC suppression list mapping (account → data extension key).
Related#
- sfmc.html — uses
inbox_source/ account name for suppression routing. - graph-outlook.html — optional Graph-based ingestion (not the default
main.pypath)