我使用Laravel 5.3,EC2和SES發送電子郵件。Amazon SES 403 Forbidden SignatureDoesNotMatch使用Laravel 5.3
配置/ mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
.ENV有
MAIL_DRIVER=ses
MAIL_HOST=email-smtp.us-west-2.amazonaws.com
MAIL_PORT=25
MAIL_ENCRYPTION=TLS
SES_KEY='AKIA------DZQ5TYQ'
SES_SECRET=AhN8d----------------ZbBq7TNBmhNnosfYbasg6Q
SES_REGION='us-west-2'
composer.json
"require": {
"aws/aws-sdk-php": "~3.0",
}
EC2是在孟買和SES舉辦的美國西部。我嘗試了以下方法:
1)創建新的IAM用戶並使用新的密鑰/祕密。
2)創建root用戶密鑰/祕密。
3)運行NTPDATE命令。
4)php artisan緩存:清除,配置:清除,查看:清除,轉儲自動加載
5)我也在.env中使用了sparkpost,並給出了錯誤403:禁止了。
我仍然看到以下錯誤:
[2017-05-26 06:02:00] local.ERROR: exception 'Aws\Ses\Exception\SesException' with message 'Error executing "SendRawEmail" on "https://email.us-west-2.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.us-west-2.amazonaws.com` resulted in a `403 Forbidden` response:
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>SignatureDo (truncated...)
SignatureDoesNotMatch (client): The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
完全錯誤的位置:https://pastebin.com/KSJinB1E
這可能有一些幫助。 http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html >>您的SMTP用戶名和密碼與您的AWS訪問密鑰ID和祕密訪問密鑰不同。不要嘗試使用您的AWS憑證對SMTP端點進行身份驗證。 只是想確保你嘗試過。 – nightgaunt
是的。這個做完了。我正在使用IAM憑據。請檢查SES_KEY和SES_SECRET。這是IAM用戶的憑據。 –
你已經提到你運行ntpdate,但不是輸出?你確定你沒有時鐘歪斜嗎? ntpstat的輸出是什麼? – Robo