I am using Directadmin as hosting for my cakephp website. I have used gmail SMTP to send mail.
'EmailTransport' => [
'default' => [
'host' => 'localhost',
'port' => 25,
'username' => null,
'password' => null,
'client' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
'gmail' => [
'host' => 'smtp.gmail.com',
'port' => 587,
'username' => '[email protected]', //eg: sample[at]gmail.com
'password' => 'dummypassword', //email password
'className' => 'Smtp',
'tls' => true,
'client' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
],
The code is running properly on localhost but it is showing the following error on server
stream_socket_client(): Unable to connect to tcp://smtp.gmail.com:587 (Network is unreachable) please help with the solution