Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set AWS SES identity in Laravel 8

I am getting the error message User arn:aws:iam:blabla:user/blabla is not authorized to preform ses:SendRawEmail on resource arn:aws:ses:locationLblabla:identity/[domain-of-the-to-address].com my DevOps informs me that [domain-of-the-to-address] should me a specific/our domain. The only way I can find to manipulate that is changing the to address. How do i properly set that? I have tried that following

// services.php

return [
  'ses' => [
    'key' => '...',
    'secret' => '...',
    'region' => '...',
    'options' => [
      'SourceARN' => 'arn:aws:ses:locationLblabla:identity/[correct-domain].com'
      'Source' => 'test@[correct-domain].com'
    ],
  ]
];

and

// MyMailable.php

$this->withSwiftMessage(function (Swift_Message $message) {
  $message->getHeaders()->addTextHeader('X-SES-SOURCE-ARN', 'arn:aws:ses:locationLblabla:identity/[correct-domain].com');
});

Edit: In other words. I DO have the ses:SendRawEmail permission. I'm sending an email like: to: [email protected] from: [email protected]

but some how laravel driver or aws sdk is getting it backwards setting my identity as arn:aws:ses:locationLblabla:identity/gmail.com not arn:aws:ses:locationLblabla:identity/my-comp.com and we don't and wouldn't have an identity setup in out aws for ever single email domain with the ses:SendRawEmail so it won't work.

like image 225
William Lohan Avatar asked Jan 20 '26 07:01

William Lohan


1 Answers

I don't believe you need the extra config options or the extra text header. It sounds like your SES account is still in the SES Sandbox mode. SES accounts are automatically placed in Sandbox mode when they're created and need to be requested to move out of Sandbox mode.

I'm assuming you've verified the email address or domain you're sending email FROM. However, while in Sandbox mode, you also have to verify the email address or domain you're sending TO. Or, if you can't do that, you can send your test emails to the SES mailbox simulator ([email protected]).

For more information on Sandbox mode, its restrictions, and how to move out of it when ready, you can visit https://docs.aws.amazon.com/ses/latest/dg/request-production-access.html.

For more information on the SES mailbox simulator, you can visit https://docs.aws.amazon.com/ses/latest/dg/send-email-simulator.html.

like image 161
patricus Avatar answered Jan 22 '26 19:01

patricus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!