amazon-web-servicesemailamazon-seslaravel-10

Laravel AWS SES The request signature we calculated does not match the signature you provided


I'm trying to send notification emails via AWS SES API from my Laravel 10 app. I followed the laravel docs and did everything according to it.

My AWS IAM user has SesFullAccess.

The following is my ses mailer config in mail.php

'ses' => [
    'transport' => 'ses',
    'version' => 'latest',
    'region'  => 'ap-southeast-1',
    'credentials' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret'  => env('AWS_SECRET_ACCESS_KEY'),
    ],
    'signature_version' => 'v4'
],

I still get Request to AWS SES API failed. Reason: 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 error

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY work perfectly fine when I use it for SMTP. But I want to use it for SES API

What am I possibly missing?


Solution

  • "AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY work perfectly fine when I use it for SMTP"

    You have to create separate SMTP specific API keys for using the SES SMTP API. From the documentation:

    Important

    Your SMTP credentials aren't identical to your AWS access keys or the credentials that you use to sign in to the Amazon SES console. For information about how to generate your SMTP credentials, see Obtaining Amazon SES SMTP credentials.

    If you created keys for sending SMTP emails, those keys will only work for sending SMTP emails and nothing else. You need to use regular API keys for sending emails using the SES API.