@piksail/strapi-provider-email-mailpit
v1.0.0
Published
Mailpit provider for strapi email
Readme
@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
module.exports = ({ env }) => ({
// ...
email: {
config: {
provider: "@piksail/strapi-provider-email-mailpit",
providerOptions: {
baseUrl: env("MAILPIT_BASE_URL"), // default to http://localhost:8025. Must not contain any path, ex: https://mailpit.example.com
},
settings: {
verbose: false, // Use with caution, might leak sensitive data in logs
defaultFrom: { email: "[email protected]", name: "John" },
defaultReplyTo: [{ email: "[email protected]", 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
headers: {
Authorization:
"Basic " +
Buffer.from(
`${env("MAILPIT_USERNAME")}:${env("MAILPIT_PASSWORD")}`
).toString("base64"),
},
},
},
},
// ...
});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.
