0

Hi I just uploaded a site and am getting this error with the mail service.

Connection could not be established with host smtp.gmail.com [Connection refused #111] 

This are my settings in my mail.php file.

return array(

'driver' => 'smtp',

'host' => 'smtp.gmail.com',

'port' => 587,

'from' => array('address' => 'info@thesite.com', 'name' => 'Company Name'),

'encryption' => 'tls',  

'username' => '*******',

'password' => '********',

'sendmail' => '/usr/sbin/sendmail -bs', 

'pretend' => false,

);

This works perfectly locally on my system but when i upload it live, it gives me errors, please help am at the verge of delivering a project, thanks!

Daniel Barde
  • 2,603
  • 5
  • 31
  • 40
  • The port has to be opened in order for this to work. Try ping/telnet to check for same, also check firewall settings which may be blocking connection. – Durgesh Chaudhary Jun 06 '14 at 05:37

6 Answers6

0

I also faced same problem. As for me I had changed my SMPT configuring to port 25 (with SSL) and it's was fine.

I got my solution from google, you can see at here.

  • That kind of workd but not it shows a different error like so. `Connection could not be established with host smtp.gmail.com [ #0]` – Daniel Barde Jun 06 '14 at 05:40
  • Sound like same problem with http://stackoverflow.com/questions/14176965/swift-transportexception-connection-could-not-be-established-with-host-smtp-gmai ! Please check it. –  Jun 06 '14 at 05:53
  • Was an issue from my server, am on shared host so i called customer care and they have it sorted out, thanks for the help anyways! (y) :) – Daniel Barde Jun 06 '14 at 07:05
0

Try googlemail server with ssl encryption

return array(

'driver' => 'smtp',
'host' => 'smtp.googlemail.com',
'port' => 465,
'from' => array('address' => 'info@thesite.com', 'name' => 'Company Name'),
'encryption' => 'ssl',  
'username' => '*******',
'password' => '********',
'sendmail' => '/usr/sbin/sendmail -bs', 
'pretend' => false,
);
Girish
  • 11,907
  • 3
  • 34
  • 51
  • Was an issue from my server, am on shared host so i called customer care and they have it sorted out, thanks for the help anyways! (y) :). You could help close this question for me, thanks! – Daniel Barde Jun 06 '14 at 07:06
0

Found the answer to the problem, was from my web host service providers, i use shared host so i had to call them to configure my account with them to be able to send out email, hope this helps anyone who has such problems like me in the future and this is a proper smtp configuration for gmail.

return array(

'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => 'info@thesite.com', 'name' => 'Company Name'),
'encryption' => 'ssl',  
'username' => '*******',
'password' => '********',
'sendmail' => '/usr/sbin/sendmail -bs', 
'pretend' => false,
);
Daniel Barde
  • 2,603
  • 5
  • 31
  • 40
0

Try changing these.

'driver' => 'mail',
'port' => 587,
'encryption' => 'ssl',

This configuration works for me in GoDaddy server.

Juni Brosas
  • 1,425
  • 2
  • 14
  • 24
0

be sure you google authentication settings are enabled: https://www.google.com/settings/security/lesssecureapps

Yish
  • 11
  • 3
0

change driver smtp to sendmail.it worked for me

MAIL_DRIVER=sendmail

Rajat Masih
  • 537
  • 1
  • 6
  • 19