strapi-provider-email-smtp-image-base64

0.1.1 • Public • Published

strapi-provider-email-gmail-oauth2-image-base64

Demo

Demo result/

Note

Strapi email provider send mail via SMTP with support insert base64 image in html content of email.

Usage

Configure the provider in [strapi-dir]/config/plugins.

Example

Path - config/plugins.js

module.exports = ({ env }) => ({
  // ...
  email: {
    provider: "smtp-image-base64",
    providerOptions: {
      host: env("SMTP_HOST"), //SMTP Host
      port: env("SMTP_PORT"),   , //SMTP Port
      secure: env("SMTP_SECURE") || true,
      username: env("SMTP_USERNAME"),
      password: env("SMTP_PASSWORD"),
      rejectUnauthorized: env("SMTP_REJECT_UNAUTHORIZED") || true,
      requireTLS: env("SMTP_REQUIRE_TLS") || true,
      connectionTimeout: env("SMTP_TIMEOUT") || 1,  // 1 minute
    },
    settings: {
      defaultFrom: env("EMAIL_USERNAME"),
      defaultReplyTo: env("EMAIL_USERNAME"),
    },
  },
  // ...
});

TIP: You can using environment file (.env) in the root of project for store variable.

Enable/Disable base64 image in html email content

If you email don't have base64 image, you can disable this feature by adding a key in options email like this:

await strapi.plugins.email.services.email.sendTemplatedEmail(
      {
        to: data?.email,
        hasBase64Image: false,
      },
      emailTemplate,
      {
        data,
      }
    );

Resources

Links

Installation

npm i -s strapi-provider-email-gmail-oauth2-image-base64

Package Sidebar

Install

npm i strapi-provider-email-smtp-image-base64

Homepage

strapi.io

Weekly Downloads

7

Version

0.1.1

License

MIT

Unpacked Size

59.1 kB

Total Files

6

Last publish

Collaborators

  • bugatino