daniel-zahariev / php-aws-ses

PHP classes that interfaces Amazon Simple Email Service
307 stars 100 forks source link

Only 3 regions available #77

Closed leifnel closed 3 years ago

leifnel commented 3 years ago

I'm not sure if it's a AWS setting issue, or your script, but I can only access

us-east-1 us-west-2 eu-west-1

The rest gives

PHP Warning: SimpleEmailService::getSendQuota(): Sender - InvalidClientTokenId: The security token included in the request is invalid. Request Id: 580f2ad8-5ec1-4031-96a8-15d215e85cbf in /home/automail/vendor/daniel-zahariev/php-aws-ses/src/SimpleEmailService.php on line 503

`<?php

require_once 'vendor/autoload.php';

$sites=array( 'email.us-east-1.amazonaws.com', 'email.us-east-2.amazonaws.com', 'email.us-west-2.amazonaws.com', 'email.ca-central-1.amazonaws.com', 'email.ap-south-1.amazonaws.com', 'email.ap-southeast-1.amazonaws.com', 'email.ap-southeast-2.amazonaws.com', 'email.ap-northeast-1.amazonaws.com', 'email.ap-northeast-2.amazonaws.com', 'email.eu-central-1.amazonaws.com', 'email.eu-west-1.amazonaws.com', 'email.eu-west-2.amazonaws.com' ); foreach($sites as $site) {sendtest($site);}

function sendtest($site) { echo $site."\n"; $ses = new SimpleEmailService(TOKEN,KEY,$site);

print_r($ses->getSendQuota()); } ?> '

VincentNikkelen commented 3 years ago

See pull request #75

leifnel commented 3 years ago

I don't think that's the issue. I'm using the official hostnames, not the aliases. I wonder if somebody get the same result as me, or I am overlooking something at aws.

VincentNikkelen commented 3 years ago

Can it be you are using signature version 3 instead of 4? See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-ses-api-authentication.html

Maybe the first 3 sites are still supporting v3?

leifnel commented 3 years ago

You are right, @VincentNikkelen

$signature_version = SimpleEmailService::REQUEST_SIGNATURE_V4; $ses = new SimpleEmailService('AccessKey', 'SecretKey', $region_endpoint, $trigger_error, $signature_version);

This works now. As v4 works everywhere and v3 is being phased out, v4 should be the default in next version.

daniel-zahariev commented 3 years ago

Thanks for your input @VincentNikkelen. There's a new version now.