7

I have integrated Amazon SES in PHP Laravel5 project but i have troubled to send email's because i am getting this error,

Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "530", with message "530 Authentication required" 

Can anyone tell me how to configure Amazon SES..

1
  • did you ever get a fix for this? I can send through SwiftMailer by itself fine but when I try and use laravel mail with the env settings as SMTL /TLS (same as swiftmailer) I get the same error as you Commented Jun 2, 2017 at 16:22

3 Answers 3

21

Ensure you have configured your environment variables:

like the following:

MAIL_DRIVER=smtp MAIL_HOST=email-smtp.us-west-2.amazonaws.com MAIL_PORT=587 MAIL_USERNAME=AKIAJ3RS7BUIV7U2LCIQ MAIL_PASSWORD=Av9/1W4ZfcinolyP+8PNvjyQk7owOxaIMUehg53/QhnH MAIL_ENCRYPTION=tls 

I just open a terminal and wrote the following commands:

> Composer update(optional)

> php artisan queue:restart

then it should work.

You have to write to support and ask for moving out of the amazon ses sand box

hope helps

Sign up to request clarification or add additional context in comments.

5 Comments

Have tried the above solution but it didn't work , stil getting the same error.
I also ask for moving out of the amazon ses sand box, and it works docs.aws.amazon.com/ses/latest/DeveloperGuide/…
Do we need install aws-sdk?
you need to install "aws/aws-sdk-php": "~3.0"
This method does not use aws/aws-sdk-php package because it uses direct SMTP protocol to connect to the AWS SES and send emails. In order to use the SES SDK API, which is the correct and safe way to send emails using users with corresponding permissions, we need to set the MAIL_MAILER to ses and apply AWS_* keys inside .env file.
5

modify config/mail.php 's driver to ses, and check the information in config/services.php

'ses' => [ 'key' => 'your-ses-key', 'secret' => 'your-ses-secret', 'region' => 'ses-region', // e.g. us-east-1 ], 

or add them to your .env file.

1 Comment

did you ever get a fix for this? I can send through SwiftMailer by itself fine but when I try and use laravel mail with the env settings as SMTL /TLS (same as swiftmailer) I get the same error as you
2

I have added this in .env file

MAIL_DRIVER=smtp MAIL_HOST=YOURHOST MAIL_PORT=587 MAIL_USERNAME=YOUR_USERNAME MAIL_PASSWORD=YOUR_Password MAIL_ENCRYPTION=tls MAIL_FROM_NAME="Name" MAIL_FROM_ADDRESS="[email protected]" 

for sending email I have used this.

Mail::send(['html' => 'view_name'], $data, function ($m) use ($email) { $m->from('[email protected]', 'name'); $m->to($email, $email)->subject('email subject'); }); 

after changing this hit this "php artisan serve " command in terminal

1 Comment

Go to SES -> Email Addresses -> Verify New Email Address - then verify a new email address. Then use MAIL_FROM_NAME="Name" MAIL_FROM_ADDRESS="[email protected]" as shown in answer, that worked for me.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.