我(痛苦地)创建了一个系统,我有一个API网关将信息从HTML表单传递给LAMBDA函数,当有人联系我的网页时,会向我发送一封电子邮件。 现在,问题是,我想自动发送电子邮件以感谢他们联系,但我遇到了障碍。我认为这不会让我这样做,因为这样的电子邮件地址未经过验证。
这是代码
var AWS = require('aws-sdk')
var ses = new AWS.SES()
var RECEIVER1 = 'admin email'
var RECEIVER11 = 'contact email'
var SENDER = 'sender email'
exports.handler = function (event, context) {console.log('Received event:', event) sendEmail(event, function (err, data) {context.done(err, null)})}
function sendEmail (event, done) {
var params = {
Destination: {
ToAddresses: [
RECEIVER1
]
},
Message: {
Body: {
Text: {
Data: 'Name: ' + event.name + '\nPhone: ' + event.phone + '\nEmail: ' + event.email + '\nDescription of email: ' + event.description,
Charset: 'UTF-8'
}
},
Subject: {
Data: 'Variable: ' + event.name,
Charset: 'UTF-8'
}
},
Source: SENDER
}
ses.sendEmail(params, done)
var params1 = {
Destination: {
ToAddresses: [
RECEIVER11
]
},
Message: {
Body: {
Text: {
Data: ''
<html>
...
</html>
,
Charset: 'UTF-8'
}
},
Subject: {
Data: 'Variable: ' + event.name,
Charset: 'UTF-8'
}
},
Source: SENDER
}
ses.sendEmail(params1, done)
}'
答案 0 :(得分:0)
有效地,要求增加的限制解决了这个问题。 感谢所有帮助。