amazon-web-services - 添加将所有电子邮件地址列入白名单以使用 AWS SES 发送电子邮件的功能?
问题描述
因此,当我尝试在 AWS lambda 函数中使用 AWS SES 发送电子邮件时出现此错误...
User `arn:aws:sts::xxx:assumed-role/lambdaRole' is not authorized to perform
`ses:SendEmail' on resource `arn:aws:ses:eu-west-1:xxx:identity/john@yyy.io'
现在我可以通过将此行添加到 lambda 策略来解决这个问题:
- Effect: Allow
Action:
- "ses:SendEmail"
Resource:
- !Sub "arn:aws:ses:eu-west-1:xxx:identity/john@yyy.io"
但是我希望能够向任何电子邮件地址发送电子邮件,并且我不想每次需要向新电子邮件地址发送电子邮件时都必须将此行添加到策略中。
有什么办法可以在允许我向所有电子邮件地址发送电子邮件的策略中添加一些内容?
这是我使用 Java SES SDK 的 Kotlin 代码...
val request = SendEmailRequest()
.withDestination(Destination().withToAddresses("john@yyy.io"))
.withMessage(Message()
.withBody(Body()
.withHtml(Content()
.withCharset("UTF-8").withData(emailBody)))
.withSubject(Content()
.withCharset("UTF-8").withData("...")))
.withSource("jim@ggg.io)
SES_CLIENT.sendEmail(request)
谢谢!
解决方案
推荐阅读
- python - 将列中的所有唯一词放入新数据集中
- javascript - 附加结果中的反引号在 IE 浏览器中不起作用
- c# - Json 没有正确反序列化为一个类
- sql - 同一张表中的 Sum 和 Substract 列
- java - Firebase 身份验证不适用于 Java(jvm)(桌面)
- ionic-framework - 如何在静态网站中使用没有 CDN 的 Ionic 4 CSS 和 JS?
- jquery - 如何使用 jQuery 更改 HTML 表格的边框粗细和脉动边框颜色,直到检测到“其他地方”点击?
- python-3.x - 遍历矩阵并创建字典
- vba - VBA MS ACCESS:如何修复if中的第一个条件?
- delphi - 如何关闭 idHTTPServer 上的所有连接?