Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strapi-provider-email-gmail-2lo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-provider-email-gmail-2lo

Gmail provider with 2-legged OAuth and a service account for the Strapi framework

  • 3.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by25%
Maintainers
1
Weekly downloads
 
Created
Source

strapi-provider-email-gmail-2lo

This package is an email provider for the headless CMS Strapi. You can use this provider to send mail programmatically with strapi-plugin-email.

This provider enables you to send email with the Gmail API using a 2-legged OAuth configuration, when using G Workspace.

Supported versions:

  • v3.5.x (recommended)
  • v3.x

Not having Google Workspace (previously G suite) will not work with this provider.

Installation

# using yarn
yarn add strapi-provider-email-gmail-2lo

# using npm
npm install strapi-provider-email-gmail-2lo --save

Setup

  1. Enable the Gmail API
  2. Configure the OAuth consent screen
  3. Create a service account
  4. Create a new Private key for your service account
  5. Configure the provider in config/plugins
VariableTypeDescriptionRequiredDefault
providerstringThe name of the provider you useyes
providerOptionsobjectProvider optionsyes
providerOptions.usernamestringAn existing email address within your domain/projectyes
providerOptions.clientIdnumberService account API Client idyes
providerOptions.privateKeystringService account private keyyes
settingsobjectSettingsno{}
settings.defaultFromstringDefault sender mail address, exist in domainnoundefined
settings.defaultReplyTostring | arrayDefault address or addresses the receiver is asked to reply tonoundefined

Enable the scope in G Workspace (required)

The following steps will authorize the right scope, to allow sending email with G Workspace:

  1. Go to G Workspace admin dashboard > Security > API controls > Manage domain-wide delegation
  2. Add an authorized client
  1. Authorize

Example

Path - config/plugins.js

module.exports = ({ env }) => ({
  // ...
  email: {
    provider: 'gmail-2lo',
    providerOptions: {
      username: 'myemail@example.com',
      clientId: env('EMAIL_CLIENT_ID'),
      privateKey: env('EMAIL_PRIVATE_KEY').replace(/\\n/g, '\n'),
    },
    settings: {
      defaultFrom: 'myemail@example.com',
      defaultReplyTo: 'myemail@example.com',
    },
  },
  // ...
});

TIP: When using environment variables for your privateKey, as in the example above, include all the \n in you .env file, like so:

EMAIL_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nAbC...xYz\n-----END PRIVATE KEY-----\n"

Resources

Keywords

FAQs

Package last updated on 26 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc