Git Product home page Git Product logo

nodemailer-ses-transport's Introduction

SES transport module for Nodemailer

Applies for Nodemailer v1+ and not for v0.x where transports are built-in.

Warning about AWS tokens

It has been reported that keys that have special symbols in it (ie. slash /) probably do not work and return signature errors. To overcome this, try to generate keys with only letters and numbers.

Usage

Install with npm

npm install nodemailer-ses-transport

Require to your script

var nodemailer = require('nodemailer');
var sesTransport = require('nodemailer-ses-transport');

Create a Nodemailer transport object

var transporter = nodemailer.createTransport(sesTransport(options))

Where

  • options defines connection data
    • ses - instantiated AWS SES object. If not provided then one is generated automatically using the other options
    • accessKeyId - optional AWS access key. Not used if options.ses is set.
    • secretAccessKey - optional AWS secret. Not used if options.ses is set.
    • sessionToken - optional session token. Not used if options.ses is set.
    • region - optional Specify the region to send the service request to. Defaults to us-east-1. Not used if options.ses is set.
    • httpOptions - A set of options to pass to the low-level AWS HTTP request. See options in the AWS-SES docs. Not used if options.ses is set.
    • rateLimit - optional Specify the amount of messages that can be sent in 1 second. For example if you want to send at most 5 messages in a second, set this value to 5. If you do not set it, rate limiting is not applied and messages are sent out immediately.
    • maxConnections - optional Specify the maximum number of messages to be "in-flight" at any one point in time. Useful for preventing suffocation of an internet connection when sending lots of messages.

Examples

Example 1. Use AWS credentials to set up the sender

var transport = nodemailer.createTransport(sesTransport({
    accessKeyId: "AWSACCESSKEY",
    secretAccessKey: "AWS/Secret/key",
    rateLimit: 5 // do not send more than 5 messages in a second
}));

Example 2. Use already existing AWS SES object instance

var ses = new AWS.SES({accessKeyId:....});
var transport = nodemailer.createTransport(sesTransport({
    ses: ses
}));

License

MIT

nodemailer-ses-transport's People

Contributors

andris9 avatar fabricegaudin avatar markstos avatar simllll avatar yamayo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.