2016-08-12 120 views
0

在我的本地機器上,郵件按照SES官方文檔的建議設置,並且像魅力一樣工作。該應用的工作原理與我的EC2部署完全相同。除了郵件部分。每當我在我的生產應用程序發送一封電子郵件,我收到以下錯誤:Laravel AWS SES 403權限錯誤

錯誤1/2

ClientException in RequestException.php line 107: 
Client error: `POST https://email.eu-west-1.amazonaws.com` resulted in a `403 Forbidden` response: 
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>InvalidClie (truncated...) 

和2/2

SesException in WrappedHttpHandler.php line 192: 
Error executing "SendRawEmail" on "https://email.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.eu-west-1.amazonaws.com` resulted in a `403 Forbidden` response: 
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>InvalidClie (truncated...) 
InvalidClientTokenId (client): The security token included in the request is invalid. - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>InvalidClientTokenId</Code> 
<Message>The security token included in the request is invalid.</Message> 
</Error> 
<RequestId>0a137c9c-5fd9-11e6-a886-973129052803</RequestId> 
</ErrorResponse> 

.env文件爲我生產的設置數據庫鏈接到我的EC2。它適用於應用程序的所有其他方面。作曲家更新所有依賴關係更新。我使用SMTP通過SES將郵件發送到已驗證的域。 EC2上的IAM角色是創建Amazon Linux AMI時的默認EC2角色。還有SES角色。安全組允許所有TCP出站流量。

+0

請求中包含的安全令牌無效。 –

+0

那是否與證書有關呢? – omrakhur

回答

0

好的,解決了。我在services.php中輸入的根訪問密鑰處於非活動狀態。我創建了一個新的根密鑰文件,替換services.php中的密鑰並解決了問題。

+0

你從哪裏得到這些鑰匙?我是?我似乎無法解決這個問題。 –

+0

在IAM中,您可以選擇創建新的根訪問密鑰或IAM用戶憑證。我使用了根密鑰選項 – omrakhur