UNPKG

@piksail/strapi-provider-email-mailpit

Version:
65 lines (51 loc) 3.29 kB
# @piksail/strapi-provider-email-mailpit Strapi email provider for [Mailpit](https://mailpit.axllent.org/) ## Installation ```bash # using yarn yarn add @piksail/strapi-provider-email-mailpit # using npm npm install @piksail/strapi-provider-email-mailpit --save ``` ## Configuration | 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](https://mailpit.axllent.org/docs/api-v1/view.html#post-/api/v1/send)) | 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 Templates` tab on the admin panel for emails to send properly ### Example **Path -** `config/plugins.js` ```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: "john@example.com", name: "John" }, 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 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>.