Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
559 views
in Technique[技术] by (71.8m points)

php - Error while sending email on GoDaddy Server: Laravel 5.1

I am using inbuilt template of Login System in Laravel 5.1

When I use Forgot Password on localhost, everything works. Below are my keys in .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=userid
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls

When I try the same thing on Godaddy server, I am facing the below error.

Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host smtp.gmail.com [Connection refused

111]

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your env file must be like below

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=465
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=ssl

In your config/mail.php, the from value should be like below...

'from' => ['address' => '[email protected]', 'name' => 'Sender Name'],

What's your domain Name in from ? or you can say, How to create Email account in GoDaddy ?

  1. Login in your GoDaddy Account
  2. Go to your Hosting Account.
  3. Click Manage
  4. Under Email category, Please click Accounts
  5. Create an account if there is no email account.

and that's it.

So let's say you have email address like [email protected]

Now, put this email address in config/mail.php for from field. That's it.

This will 100% fix the issue


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...