Skip to content

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

NameTypeDescriptionValidation Rules
idUnique IdentifierThe primary internal system ID for the email record.• Required • System-generated
recipient_emailEmailThe email address of the recipient.• Required
recipient_nameForeign KeyA reference to the recipient User account, if available.• Nullable
statusChoiceThe delivery status of the email.• Required • See Email Status Lifecycle.
templateTextThe name of the template used to generate the email (e.g., user:welcome).• Required
subjectTextThe subject line of the email that was sent.• Required
contentbodyRich TextThe final, rendered HTML content of the email exactly as the user received it.• Required
content_dataJSONThe JSON data payload that was used to populate the dynamic fields in the email template.• Required
delivery_logTextTechnical logs from the email sending service, useful for debugging.• Optional
sent_attemp_atTimestampThe exact timestamp of the last delivery attempt.• Nullable
created_atTimestampThe timestamp when the email was generated and queued for sending.• Read-only

Key Relationships

  • User: An Email is sent to a recipient who is typically a registered User (a many-to-one relationship).

  • Triggering Event (Polymorphic): An Email can 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.