Laravel AWS Simple Email Service Error SignatureDoesNotMatch



我在 laravel 5.5 中使用 aws ses,当我使用 aws ses 发送邮件时,会发生如下所示的错误---

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:n
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">n
<Error>n
<Type>Sender</Type>n
<Code>SignatureDo (truncated...)n
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. - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">n
<Error>n
<Type>Sender</Type>n
<Code>SignatureDoesNotMatch</Code>n
<Message>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.</Message>n
</Error>n
<RequestId>4985867a-7067-11e8-afe4-1b9673bed905</RequestId>n
</ErrorResponse>n 

我的控制器:

$sendemail = Mail::send('emails.sendmail',$maildetails,function($message) use($maildetails){
$message->to($maildetails->email)->subject('Mail Sending process');
});

我的环境文件:

MAIL_DRIVER=ses
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=****@gmail.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
SES_ACCESS_KEY =ALKILJUYRTHNFGREDFDSW
SES_ACCESS_SECRET=kjkdcghcbhjghgfrtywuiueiyeuhevgh+cschujhj-jyt
SES_REGION =eu-west-1

我的服务.php文件:

'ses' => [
'key' => env('SES_ACCESS_KEY'),
'secret' => env('SES_ACCESS_SECRET'),
'region' => env('SES_REGION'),
],

我的作曲家.json 文件:

"require": {
"php": ">=7.0.0",
"aws/aws-sdk-php": "^3.59",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.5.*",
"laravel/passport": "~4.0",
"laravel/tinker": "~1.0"
},

我认为正确地完成了我的aws ses配置过程,但我不明白为什么它不起作用。 如果有人对此有解决方案...?

我假设您已在 AWS 控制台> SES 中遵循了"创建我的 SMTP 凭证"过程(而不是创建 IAM 用户并手动分配角色/权限(。如果没有,请在继续之前尝试一下。

接下来,不要使用ses驱动程序,请尝试smtp驱动程序。

将这些行添加到.env文件中应该有效:

MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-west-2.amazonaws.com
MAIL_USERNAME="insert_iam_key"
MAIL_PASSWORD="insert_iam_secret"
MAIL_FROM_ADDRESS="no-reply@example.com"

注意:如果 SES 仍处于沙盒模式(即您尚未请求提高速率限制(,请确保您发送邮件的域和要发送到的电子邮件地址已在 AWS 控制台> SES 中进行了验证。

相关内容

  • 没有找到相关文章

最新更新