1.0.0 • Published 7 months ago

@piksail/strapi-provider-email-mailpit v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@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 --save

Configuration

VariableTypeDescriptionRequiredDefault
providerstringThe name of the provider you useyes
providerOptionsobjectProvider optionsyes
providerOptions.baseUrlobjectMailpit urlnohttp://localhost:8025
settingsobjectSettings (See Mailpit API Doc)no{}
settings.defaultFromstringDefault sender mail addressnoundefined
settings.defaultReplyTostringDefault replyTo mail addressnoundefined
settings.verbosestringPrint detailled logs. Does not print Authorization header. Use with caution, might leak sensitive data in logsnofalse

: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

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.

1.0.0

7 months ago

0.0.1

7 months ago