Expected response code 250 but got code “530”, wit

2020-02-24 12:19发布

I got stack on this error I trying to configure SMTP mail on laravel

here is the error

here is my configuration on .env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=fff3c01db52ee0
MAIL_PASSWORD=feaeda91dc9ab6
MAIL_ENCRYPTION=TLS

here is  my mail.php on config I have try to authenticate the SMTP on env but I keep get the same error so for now am stack on that error

5条回答
乱世女痞
2楼-- · 2020-02-24 12:50

That is basically authentication error due to misconfiguration of email settings.

Go to .env file

change

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

to

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com    
MAIL_PORT=465    
MAIL_USERNAME=ENTER_YOUR_EMAIL_ADDRESS(GMAIL)    
MAIL_PASSWORD=ENTER_YOUR_GMAIL_PASSWORD    
MAIL_ENCRYPTION=ssl

The MAIL_USERNAME and PASSWORD should be replaced with your Gmail Email address and Password respectively. Login to your Google Account, Go to security settings and enable Allow Less Secure App switch button.

After that go to your project root directory and run the following command:

php artisan clear:cache && php artisan clear:config && php artisan config:cache

. Please refer to

this guide for assistance and clarification (Note: For MAIL_HOST use smtp.gmail.com)

查看更多
淡お忘
3楼-- · 2020-02-24 12:52

I believe this has been answered in some sections already, just test with gmail for your "MAIL_HOST" instead and don't forget to clear cache. Setup like below: Firstly, you need to setup 2 step verification here google security. An App Password link will appear and you can get your App Password to insert into below "MAIL_PASSWORD". More info on getting App Password here

MAIL_DRIVER=smtp
MAIL_FROM_ADDRESS=noreply@domain.com
MAIL_FROM_NAME=DomainName
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=YOUR_GMAIL@gmail.com
MAIL_PASSWORD=YOUR_GMAIL_CREATED_APP_PASSWORD
MAIL_ENCRYPTION=tls

Clear cache with:

php artisan config:cache
查看更多
劫难
4楼-- · 2020-02-24 12:53

Yep, and if you have tried all the above solutions (what's more likely to happen) and none work for you, it may happen that Guzzle is not installed.

Laravel ships mailing tools, by which is required the Guzzle framework, but it won't be installed, and AS OF the documentation, will have to install it manually: https://laravel.com/docs/master/mail#driver-prerequisites

composer require guzzlehttp/guzzle
查看更多
看我几分像从前
5楼-- · 2020-02-24 13:04

your mail.php on config you declare host as smtp.mailgun.org and port is 587 while on env is different. you need to change your mail.php to

'host' => env('MAIL_HOST', 'mailtrap.io'),

'port' => env('MAIL_PORT', 2525),

if you desire to use mailtrap.Then run

php artisan config:cache
查看更多
你好瞎i
6楼-- · 2020-02-24 13:12

I see you have all the settings right. You just need to end the local web server and start it again with

php artisan serve

Everytime you change your .env file, you need tor restart the server for the new options to take effect.

Or clear and cache your configuration with

php artisan config:cache
查看更多
登录 后发表回答