4.0.1 • Published 1 year ago

strapi-provider-email-postmark v4.0.1

Weekly downloads
362
License
MIT
Repository
github
Last release
1 year ago

strapi-provider-email-postmark

Strapi email service for Postmark

Prerequisites

You will need to have the plugin strapi-plugin-email installed in you Strapi project.

Installation

# using yarn
yarn add strapi-provider-email-postmark

# using npm
npm i strapi-provider-email-postmark

Configuration

VariableTypeDescriptionRequiredDefault
providerstringThe name of the provider you useyes
providerOptionsobjectProvider optionsyes
providerOptions.apiKeystringPostmark API key. Please refer to postmark docs for moreyes
settingsobjectSettingsno{}
settings.defaultMessageStreamstringSend through a specific message stream. Please refer to postmark docs for morenoundefined
settings.defaultFromstringDefault sender mail addressnoundefined
settings.defaultTostringDefault receiver mail addressnoundefined
settings.defaultReplyTostringDefault address the receiver is asked to reply tonoundefined
settings.defaultVariablesobjectDefault set of variables to be used in template emailsno{}

Example

Path - config/plugins.js

module.exports = ({ env }) => ({
  // ...
  email: {
    config: {
      provider: "strapi-provider-email-postmark",
      providerOptions: {
        apiKey: "your-postmark-api-key",
      },
      settings: {
        defaultMessageStream: "my-stream",
        defaultFrom: "john.doe@ijs.to",
        defaultTo: "john.doe@ijs.to",
        defaultReplyTo: "code@ijs.to",
        defaultVariables: {
          sentBy: 'strapi',
        },
      },
    }
  },
  // ...
});

IMPORTANT: With Strapi v4, you have to set email.config.provider to "strapi-provider-email-postmark", instead of "postmark". This is intended in Strapi v4: https://github.com/strapi/strapi/issues/11879.

Additionally, the structure of plugins.js has changed:

  • In v3: "email": {"provider": "", ...}
  • In v4: "email": {"config": {"provider": "", ...}}

Usage

Call the send function on the email service, as you would for any strapi email service.

await strapi.plugins.email.services.email.send({
  to: "john.doe@ijs.to",
  text: "Hello John"
});

To send an email via a template, set templateId or templateAlias (and variables) to use the sendEmailWithTemplate method.

await strapi.plugins.email.services.email.send({
  to: "john.doe@ijs.to",
  templateAlias: "code-your-own",
  variables: {
    name: "John"
  }
});

Licence

4.0.1

1 year ago

4.0.0

1 year ago

3.5.1

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.1.0

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago