[英]Amazon SES verifyEmailIdentity is not sending email
我想自動化授權電子郵件地址的過程,以通過 javascript/Node.JS 中的 Amazon SES 服務發送郵件。
我們已經通過 Node 發送郵件並且工作正常,但我無法正常工作。
我到目前為止:
function verifyEmail(email, callback){
var sesService = new AWS.SES({
accessKeyId: "mykey",
secretAccessKey: 'myaccesskey',
region: 'eu-west-1'
});
sesService.verifyEmailIdentity({EmailAddress: email}, function(err, data){
console.log("verifyEmailIdentity", err, data);
return callback(err, data);
})
}
在日志中我得到這個:
verifyEmailIdentity null Object {ResponseMetadata: Object}
ResponseMetadata 對象包含 RequestId: "some-string"
所以,我沒有收到錯誤消息,但也沒有收到確認此請求的電子郵件。
該密鑰已添加 AmazonSESFullAccess 策略,因此有足夠的權限來完成此操作。
我想我忘記了一些非常簡單的東西,但是根據亞馬遜的文檔我找不到什么。 而且javascript的例子不多,所以我無法將我的代碼與其他人進行比較。
仍然不知道為什么這不起作用,但現在它起作用了。
我們已經計划創建一個自定義驗證模板 ( https://docs.aws.amazon.com/ses/latest/DeveloperGuide/custom-verification-emails.html ),我在使用 CLI 等待答案時創建了一個模板.
要使用此模板,我們必須使用 AWS 的 sendCustomVerificationEmail() 函數。 你猜怎么着? 使用該功能,郵件已發送,我可以驗證請求的電子郵件地址!
verifyMail 函數現在看起來像:
function verifyEmail(email, callback){
sesService.sendCustomVerificationEmail({
EmailAddress: email,
TemplateName: 'MyTemplateName'
},function(err, data){
console.log("verifyEmailIdentity", err, data);
return callback(err, data);
})
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.