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

aws-ses-v2-local

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-ses-v2-local

A local version of Amazon Simple Email Service (AWS SES) supporting the V2 API

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9K
increased by16.15%
Maintainers
1
Weekly downloads
 
Created
Source

aws-ses-v2-local

A local version of Amazon Simple Email Service (AWS SES) supporting both the V1 API and the V2 API. Currently focuses on the SendEmail and SendRawEmail endpoints.

Are you using serverless-offline? You might be interested in serverless-offline-ses-v2.

Screenshot of the email viewer tool

Features

  • SES V1 SendEmail endpoint
  • SES V1 SendRawEmail endpoint
  • SES V2 SendEmail endpoint (both Simple and Raw)
  • Realistic API responses, compatible with the AWS SDK (in JavaScript/TypeScript/Node.js, Java, Python, Go, C++, .NET, PHP, Ruby, CLI)
  • To, Cc, Bcc, ReplyTo and From addresses
  • Plain text and HTML emails
  • Accept and view attachments
  • Built in web viewer, with live inbox, optional dark theme, and compatibility with all emails
  • API access to emails at GET /store
  • Health check endpoint at GET /health-check
  • Control it from the CLI, or import it as a library
  • TypeScript definitions

Install

npm install aws-ses-v2-local

Usage

Setting up aws-ses-v2-local

Run it as a command line tool (in your package.json scripts, or install it globally with npm install -g aws-ses-v2-local)

aws-ses-v2-local

Alternatively, you can import it and run it yourself (along with optional config for the port):

import server from 'aws-ses-v2-local'

server({ port: 8005 })
console.log('aws-ses-v2-local: server up and running')

Setting up your application

You can treat the server as an AWS SES endpoint. See the starter for your language:

JavaScript/TypeScript for the V2 API with the V3 SDK (recommended)
import { SESv2Client, SendEmailCommand } from "@aws-sdk/client-sesv2"

const ses = new SESv2Client({
    endpoint: 'http://localhost:8005',
    region: 'aws-ses-v2-local',
    credentials: { accessKeyId: 'ANY_STRING', secretAccessKey: 'ANY_STRING' },
});
await ses.send(new SendEmailCommand({
    FromEmailAddress: 'sender@example.com',
    Destination: { ToAddresses: ['receiver@example.com'] },
    Content: {
        Simple: {
            Subject: { Data: 'This is the subject' },
            Body: { Text: { Data: 'This is the email contents' } },
        }
    },
}))
JavaScript/TypeScript for the V1 API with the V3 SDK
import { SES, SendEmailCommand } from '@aws-sdk/client-ses'

const ses = new SES({
    endpoint: 'http://localhost:8005',
    region: 'aws-ses-v2-local',
    credentials: { accessKeyId: 'ANY_STRING', secretAccessKey: 'ANY_STRING' },
})
await ses.send(new SendEmailCommand({
    Source: 'sender@example.com',
    Destination: { ToAddresses: ['receiver@example.com'] },
    Message: {
        Subject: { Data: 'This is the subject' },
        Body: { Text: { Data: 'This is the email contents' } },
    },
}))
JavaScript/TypeScript for the V2 API with the V2 SDK
import AWS from 'aws-sdk'

const ses = new AWS.SESV2({
    endpoint: 'http://localhost:8005',
    region: 'aws-ses-v2-local',
    credentials: { accessKeyId: 'ANY_STRING', secretAccessKey: 'ANY_STRING' },
})
ses.sendEmail({
    FromEmailAddress: 'sender@example.com',
    Destination: { ToAddresses: ['receiver@example.com'] },
    Content: {
        Simple: {
            Subject: { Data: 'This is the subject' },
            Body: { Text: { Data: 'This is the email contents' } },
        }
    },
})
JavaScript/TypeScript with nodemailer for the V1 raw API with the V3 SDK
import * as aws from '@aws-sdk/client-ses'

const ses = new aws.SES({
    endpoint: 'http://localhost:8005',
    region: 'aws-ses-v2-local',
    credentials: { accessKeyId: 'ANY_STRING', secretAccessKey: 'ANY_STRING' },
})
const transporter = nodemailer.createTransport({ SES: { ses, aws } })

await transporter.sendMail({
    from: 'sender@example.com',
    to: ['receiver@example.com'],
    subject: 'This is the subject',
    text: 'This is the email contents',
    attachments: [{
        filename: `some-file.pdf`,
        contentType: 'application/pdf',
        content: Buffer.from(pdfBytes),
    }],
})

Using another language or version? Submit a PR to update this list :)

Viewing emails

Navigate to the address and port where the server is running in your browser (e.g. localhost:8005).

FAQs

Package last updated on 15 May 2022

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