How to configure Amazon SES SMTP in PHP Laravel 5?

旧城冷巷雨未停 提交于 2020-01-02 08:21:28

问题


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:


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




回答2:


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.




回答3:


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="from@email.com"

for sending email I have used this.

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

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



来源:https://stackoverflow.com/questions/40858896/how-to-configure-amazon-ses-smtp-in-php-laravel-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!