All Projects → alexzaganelli → strapi-plugin-email-designer

alexzaganelli / strapi-plugin-email-designer

Licence: MIT License
Design your own email templates w/ visual composer directly inside the Strapi admin panel and send composed emails programmatically from your controllers / services.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to strapi-plugin-email-designer

gmail-gitlab-filtering
Google Apps Script for Gmail to filter and sort email from GitLab
Stars: ✭ 84 (-58.21%)
Mutual labels:  email
email-framework
A simple, gulp powered framework to develop and test responsive emails.
Stars: ✭ 19 (-90.55%)
Mutual labels:  email
is-email-disposable
A REST API for checking if an e-mail address is disposable (a.k.a. throwaway). https://isemaildisposable.webgazer.io
Stars: ✭ 33 (-83.58%)
Mutual labels:  email
rss2email
Convert RSS feeds to emails
Stars: ✭ 72 (-64.18%)
Mutual labels:  email
smtp-translator
An SMTP server that converts emails into Pushover notifications.
Stars: ✭ 23 (-88.56%)
Mutual labels:  email
dispatch
A self-hosted mail forwarding API microservice
Stars: ✭ 24 (-88.06%)
Mutual labels:  email
maildog
🐶 Hosting your own email forwarding service on AWS and managing it with Github Actions
Stars: ✭ 381 (+89.55%)
Mutual labels:  email
checkdmarc
A parser for SPF and DMARC DNS records
Stars: ✭ 124 (-38.31%)
Mutual labels:  email
mailx
A lightweight SMTP mail library
Stars: ✭ 17 (-91.54%)
Mutual labels:  email
MAQS
Magenic's automation quick start
Stars: ✭ 46 (-77.11%)
Mutual labels:  email
go-simple-mail
Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.
Stars: ✭ 298 (+48.26%)
Mutual labels:  email
mailauth
Command line utility and a Node.js library for email authentication
Stars: ✭ 57 (-71.64%)
Mutual labels:  email
wp-mail-catcher
A fast, lightweight plugin that saves emails sent by your WordPress website.
Stars: ✭ 16 (-92.04%)
Mutual labels:  email
camunda-bpm-mail
Mail connectors for Camunda Platform 7
Stars: ✭ 64 (-68.16%)
Mutual labels:  email
strapi-plugin-react-editorjs
📝 Plugin for Strapi Headless CMS, hiding the standard WYSIWYG editor on Editor.js
Stars: ✭ 67 (-66.67%)
Mutual labels:  strapi
nuxt-mail
Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Stars: ✭ 62 (-69.15%)
Mutual labels:  email
mailmask
Mailmask - easy stop unwanted email. Unlimited, free temporary email addresses, all forwarding to your real email address. Beat spam, protect your privacy.
Stars: ✭ 31 (-84.58%)
Mutual labels:  email
strapi-firebase-auth
Learn how to implement firebase authentication into strapi.
Stars: ✭ 25 (-87.56%)
Mutual labels:  strapi
yggmail
End-to-end encrypted email for the mesh networking age
Stars: ✭ 72 (-64.18%)
Mutual labels:  email
go-html-email
Sending HTML email using Go 💌
Stars: ✭ 31 (-84.58%)
Mutual labels:  email

Strapi Email Designer plugin 💅

NPM Version Monthly download on NPM code style: prettier PRs welcome! License Follow Alex Zaganelli Repo stars Contributors

Design your own email templates directly from the Strapi CMS admin panel and use the magic to send programmatically email from your controllers / services.

Designer screenshot

Visual composer provided by Unlayer

 

⚙️ Versions

  • Strapi v4 - (current) - v2.x
  • Strapi v3 - v1.x

 

Installation

Install Strapi with this Quickstart command to create a Strapi project instantly:

# with yarn
yarn create strapi-app my-project --quickstart

# with npm/npx
npx create-strapi-app my-project --quickstart

This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload). The Quickstart command installs Strapi using a SQLite database which is used for prototyping in development.

yarn add strapi-plugin-email-designer@latest

# or

npm i -S strapi-plugin-email-designer@latest
  • you may need also to add to the unlayer domain to the Content Security Policy. Update the config file config/middlewares.js as:
// ...
- "strapi::security",
+ {
+     name: "strapi::security",
+     config: {
+       contentSecurityPolicy: {
+         directives: {
+           "script-src": ["'self'", "editor.unlayer.com"],
+           "frame-src": ["'self'", "editor.unlayer.com"],
+           "img-src": [
+             "'self'",
+             "data:",
+             "cdn.jsdelivr.net",
+             "strapi.io",
+             "s3.amazonaws.com",
+           ],
+         },
+       },
+     },
+   },
// ...
  • After successful installation you've to build a fresh package that includes plugin UI. To archive that simply use:
yarn build && yarn develop

# or

npm run build && npm run develop
  • or just run Strapi in the development mode with --watch-admin option:
yarn develop --watch-admin

#or

npm run develop --watch-admin

The Email Designer plugin should appear in the Plugins section of Strapi sidebar after you run app again.

