Back to plugins & integrations

AWS SES icon

AWS SES

Send transactional emails using Amazon’s Simple Email Service (SES)

npm install @vendure/email-plugin

Integration type

Core
Core open-source plugins built by the Vendure team

Category

Email

Last published

yesterday

Downloads in past month

11,971
README.md

Installation

The Vendure EmailPlugin is usually installed by default, but if you don’t have it in your project follow the installation instructions to install and configure the plugin in your project.

Next, install the @aws-sdk/client-ses package:

npm install @aws-sdk/client-ses

Configuration

Now you are ready to configure the EmailPlugin to use the SES transport method:

// src/vendure-config.ts
import { VendureConfig } from '@vendure/core';
import { defaultEmailHandlers, EmailPlugin } from '@vendure/email-plugin';
import { SES, SendRawEmailCommand } from '@aws-sdk/client-ses'

const ses = new SES({
  apiVersion: '2010-12-01',
  region: 'eu-central-1',
  credentials: {
    accessKeyId: process.env.SES_ACCESS_KEY || '',
    secretAccessKey: process.env.SES_SECRET_KEY || '',
  },
});

const config: VendureConfig = {
  // Add an instance of the plugin to the plugins array
  plugins: [
    EmailPlugin.init({
      handlers: defaultEmailHandlers,
      templatePath: path.join(__dirname, 'static/email/templates'),
      transport: {
        type: 'ses',
        SES: { ses, aws: { SendRawEmailCommand } },
        sendingRate: 10, // optional messages per second sending rate
      },
    }),
  ],
};

For more details on configuration, see the Nodemailer SES docs.