本文整理匯總了TypeScript中nodemailer-ses-transport類的典型用法代碼示例。如果您正苦於以下問題:TypeScript nodemailer-ses-transport類的具體用法?TypeScript nodemailer-ses-transport怎麽用?TypeScript nodemailer-ses-transport使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了nodemailer-ses-transport類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: sesTransport
/// <reference path="../aws-sdk/aws-sdk.d.ts" />
/// <reference path="nodemailer-ses-transport.d.ts" />
import * as AWS from 'aws-sdk';
import * as sesTransport from 'nodemailer-ses-transport';
var opts: sesTransport.SesOptions = {
ses: new AWS.SES(),
rateLimit: 5,
maxConnections: 3,
};
var transport: nodemailer.Transport = sesTransport(opts);
// setup e-mail data with unicode symbols
var mailOptions: nodemailer.SendMailOptions = {
from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ✔', // plaintext body
html: '<b>Hello world ✔</b>' // html body
};
transport.send(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => {
// nothing
});
示例2: constructor
constructor() {
let useSMTP = !!process.env.EMAIL_SMTP;
if (useSMTP) {
this.transporter = createTransport(process.env.EMAIL_SMTP);
} else {
// default to SES
if (process.env.EMAIL_SES) {
this.transporter = createTransport(sesTransport(JSON.parse(process.env.EMAIL_SES)));
} else {
this.transporter = createTransport(sesTransport({}));
}
}
}