简体   繁体   中英

Laravel Mail Error

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!

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 .

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,
);

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,
);

Try changing these.

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

This configuration works for me in GoDaddy server.

确保您已启用google身份验证设置: https : //www.google.com/settings/security/lesssecureapps

change driver smtp to sendmail.it worked for me

MAIL_DRIVER=sendmail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM