Amazon SES 403 Forbidden SignatureDoesNotMatch using Laravel 5.3

≡放荡痞女 提交于 2019-12-01 23:06:36

I am not familiar with Laravel to begin with. However, if you are using SMTP, you need to specify MAIL_USERNAME and MAIL_PASSWORD. Also the driver should be SMTP and not SES since you are using SMTP host of SES.

The documentation link - http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html should provide you with ways to generate SMTP credentials which are different from your AWS IAM credentials.

In short, you are not using SES SDK but SMTP to send emails. So SES_KEY and SES_SECRET won't do.

I was using the 'ses' MAIL_DRIVER in laravel too and had the exact same problem as the OP. The issue for me was the IAM user I was using - I used the one that the SES wizard created for me which worked for a while, but then stopped. All I had to do to fix it, was create a new 'Programmatic access' IAM user with the "ses:SendRawEmail" permission and emails started flowing.

1) check your server or local machine's "Date & time" up to date or not.

2) check config/mail.php with below

'driver'    => env('MAIL_DRIVER', 'ses'),
'host'      => env('MAIL_HOST'),
'port'      => env('MAIL_PORT', 587),
'encryption'=> env('MAIL_ENCRYPTION', 'tls'),
'username'  => env('MAIL_USERNAME'),
'password'  => env('MAIL_PASSWORD'),
'sendmail'  => '/usr/sbin/sendmail -bs',

3) check your .env file with below

MAIL_DRIVER=ses
MAIL_HOST=email-smtp.us-east-1.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=[your AMI KEY]
MAIL_PASSWORD=[your AMI SECRET]
MAIL_ENCRYPTION=tls

4) check your Config/Services.php file with below

'ses' => [
    'key' => env('MAIL_USERNAME'),
    'secret' => env('MAIL_PASSWORD'),
    'region' => 'us-east-1',// change to your AWS region
],

Don't use amazon ses smtp credentials as MAIL_USERNAME & MAIL_PASSWORD

You don't need SMTP username/password, just using IAM key and secret should get u login SES in Laravel...

You seems put necessary quotation marks in key and region, they should be:

SES_KEY=AKIA------DZQ5TYQ
SES_SECRET=AhN8d----------------ZbBq7TNBmhNnosfYbasg6Q
SES_REGION=us-west-2

If that's not the case, make sure your IAM user has SES write permission:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!