寄送信件有發信跟寄信需要設定。SES的操作介面都有
開始設定
1.進入SES設定https://console.aws.amazon.com/ses/home
2. 設定domain發信
接續上步之後,就可以看到一堆dns相關資訊,這裡我是設定到cloudflare上。填完設定後就會通過domain認證
有通過認證後,就可以看到verified的綠字了
2. 測試發信
新增一個測試的信件,再去這個信箱發信,點擊驗證link。之後email才能測試寄件
接著你可以用Domain/Email Address來寄信。
Domain寄信
則可以自定要發信的email名稱,這樣就可以依不同服務寄送信件給用戶。EX:註冊信
Email Address寄信
可以用驗證過的信箱寄信給指定信箱
3.設定S3收信
可以寄信就要設定收信了,大多都會將信件存到s3上,
請至Email Receiving做規則設定
之後就要填寫一些相關的資訊,之後就等support team回覆開通就可以串接了。
查看進度可以點以下連結
nodejs aws-sdk錯誤處理
1. Signature時間逾期
{"message":"Signature expired: 20190129T112038Z is now earlier than 20190129T131757Z
{"message":"Signature expired: 20190129T112038Z is now earlier than 20190129T131757Z
要校正機器的時間設定,因為是裝ubuntu可參考下面的
sudo apt-get install ntp ntpdate
sudo ntpdate ntp.ubuntu.com
2. 權限不足
{"message":"User `arn:aws:iam::161004446739:user/<你的帳號>' is not authorized to perform `ses:SendEmail' on resource `arn:aws:ses:us-east-1:<你的awsid>:identity/tester1@gmail.com'"
3.信箱沒有驗證
{"message":"Email address is not verified. The following identities failed the check in region US-EAST-1: bigdstut@gmail.com","stack":"MessageRejected: Email address is not verified.
寄信的對像沒有通過驗證,預設是在沙盒模式中https://docs.aws.amazon.com/zh_tw/ses/latest/DeveloperGuide/request-production-access.html?icmpid=docs_ses_console
參考
https://docs.aws.amazon.com/zh_tw/ses/latest/DeveloperGuide/verify-domain-procedure.htmlhttps://docs.aws.amazon.com/zh_tw/ses/latest/DeveloperGuide/dns-txt-records.html?icmpid=docs_ses_console
https://docs.aws.amazon.com/zh_tw/ses/latest/DeveloperGuide/dkim.html
網域dkim
https://docs.aws.amazon.com/zh_tw/ses/latest/DeveloperGuide/easy-dkim-setup-domain.html
如何設定寫入s3權限
https://docs.aws.amazon.com/zh_tw/ses/latest/DeveloperGuide/receiving-email-permissions.html
寫code
https://github.com/nodemailer/nodemailer-ses-transport
https://medium.com/@yashoda.charith10/sending-emails-using-aws-ses-nodejs-460b8cc6d0d5
http://jsnwork.kiiuo.com/archives/2539/amazon-ses-%E8%A8%AD%E5%AE%9A-email%EF%BC%8C%E8%AE%93%E4%BD%BF%E7%94%A8%E8%80%85%E5%AF%84%E4%BF%A1%E4%BC%BA%E6%9C%8D%E5%99%A8%E6%94%B6%E4%BF%A1%E8%BD%89%E5%AF%84%E7%B5%A6%E7%AE%A1%E7%90%86/
沒有留言:
張貼留言
留個話吧:)