npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strapi-provider-email-mailjet

v4.0.0

Published

Strapi Email service provider for Mailjet

Downloads

859

Readme

strapi-provider-email-mailjet

Strapi email service for Mailjet

Prerequisites

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

Installation

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

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

Configuration

| Variable | Type | Description | Required | Default | | ---------------------------- | ------ | --------------------------------------------------------------------------------------------- | -------- | --------- | | provider | string | The name of the provider you use | yes | | | providerOptions | object | Provider options | yes | | | providerOptions.publicApiKey | string | Mailjet public API key. See your MailJet API keys | yes | | | providerOptions.secretApiKey | string | Mailjet secret API key. See your MailJet API keys | yes | | | settings | object | Settings | no | {} | | settings.defaultFrom | string | Default sender mail address | yes | undefined | | settings.defaultFromName | string | Default sender name | yes | undefined | | settings.defaultTo | string | Default receiver mail address | yes | undefined | | settings.defaultToName | string | Default receiver name | yes | undefined |

Example config file

Path - config/plugins.js

module.exports = ({ env }) => ({
  // ...
  email: {
    config: {
      provider: "strapi-provider-email-mailjet",
        providerOptions: {
          publicApiKey: env("MAILJET_PUBLIC_KEY"),
          secretApiKey: env("MAILJET_SECRET_KEY"),
        },
        settings: {
          defaultFrom: "[email protected]",
          defaultFromName: "Scott from iJS.to",
          defaultTo: "[email protected]",
          defaultToName: "Johnny Bravodoe",
        },
      },
      // ...
    }
});

API

Strapi Mailjet Plugin enables you to interact with Mailjet API via custom methods listed below.

This API is a subset of the MailJet API.

Sending API

You can easily send emails via

Usage example

Single recipient

await strapi.plugins.email.services.email.send({
  to: "[email protected]",
  toName: "Scott Agirs",
  subject: "👋 Hey there!",
  text: `Text version of your email`,
  html: `<html />`,
});

Multiple recipients

Note taht toName is not used here, instead it's added to each recipient object of the array.

await strapi.plugins.email.services.email.send({
  to: [
    { email: "[email protected]", toName: "Scott Agirs" },
    { email: "[email protected]", toName: "🦄" },
  ],
  subject: "👋 Hey y'all!",
  text: `Text version of your email`,
  html: `<html />`,
});

Custom Methods

You can request additional actions by submitting a Feature Request or a Pull Request.

Usage example

Note: To access the custom methods API, you need to call it vai strapi.plugins.email.provider.CUSTOM_METHOD and NOT strapi.plugins.email.services.email.CUSTOM_METHOD

await strapi.plugins.email.provider
  .addContactToList({
    id: "[email protected]",
    listId: "mailingListId",
  })
  .catch((error) => console.log(error))
  .then((response) => console.log(response));

addContactToList

| Field | Type | Description | Required | Default | | ------ | ------ | ------------------------------------ | -------- | ------- | | listId | String | MailJet List ID to which add contact | yes | | | id | String | Contact's email or MailJet ID | yes | |

createContact

| Field | Type | Description | Required | Default | | ----- | ------ | ------------------------ | -------- | ------- | | email | String | Contact's email | yes | | | name | String | Full name of the contact | no | |

updateContact

| Field | Type | Description | Required | Default | | ----- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- | | data | object | Contact Metadata. API Reference | yes | | | id | String | Contact's email or MailJet ID | yes | |

createContactList

| Field | Type | Description | Required | Default | | ----- | ------ | ------------------------ | -------- | ------- | | name | String | Name of the contact list | yes | |

removeContactFromList

| Field | Type | Description | Required | Default | | ------ | ------ | -------------------------------------------- | -------- | ------- | | listId | String | MailJet List ID from which to remove contact | yes | | | id | String | Contact's email or MailJet ID | yes | |

retrieveContact

| Field | Type | Description | Required | Default | | --------- | ------ | ----------------------------- | -------- | ------- | | contactId | String | Contact's email or MailJet ID | yes | |

subscribeContactToList

Use this to re-subscribe existing contact.

| Field | Type | Description | Required | Default | | ------ | ------ | ------------------------------------------------- | -------- | ------- | | listId | String | MailJet List ID to which to subscribe the contact | yes | | | id | String | Contact's email or MailJet ID | yes | |

unsubscribeContactFromList

| Field | Type | Description | Required | Default | | ------ | ------ | ------------------------------------------------- | -------- | ------- | | listId | String | MailJet List ID from which to unsubscribe contact | yes | | | id | String | Contact's email or MailJet ID | yes | |


Licence

Credits

Authors: Scott Agirs

Initially published by sboutet06