Data Model: Email
Purpose: The Email entity is an immutable audit record of every email sent from the platform. It provides a permanent, verifiable log of all outbound communications for compliance, customer support, and dispute resolution.
Fields/Attributes
| Name | Type | Description | Validation Rules |
|---|---|---|---|
id | Unique Identifier | The primary internal system ID for the email record. | • Required • System-generated |
recipient_email | The email address of the recipient. | • Required | |
recipient_name | Foreign Key | A reference to the recipient User account, if available. | • Nullable |
status | Choice | The delivery status of the email. | • Required • See Email Status Lifecycle. |
template | Text | The name of the template used to generate the email (e.g., user:welcome). | • Required |
subject | Text | The subject line of the email that was sent. | • Required |
contentbody | Rich Text | The final, rendered HTML content of the email exactly as the user received it. | • Required |
content_data | JSON | The JSON data payload that was used to populate the dynamic fields in the email template. | • Required |
delivery_log | Text | Technical logs from the email sending service, useful for debugging. | • Optional |
sent_attemp_at | Timestamp | The exact timestamp of the last delivery attempt. | • Nullable |
created_at | Timestamp | The timestamp when the email was generated and queued for sending. | • Read-only |
Key Relationships
User: An
Emailis sent to a recipient who is typically a registered User (a many-to-one relationship).Triggering Event (Polymorphic): An
Emailcan be linked to the specific business object that triggered it (e.g., an Investment, a Profile), providing a full audit trail.
Auditing & Event History
Every significant action or change made to an Email is recorded as an immutable entry in a system-wide EventLog. This creates a complete and tamper-proof audit trail for compliance and operational tracking.