Mailpit
Mailpit SMTP testing tool provider
@piksail/strapi-provider-email-mailpit
Strapi email provider for Mailpit
Installation
# using yarn
yarn add @piksail/strapi-provider-email-mailpit
# using npm
npm install @piksail/strapi-provider-email-mailpit --saveConfiguration
| Variable | Type | Description | Required | Default |
|---|---|---|---|---|
| provider | string | The name of the provider you use | yes | |
| providerOptions | object | Provider options | yes | |
| providerOptions.baseUrl | object | Mailpit url | no | http://localhost:8025 |
| settings | object | Settings (See Mailpit API Doc) | no | {} |
| settings.defaultFrom | string | Default sender mail address | no | undefined |
| settings.defaultReplyTo | string | Default replyTo mail address | no | undefined |
| settings.verbose | string | Print detailled logs. Does not print Authorization header. Use with caution, might leak sensitive data in logs | no | false |
:warning: The Shipper Email (or defaultfrom) may also need to be changed in the
Email Templatestab on the admin panel for emails to send properly
Example
Path - config/plugins.js
1module.exports = ({ env }) => ({
2 // ...
3 email: {
4 config: {
5 provider: "@piksail/strapi-provider-email-mailpit",
6 providerOptions: {
7 baseUrl: env("MAILPIT_BASE_URL"), // default to http://localhost:8025. Must not contain any path, ex: https://mailpit.example.com
8 },
9 settings: {
10 verbose: false, // Use with caution, might leak sensitive data in logs
11 defaultFrom: { email: "john@example.com", name: "John" },
12 defaultReplyTo: [{ email: "noreply@example.com", name: "NoReply" }], // Some options require an array containing objects with email and name. Refer to https://mailpit.axllent.org/docs/api-v1/view.html#post-/api/v1/send
13 headers: {
14 Authorization:
15 "Basic " +
16 Buffer.from(
17 `${env("MAILPIT_USERNAME")}:${env("MAILPIT_PASSWORD")}`
18 ).toString("base64"),
19 },
20 },
21 },
22 },
23 // ...
24});Troubleshoot
Turn on verbose for easier debugging.
Couldn't send test email: Unknown route. Check your baseUrl setting, it should look like this: https://mailpit.example.com.
Install now
npm install @piksail/strapi-provider-email-mailpit
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.