After every successful email send, Laravel Maily dispatches aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/yugo412/laravel-maily/llms.txt
Use this file to discover all available pages before exploring further.
MailySentEvent. Register a listener to act on the Maily API response — log delivery IDs, track quota, feed analytics pipelines, or notify administrators. Because the event is fired only after the API returns a successful response, you can rely on it as a confirmation that Maily has accepted the message for delivery.
Event properties
MailySentEvent exposes four readonly constructor properties populated directly from the Maily API response:
The unique delivery ID returned by the Maily API. Store this value if you need to correlate log entries or database records with a specific send.
The delivery status returned by the API at the time of acceptance — for example,
queued. This reflects the initial state; the message may transition through further states on the Maily side after this point.A human-readable message from the Maily API response, such as
"Email queued for delivery". Useful for logging and debugging.The full raw JSON response body returned by the Maily API, decoded as a PHP array. This includes
id, status, and message as well as any additional fields the API may return in the future.Registering a listener
Register your listener againstMailySentEvent in App\Providers\EventServiceProvider (Laravel 10 and earlier) or in the withEvents call inside bootstrap/app.php (Laravel 11+):
Example listener
The listener below logs the full Maily response at thedebug level every time an email is accepted:
handle method to suit your application’s needs — the four event properties give you everything returned by the API.
Common use cases
Quota monitoring
Quota monitoring
Persist the
$event->data payload (or just the id and status fields) to a database table or cache counter. Because the event fires once per accepted message, incrementing a counter in the listener gives you an accurate running total of sends without polling the Maily API.Debugging
Debugging
In local or staging environments, dump the full
data array to your log for inspection. This is the fastest way to verify that the API is receiving the fields you expect.Admin dashboards
Admin dashboards
Store the delivery
id and status in your database alongside the relevant record (for example, an Order or User). You can then surface this information in an admin panel to confirm that transactional emails were dispatched correctly.