Ad

(AWS SES / Laravel) - Connection Could Not Be Established With Host Smtp.mailtrap.io

I've been trying to setup mailing in Laravel 7 with AWS SES and have setup all my credentials properly and set my drivers to SES.

I get the following error when attempting to send an email verification with the default built in functionality.

Connection could not be established with host smtp.mailtrap.io :stream_socket_client(): unable to connect to tcp://smtp.mailtrap.io:2465 (Operation timed out)

.env

MAIL_DRIVER=ses
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=HIDDEN
AWS_SECRET_ACCESS_KEY=HIDDEN
AWS_DEFAULT_REGION=us-east-1

I have ensured that the AWS key and secret have full access to SES, in my config/services.php I am setting it to use these credentials.

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

I have searched through numerous "solutions" and have tried creating a separate user for SES only with no luck.

Any help would be great, thanks!

Ad

Answer

The issue was that my .env was not being loaded due to caching.

Simply running php artisan config:clear cleared the cached config and updated it with my new parameters.

My .env contains the following:

MAIL_MAILER=ses
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
Ad
source: stackoverflow.com
Ad