Problem sending emails with Laravel 5.4

Asked

Viewed 568 times

0

I am trying to email the Laravel Mail class as follows.

Code:

Mail::send('companies.emails.register', ['company' => $company], function ($m) use ($company) {
   $m->to($company->email, $company->name)->subject('Cadastro de Construtora!');
});

Setup:

MAIL_ADMIN=email@admin
MAIL_ADMIN_NAME=Contato
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email@email
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls

Error:

Connection could not be established with host smtp.gmail.com [Connection timed out #110]

I think the problem is not in the code, but in some server config but I have no idea.

  • You seem to be right. Have you authorized your gmail account to allow "less secure" apps? The link is: https://myaccount.google.com/lesssecureapps, just check the box.

  • I’d already done it and still the mistake continues.

  • Your application is in what environment?

  • https://stackoverflow.com/questions/28433816/how-to-fix-could-not-open-socket-in-zend-mail-zend-framework-2/28436702#28436702

1 answer

1


I found the problem, it was a block of my hosting, the digital Ocean by default blocks the sending of emails.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.