1.0.7 • Published 12 months ago
strapi-plugin-email-collect v1.0.7
Strapi Email Sending Collect Plugin
Prerequisites
Install the @strapi/provider-email-nodemailer plugin
yarn add @strapi/provider-email-nodemailer
Configure email sending parameters
# file location .env SMTP_HOST=smtpdm.aliyun.com SMTP_PORT=465 SMTP_USERNAME=luca.li@test.com #'luca <luca.li@test.com>' SMTP_PASSWORD=123456
// file location config/plugins.ts module.exports = ({ env }) => ({ email: { config: { provider: "nodemailer", providerOptions: { host: env("SMTP_HOST", "smtp.example.com"), port: env("SMTP_PORT", 587), auth: { user: env("SMTP_USERNAME"), pass: env("SMTP_PASSWORD"), }, // ... any custom nodemailer options }, settings: { defaultFrom: env("SMTP_USERNAME"), defaultReplyTo: env("SMTP_USERNAME"), }, }, }, });
Install the strapi-plugin-email-designer plugin
yarn add strapi-plugin-email-designer@latest
//file location config/middlewares.js - "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", + ], + }, + }, + }, + }, // ...
Install the strapi-plugin-email-collect plugin
yarn add strapi-plugin-email-collect
Restart the Strapi service
yarn build yarn develop
Usage
Send emails to users
Create an email template in the admin panel Get the
templateReferenceId
Send an email Set the
templateReferenceId
to the corresponding template id, it must be a number `
Only collect emails without sending them
- Set the
templateReferenceId
to String Type