Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ijsto/strapi-provider-email-mailjet

Strapi Email service provider for Mailjet
https://github.com/ijsto/strapi-provider-email-mailjet

Last synced: 10 days ago
JSON representation

Strapi Email service provider for Mailjet

Awesome Lists containing this project

README

        

# strapi-provider-email-mailjet

[Strapi](http://strapi.io/) email service for [Mailjet](https://mailjet.com/)

# 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](https://app.mailjet.com/account/api_keys) | yes | |
| providerOptions.secretApiKey | string | Mailjet secret API key. See your [MailJet API keys](https://app.mailjet.com/account/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`

```javascript
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](https://dev.mailjet.com/email/reference/).

## Sending API

You can easily send emails via

### Usage example

**Single recipient**

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