[英]AWS SES send mail with credentials
我正在尝试通过 AWS SES sesMail 发送电子邮件。 但是我需要在发送电子邮件时设置安全凭据。 我阅读了 grails 的 SES 文档,它指出我们需要将其设置如下,
mailId = sesMail {
credentials "new_access_key", "new_security_key"
to "email@gmail.com"
subject "test plain text mail"
body "this is the e-mail content"
}
但它不起作用。 没有错误。 它返回的邮件 ID 为 NULL。 并且不发送电子邮件。 任何人都有解决方案如何做到这一点?
我无法以上述方式发送新凭据。 所以有另一种方法来做到这一点。
def credentialsHolder = new AWSCredentialsHolder();
credentialsHolder.accessKey = bean?.accessKey
credentialsHolder.secretKey = bean?.secreteKey
def sender = new SendSesMail();
sender.credentialsHolder = credentialsHolder;
sender.region = bean?.region
mailId = sender.send {
from fromEmail
to toEmail
subject "new subject"
body "e-mail body (plain text)"
}
确保您提供正确的region
否则会出现“电子邮件 ID 未验证”错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.