2015-10-12 109 views
-2

我试图通过AWS SES sesMail发送电子邮件。但我需要在发送电子邮件时设置安全凭证。我阅读了SES for Grails的文档,它指出我们需要将其设置为如下,AWS SES使用凭证发送邮件

mailId = sesMail { 
credentials "new_access_key", "new_security_key" 
to "[email protected]" 
subject "test plain text mail" 
body "this is the e-mail content" 
} 

但它不起作用。没有错误。它返回的邮件ID是NULL。并没有电子邮件发送。任何人有解决方案如何做到这一点?

+0

什么是错误? “不起作用”并不意味着太多! –

+0

@VolkanPaksoy:它没有错误或异常。我编辑了这个问题。对造成的不便表示歉意。 – user3853055

+0

那里没有“from”参数。你把它放在其他地方还是不包括在这里?如果没有,我会尝试这个以及 –

回答

0

我无法以上述方式发送新凭证。所以还有另一种方法来做到这一点。

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未验证”的错误。

相关问题