> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/engineering-reference/db/tables/tbl_email_logs.md).

# tbl\_email\_logs

{% hint style="info" %}
Generated from the staging database schema, with descriptions drafted by agents ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/db/tables/tbl_email_logs.md).
{% endhint %}

## Description

One Amazon SES event for one outgoing email; apipy's communication log writes it.

<details>

<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE `tbl_email_logs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT (uuid()),
  `sent_at` datetime DEFAULT NULL COMMENT 'When SES accepted the email (UTC)',
  `delivered_at` datetime DEFAULT NULL COMMENT 'When delivered/bounced/complained (UTC)',
  `recipient` varchar(320) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Primary recipient email',
  `subject` varchar(998) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email subject line',
  `from_email` varchar(320) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Sender email address',
  `from_domain` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Sender domain',
  `message_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'SES message identifier',
  `event_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Send, Delivery, Bounce, Complaint, Reject, Open, Click',
  `status_detail` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'SMTP response, bounce type, or complaint feedback',
  `processing_time_ms` int unsigned DEFAULT NULL COMMENT 'SES delivery processing time in ms',
  `recipient_isp` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Recipient mail provider',
  `source_ip` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'IP that called the SES API',
  `outgoing_ip` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'SES server IP that sent the email',
  `sender_identity` varchar(320) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Verified identity used to send',
  `sent_by_iam` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'IAM user/role that made the API call',
  `operation` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'SendEmail, SendRawEmail, etc.',
  `all_recipients` text COLLATE utf8mb4_unicode_ci COMMENT 'All recipients comma-separated',
  `fCreatedts` bigint unsigned NOT NULL DEFAULT ((unix_timestamp(now(3)) * 1000)) COMMENT 'Record creation epoch ms',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_uuid` (`uuid`),
  UNIQUE KEY `uk_message_id_event` (`message_id`,`event_type`),
  KEY `idx_sent_at` (`sent_at`),
  KEY `idx_recipient` (`recipient`),
  KEY `idx_from_email` (`from_email`),
  KEY `idx_event_type` (`event_type`),
  KEY `idx_from_domain` (`from_domain`),
  KEY `idx_fCreatedts` (`fCreatedts`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
```

</details>

## Columns

| Name                 | Type            | Default                           | Nullable | Extra Definition   | Comment                                                                                                              |
| -------------------- | --------------- | --------------------------------- | -------- | ------------------ | -------------------------------------------------------------------------------------------------------------------- |
| id                   | bigint unsigned |                                   | false    | auto\_increment    |                                                                                                                      |
| uuid                 | char(36)        | uuid()                            | false    | DEFAULT\_GENERATED |                                                                                                                      |
| sent\_at             | datetime        |                                   | true     |                    | When SES accepted the email (UTC)                                                                                    |
| delivered\_at        | datetime        |                                   | true     |                    | When delivered/bounced/complained (UTC)                                                                              |
| recipient            | varchar(320)    |                                   | false    |                    | Primary recipient email                                                                                              |
| subject              | varchar(998)    |                                   | true     |                    | Email subject line                                                                                                   |
| from\_email          | varchar(320)    |                                   | false    |                    | Sender email address                                                                                                 |
| from\_domain         | varchar(255)    |                                   | true     |                    | Sender domain                                                                                                        |
| message\_id          | varchar(255)    |                                   | false    |                    | SES message ID; unique together with event\_type.                                                                    |
| event\_type          | varchar(20)     |                                   | false    |                    | Send, Delivery, Open, Click, Bounce, DeliveryDelay or Complaint on staging (the database comment also lists Reject). |
| status\_detail       | varchar(500)    |                                   | true     |                    | SMTP response, bounce type, or complaint feedback                                                                    |
| processing\_time\_ms | int unsigned    |                                   | true     |                    | SES delivery processing time in ms                                                                                   |
| recipient\_isp       | varchar(100)    |                                   | true     |                    | Recipient mail provider                                                                                              |
| source\_ip           | varchar(45)     |                                   | true     |                    | IP that called the SES API                                                                                           |
| outgoing\_ip         | varchar(45)     |                                   | true     |                    | SES server IP that sent the email                                                                                    |
| sender\_identity     | varchar(320)    |                                   | true     |                    | Verified identity used to send                                                                                       |
| sent\_by\_iam        | varchar(100)    |                                   | true     |                    | IAM user/role that made the API call                                                                                 |
| operation            | varchar(50)     |                                   | true     |                    | SendEmail, SendRawEmail, etc.                                                                                        |
| all\_recipients      | text            |                                   | true     |                    | All recipients comma-separated                                                                                       |
| fCreatedts           | bigint unsigned | (unix\_timestamp(now(3)) \* 1000) | false    | DEFAULT\_GENERATED | Record creation epoch ms                                                                                             |

## Viewpoints

| Name                                                                                      | Definition                                                                                                     |
| ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| [notifications](https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-15.md) | Push device tokens, reminders, notification settings, email and SMS logs, in-app surveys and marketing popups. |

## Constraints

| Name                   | Type        | Definition                                                   |
| ---------------------- | ----------- | ------------------------------------------------------------ |
| PRIMARY                | PRIMARY KEY | PRIMARY KEY (id)                                             |
| uk\_message\_id\_event | UNIQUE      | UNIQUE KEY uk\_message\_id\_event (message\_id, event\_type) |
| uk\_uuid               | UNIQUE      | UNIQUE KEY uk\_uuid (uuid)                                   |

## Indexes

| Name                   | Definition                                                               |
| ---------------------- | ------------------------------------------------------------------------ |
| idx\_event\_type       | KEY idx\_event\_type (event\_type) USING BTREE                           |
| idx\_fCreatedts        | KEY idx\_fCreatedts (fCreatedts) USING BTREE                             |
| idx\_from\_domain      | KEY idx\_from\_domain (from\_domain) USING BTREE                         |
| idx\_from\_email       | KEY idx\_from\_email (from\_email) USING BTREE                           |
| idx\_recipient         | KEY idx\_recipient (recipient) USING BTREE                               |
| idx\_sent\_at          | KEY idx\_sent\_at (sent\_at) USING BTREE                                 |
| PRIMARY                | PRIMARY KEY (id) USING BTREE                                             |
| uk\_message\_id\_event | UNIQUE KEY uk\_message\_id\_event (message\_id, event\_type) USING BTREE |
| uk\_uuid               | UNIQUE KEY uk\_uuid (uuid) USING BTREE                                   |

## Relations

```mermaid
erDiagram


"tbl_email_logs" {
  bigint_unsigned id PK
}
```

***

> Generated by [tbls](https://github.com/k1LoW/tbls)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/engineering-reference/db/tables/tbl_email_logs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