💄 Usage

  1. Design your template with easy on the visual composer. For variables use lodash templating language with the double curly braces tags ( {{ and }} ). You can leave the text version blank to automatically generate a text version of your email from the HTML version.

Tips: in the template's body is possible to iterate array like this:

{{ _.forEach(order.products, function(product) { }}
	<li>{{- product.name }}</li>
	<li>{{- product.price }}</li>
{{ }); }}
  1. Send email programmatically:
{
  // ...

  try {
    await strapi
      .plugin('email-designer')
      .service('email')
      .sendTemplatedEmail(
        {
          // required
          to: '[email protected]',

          // optional if /config/plugins.js -> email.settings.defaultFrom is set
          from: '[email protected]',

          // optional if /config/plugins.js -> email.settings.defaultReplyTo is set
          replyTo: '[email protected]',

          // optional array of files
          attachments: [],
        },
        {
          // required - Ref ID defined in the template designer (won't change on import)
          templateReferenceId: 9,

          // If provided here will override the template's subject.
          // Can include variables like `Thank you for your order {{= USER.firstName }}!`
          subject: `Thank you for your order`,
        },
        {
          // this object must include all variables you're using in your email template
          USER: {
            firstname: 'John',
            lastname: 'Doe',
          },
          order: {
            products: [
              { name: 'Article 1', price: 9.99 },
              { name: 'Article 2', price: 5.55 },
            ],
          },
          shippingCost: 5,
          total: 20.54,
        }
      );
  } catch (err) {
    strapi.log.debug('📺: ', err);
    return ctx.badRequest(null, err);
  }

  // ...
}

Enjoy 🎉

🖐 Requirements

Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under Installation Requirements.

Supported Strapi versions:

  • Strapi v4.0.x

(This plugin may work with the older Strapi versions, but these are not tested nor officially supported at this time.)

Node / NPM versions:

  • NodeJS >= 12.10 < 17
  • NPM >= 6.x

We recommend always using the latest version of Strapi to start your new projects.

🔧 Configuration

You can pass configuration options directly to the editor that is used by this plugin. To do so, in your config/plugins.js file of your project, configure the plugin like this example:

module.exports = ({ env }) => ({
  // ...
  'email-designer': {
    enabled: true,

    // ⬇︎ Add the config property
    config: {
      editor: {
        // optional - if you have a premium unlayer account
        projectId: [UNLAYER_PROJECT_ID],

        tools: {
          heading: {
            properties: {
              text: {
                value: 'This is the new default text!',
              },
            },
          },
        },
        options: {
          features: {
            colorPicker: {
              presets: ['#D9E3F0', '#F47373', '#697689', '#37D67A'],
            },
          },
          fonts: {
            showDefaultFonts: false,
            /*
             * If you want use a custom font you need a premium unlayer account and pass a projectId number :-(
             */
            customFonts: [
              {
                label: 'Anton',
                value: "'Anton', sans-serif",
                url: 'https://fonts.googleapis.com/css?family=Anton',
              },
              {
                label: 'Lato',
                value: "'Lato', Tahoma, Verdana, sans-serif",
                url: 'https://fonts.googleapis.com/css?family=Lato',
              },
              // ...
            ],
          },
          mergeTags: [
            {
              name: 'Email',
              value: '{{= USER.username }}',
              sample: '[email protected]',
            },
            // ...
          ],
        },
        appearance: {
          theme: 'dark',
          panels: {
            tools: {
              dock: 'left',
            },
          },
        },
      },
    },
  },
  // ...
});

See Unlayer's documentation for more options.

🚨 How to run the tests

Create the cypress.env.json file to the root and add your variables following this schema:

{
  "adminUrl": "http://localhost:1337/admin/auth/login",
  "user": {
    "email": "[email protected]",
    "password": "P1pp0#2021"
  }
}

Now let's install and open Cypress

# with yarn
yarn cypress:install
yarn cypress:open

# with npm
npm run cypress:install
npm run cypress:open

🚧 Roadmap

  • Template composer helper
  • Import design feature
  • Override Strapi's core email system feature
  • Preview email with real data feature
  • Tags feature
  • Custom components extension
  • Complete UI tests
  • i18n translations (help wanted!)

🤝 Contributing

Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!

⭐️ Show your support

Give a star if this project helped you.

🔗 Links

🌎 Community support

📝 License

MIT License Copyright (c) 2020 Alex Zaganelli & Strapi Solutions.

Contributors

Thanks goes to these wonderful people (emoji key):


Alexandre Zaganelli

🤔 💻 🎨 🐛

Ron Chi

🐛

p_0g_8mm3_

🎨 🤔

Tobias Thiele

💻 🎨 🤔

Guillermo Angulo

🐛 💻

Xavier Civit

🐛

jpizzle34

💻

Moritz Eck

💻

B0rk3

💻

Nihey Takizawa

💻

Ciro Alabrese

💻

Nik Zaugg

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Stargazers

Stargazers repo roster for @alexzaganelli/strapi-plugin-email-designer

Forkers

Forkers repo roster for @alexzaganelli/strapi-plugin-email-designer

Support Me

If you like this plugin I'm very happy, so lets drink a beer. Salute! 🍻

"Buy Me A Beer"

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].