S
S
Sergei Gurdjiyan2018-07-23 23:21:24
gmail
Sergei Gurdjiyan, 2018-07-23 23:21:24

How to send email via google smpt?

Project in laravel.
Sending email using google smpt.
Settings in .env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=tester_pass
MAIL_ENCRYPTION=tls

Mistake
"Swift_TransportException"
file: "/var/www/h1442/data/www/staleks.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php"
line: 269
message: "Connection could not be established with host smtp.gmail.com [Connection timed out #110]"

The email is my work email. As a password, I tried both the account password and the application key, which is generated for the application in google. Tried with both enabled and disabled two-step authentication, the checkbox Unsafe applications are allowed is enabled.
How to fix the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max Kostikov, 2018-07-23
@mxms

Start by executing the command on the host where your script is running.
If you see something like

Trying 2a00:1450:4010:c0b::6d...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP g11-v6sm1988764ljk.45 - gsmtp

then look for an error in the code (PHP modules), if you don’t see it, deal with the firewall.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question