Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

ubuntu - send email in laravel by gmail smtp server

I want to use Gmail to send emails through Laravel. When I apply through localhost, the email is sent correctly. But it gives the following error on the server and the email is not sent.

local.ERROR: Swift_TransportException: Connection could not be established with host smtp.gmail.com $:stream_socket_client(): unable to connect to tcp://smtp.gmail.com:587 (Connection timed out)
question from:https://stackoverflow.com/questions/66065214/send-email-in-laravel-by-gmail-smtp-server

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

1 Answer

0 votes
by (71.8m points)

Hello I had the same problem probably your solution is like that, because this helps me to resolved my issue

Create a custom app in you Gmail security settings.

  1. Log-in into Gmail with your account
  2. Navigate to https://security.google.com/settings/security/apppasswords
  3. In 'select app' choose 'custom', give it an arbitrary name and press generate
  4. It will give you 16 chars token.` Use the token as password in combination with your full Gmail account and two factor authentication will not be required.

Note: The link in step 2 will work only if you have 2-factor-authentication enabled.

For Refference: link


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...