0.1.0 • Published 1 year ago

@palmabit/strapi-provider-email-mandrill v0.1.0

Weekly downloads
-
License
NO LICENSE
Repository
-
Last release
1 year ago

@palmabit/strapi-provider-email-mandrill

Links

Installation

# using yarn
yarn add @palmabit/strapi-provider-email-mandrill

# using npm
npm install @palmabit/strapi-provider-email-mandrill --save

Example

Path - config/plugins.js

module.exports = ({ env }) => ({
  // ...
  email: {
    config: {
      provider: '@palmabit/strapi-provider-email-mandrill',
      providerOptions: {
        auth: {
          apiKey: env('MANDRILL_KEY', ''),
        },
        // ... any custom options
      },
      settings: {
        defaultFrom: 'hello@example.com',
        defaultReplyTo: 'hello@example.com',
      },
    },
  },
  // ...
});

Development mode

You can override the default configurations for specific environments. E.g. for NODE_ENV=development in config/env/development/plugins.js:

Usage

: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

To send an email from anywhere inside Strapi:

await strapi
  .plugin('email')
  .service('email')
  .send({
    to: 'someone@example.com',
    from: 'someone2@example.com',
    subject: 'Hello world',
    text: 'Hello world',
    html: `<h4>Hello world</h4>`,
  });

The following fields are supported:

FieldDescription
fromEmail address of the sender
toComma separated list or an array of recipients
replyToEmail address to which replies are sent
ccComma separated list or an array of recipients
bccComma separated list or an array of recipients
subjectSubject of the email
textPlaintext version of the message
htmlHTML version of the message
attachmentsArray of objects See: https://nodemailer.com/message/attachments/