Skip to content

Add Mailtrap inbound email support - #145

Open
tsokolovs wants to merge 1 commit into
beyondcode:masterfrom
tsokolovs:add-mailtrap-driver
Open

tsokolovs wants to merge 1 commit into
beyondcode:masterfrom
tsokolovs:add-mailtrap-driver

Conversation

@tsokolovs

Copy link
Copy Markdown

Mailtrap sends message identifiers in inbound notifications, so Laravel Mailbox must retrieve the original email before it can call handlers.
This change adds a built-in mailtrap driver with signature authentication, message retrieval, and setup documentation.
It preserves PHP 8.1 and Laravel 10–13 support.

The driver creates one job per message.
Applications can process messages immediately or use a persistent background queue.
Shared cache locks prevent overlapping processing, and completion records suppress repeat processing for 24 hours.
A failed event does not prevent the driver from attempting the other valid events in its batch.
Application handlers still need protection against repeated actions after a partial failure or cache loss.

All 13 supported PHP/Laravel combinations passed 240 tests and 827 assertions each.
Separate tests passed for real HTTPS redirects, interrupted downloads, timeouts, and two concurrent queue workers.
A fresh Laravel 13 app also passed configuration and route caching.
Legacy Laravel 10/11 test installations required isolated framework advisory exceptions, with audit reporting retained.
No advisory exception changes the package or its workflow.

Live Mailtrap delivery preserved text, HTML, and an attachment with an identical SHA256.
An actual reply retained its In-Reply-To and References headers.
A locally signed batch of four duplicate notifications caused no extra download or handler call.
A controlled handler failure recovered through the database queue on attempt two after 301 seconds, using real Mailtrap downloads.
The raw download requests carried no API authorization or cookie header.
A locally signed notification for a real message in a second inbox was ignored before download.
A mixed batch queued only the two valid primary messages and caused no extra handler call.
Batch and filter tests used locally signed notifications. Mailtrap's own batching and notification retry schedule were not tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant