SMTP Senpai
Directus Flow operation: send email with SMTP Senpai by MailSenpai, the EU SMTP relay and email API.
directus-extension-smtp-senpai
Directus Flow operation "Send with SMTP Senpai": send transactional emails from your Flows through SMTP Senpai, the EU SMTP relay and email API by MailSenpai.
- Sandboxed API extension: installable from the Directus Marketplace without changing
MARKETPLACE_TRUST - Network access limited to
https://app.mailsenpai.com/relay/v1/* - Up to 50 recipients per email (each one gets their own copy), HTML and/or text body, Reply-To, custom
X-headers, idempotency key - The result (
sent,message_ids,results,remaining) is added to the Flow data chain
Requires Directus 10.10 or later.
Prerequisites
- An SMTP Senpai account with a verified sending domain
- An API key (
msp_…) from the MailSenpai customer area, SMTP Senpai page
Install
Marketplace: in the Data Studio open Settings → Marketplace, search for "SMTP Senpai" and install.
npm (self-hosted):
npm install directus-extension-smtp-senpai
or copy the package into your extensions folder, then restart Directus.
Use
- Create or open a Flow (Settings → Flows).
- Add an operation and choose Send with SMTP Senpai.
- Fill in the options:
| option | required | notes |
|---|---|---|
| API key | yes | msp_…. To keep it out of the Flow settings use {{$env.SMTP_SENPAI_API_KEY}} and add SMTP_SENPAI_API_KEY to FLOWS_ENV_ALLOW_LIST |
| To | yes | one or more addresses; templates such as {{$trigger.payload.email}} work |
| From | yes | address on a verified domain, or Name <address> |
| From name | no | sender display name |
| Reply-To | no | |
| Idempotency key | no | e.g. order-{{$trigger.key}}: the same key within 24 hours is never sent twice |
| Subject | yes | |
| HTML body / Text body | at least one | the text part is derived from the HTML when missing |
| Custom headers | no | JSON object, only X- headers are kept |
The operation follows the resolve path with:
{
"sent": 1,
"not_sent": 0,
"message_ids": ["9f2c4e1a7b3d5f6e8a9b0c1d@yourdomain.com"],
"results": [{ "to": "customer@example.com", "sent": true, "message_id": "9f2c…@yourdomain.com" }],
"remaining": 8759,
"replayed": false
}
A recipient on the SMTP Senpai suppression list is not emailed: it appears with "sent": false and a reason. API errors (invalid key, unverified sender domain, volume used up…) follow the reject path with the message returned by the API.
Attachments are not supported in this operation (the sandbox cannot read files); use the REST API or the SDK @mailsenpai/smtp-senpai in a custom extension for that.
Links
- SMTP Senpai: https://en.mailsenpai.com/smtp-senpai/
- API documentation: https://en.mailsenpai.com/smtp-api/
- All MailSenpai integrations: https://en.mailsenpai.com/integrations/
- Source code and issues: https://gitlab.com/smtp-senpai/mailsenpai-js/-/tree/main/directus-extension-smtp-senpai
- Support: https://en.mailsenpai.com/contact-us/
License
MIT © MailSenpai