2015-10-12 79 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未驗證」的錯誤。

相關問題