Deprecation notice

This module is deprecated in favor of the built-in SES module for Nodemailer. See the docs for it here.

The following is here for historic reasons. The module is not supported or maintained.

SES transport module for Nodemailer

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

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.

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



Deprecation notice

此模块不赞成使用Nodemailer的内置SES模块。查看文档此处

以下是出于历史原因。该模块不支持或维护。

Nodemailer的SES传输模块

适用于 Nodemailer v1 +,而不适用于内置传输功能的v0.x。

用法

使用npm安装

npm install nodemailer-ses-transport

需要您的脚本

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

创建Nodemailer传输对象

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

哪里

  • 选项定义连接数据
    • ses - 实例化的AWS SES对象。如果没有提供,则使用其他选项
    • 自动生成一个
    • accessKeyId - 可选 AWS访问密钥。如果 options.ses 设置,则不使用。
    • secretAccessKey - 可选 AWS秘密。如果 options.ses 设置,则不使用。
    • sessionToken - 可选会话令牌。如果 options.ses 设置,则不使用。
    • 区域 - 可选指定要发送服务请求的区域。默认为 us-east-1 。如果 options.ses 设置,则不使用。
    • httpOptions - 一组用于传递到低级AWS HTTP请求的选项。请参阅 AWS-SES文档中的选项。如果 options.ses 设置,则不使用。
    • rateLimit - 可选指定可在1秒内发送。例如,如果您想在一秒钟内发送最多5条消息,请将此值设置为5.如果不设置此值,则不会应用速率限制,并立即发送消息。

Examples

示例1。使用AWS凭据设置发件人

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

示例2。使用已有的AWS SES对象实例

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

许可证

麻省理工学院




相关问题推荐