Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

theUnforgiven's avatar

SES on Vapor

Hi,

I'm trying to setup SES/SMTP to send emails from my application via SES and the site is on Vapor.

However, I have created a IAM user and policies to match, but I still get the following error:

 "message": "Failed to authenticate on SMTP server with username \"MYAPIKEY\" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 334 but got code \"530\", with message \"530 Must issue a STARTTLS command first\r\n\". Authenticator PLAIN returned Expected response code 235 but got code \"530\", with message \"530 Must issue a STARTTLS command first\r\n\".",
    "exception": "Swift_TransportException",
0 likes
14 replies
skauk's avatar

@theunforgiven Make sure that you have the following configuration in your config/services.php:

'ses' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
    ],

Vapor will inject these environment variables automatically. Make sure you also have MAIL_DRIVER set to ses (this is the default) using command vapor env:pull production. Also check if your SES account is not in the sandbox mode (open SES in AWS console and it should have a note on top if it is.) so you can send e-mails not only to your verified ones and of course you have to add your domain and e-mail address in SES.

theUnforgiven's avatar

Ok, think I have those set, I will double check.

Also do I need this sorta stuff in the env file?

MAIL_DRIVER=ses
[email protected]
MAIL_FROM_NAME="App Name"
theUnforgiven's avatar

I've added email address and domain to AWS I can see Enabled for Sending: Yes & Status: verified just can't seem to crack why it won't send

theUnforgiven's avatar

It seems like Sandbox was still enabled so I've sent a request to increase limits.

themsaid's avatar

Email is only available for 'us-east-1', 'us-west-2', 'eu-west-1'. Which region are you deploying to?

theUnforgiven's avatar

Ah, which ever London is as the region @themsaid that would explain it i guess.

But how do i get around this?

themsaid's avatar

You'll need to use a different mail provider. SES support is limited to those regions I'm afraid :/

1 like
theUnforgiven's avatar

So it seems, thank you @themsaid I have since moved to Postmark for this. Really appreciate your help/advice on here and Twitter.

themsaid's avatar

@harrygulliford we only support 'us-east-1', 'us-west-2', 'eu-west-1' for now. Will look into supporting more regions soon.

1 like
nie7321's avatar

@themsaid whatever credential Vapor hands the app work fine cross-region. I had to adjust the Laravel services config -- ses needs to use a different environment variable for its region so I can specify us-east-1 without breaking everything else.

I'm sending mail from an app in us-east-2 via SES in us-east-1.

1 like
theUnforgiven's avatar

@nie7321 When you say change the services config, how did you do this to specify what region to use?

alex_sweb's avatar

For me it does not work not even on us-east-1..

Please or to participate in this conversation.