
8

分享一个 JAVASCRIPT(AMAZON SES SDK)发送邮件的方法, 便宜好用!
source link: https://www.v2ex.com/t/833981
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

var credentials = {
accessKeyId: "AMAZON accessKeyId",
secretAccessKey: "secretAccessKey accessKey"
};
AWS.config.update(credentials);
AWS.config.region = 'ap-southeast-1';
var sesv2 = new AWS.SESV2();
var params = {
Content: {
Simple: {
Body: {
Html: {
Data: '邮件内容',
Charset: 'UTF-8'
}
},
Subject: {
Data: '邮件主题',
Charset: 'UTF-8'
}
}
},
Destination: { ToAddresses: ['xxxx 收件人 [email protected]'] },
FromEmailAddress: '发件人 xxxx',
FromEmailAddressIdentityArn: '发件人 ARN',
};
sesv2.sendEmail(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK