Skip to main content

EmailLog Model

The EmailLog model tracks all transactional email sends for audit and debugging.

Table: email_logs
Model: App\Models\EmailLog

Database Schema

ColumnTypeNullableDescription
idbigint unsignedNoPrimary key
correlation_idstringYesRequest correlation ID
providerstringYesEmail provider (mailgun, mailjet, etc.)
driverstringYesMail driver
from_emailstringYesSender address
to_emailstringYesRecipient address
subjectstringYesEmail subject
statusstringNoqueued, sent, delivered, bounced, failed
provider_message_idstringYesProvider tracking ID
error_messagetextYesFailure reason
metadataJSONYesProvider response metadata
sent_atdatetimeYesWhen sent
created_atdatetimeNo
updated_atdatetimeNo

Constants

EmailLog::STATUS_QUEUED
EmailLog::STATUS_SENT
EmailLog::STATUS_DELIVERED
EmailLog::STATUS_BOUNCED
EmailLog::STATUS_FAILED

Scopes

EmailLog::successful()
EmailLog::failed()
EmailLog::forProvider($provider)
EmailLog::forCorrelation($correlationId)
EmailLog::recent($days = 7)

Usage Notes

  • Email logs are not scoped by organization; they are platform-wide.
  • Status updates are written by the transactional email service.