Add Mailtrap email transport#27873
Open
tsokolovs wants to merge 4 commits into
Open
Conversation
2 tasks
Author
|
I've used an AI agent to create a PR for me (via the gh cli) to make it easier for me to ensure I've fulfilled all the guidelines outlined in contributing.md file. The code itself was written manually. Happy to answer all the questions you have. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27873 +/- ##
=======================================
Coverage 68.42% 68.43%
=======================================
Files 2381 2381
Lines 164253 164270 +17
Branches 15209 15212 +3
=======================================
+ Hits 112392 112411 +19
+ Misses 51861 51859 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
tsokolovs
force-pushed
the
feat/mailtrap-email-transport
branch
from
July 20, 2026 07:23
18c73ed to
23ab361
Compare
Add a native `mailtrap` option for `EMAIL_TRANSPORT` using Mailtrap's official nodemailer transport. Supports live sending, the bulk stream, and the sandbox testing inbox via EMAIL_MAILTRAP_TOKEN, EMAIL_MAILTRAP_SANDBOX, EMAIL_MAILTRAP_INBOX_ID, and EMAIL_MAILTRAP_BULK.
Re-import getMailer in the Mailtrap test so the module-scoped transporter cache doesn't short-circuit the new branch, ensuring it actually executes under coverage.
tsokolovs
force-pushed
the
feat/mailtrap-email-transport
branch
from
July 21, 2026 06:39
23ab361 to
adeb5aa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's Changed
Adds Mailtrap as a native option for
EMAIL_TRANSPORT, alongside the existingsendmail,smtp,ses, andmailguntransports. It uses Mailtrap's officialmailtrappackage, which ships a Nodemailer transport (MailtrapTransport).The transport supports all three Mailtrap modes:
Implementation mirrors the existing Mailgun transport in
api/src/mailer.ts(lazyrequire, env-driven options). Options are only passed to the SDK when their env vars are set.New environment variables
EMAIL_MAILTRAP_TOKENEMAIL_MAILTRAP_SANDBOXEMAIL_MAILTRAP_INBOX_IDEMAIL_MAILTRAP_BULKTested Scenarios
api/src/mailer.test.tspasses (5/5),@directus/envpasses (78/78).EMAIL_MAILTRAP_BULK=true, all succeeded.Review Notes / Questions / Concerns
mailtrapdependency pulls inaxios, which dedupesqsto6.15.2in the lockfile. This is the only transitive change beyond the direct addition.Checklist
@directus/specs)@directus/sdk) updated to reflect the changes@directus/types) updated to reflect the changes@directus/system-data) updated for changes to system collections/fields/relations