Lravel邮件不发送-无法与主机smtp.gmail.com建立连接[连接超时#110]

时间:2022-11-15 11:16:55

I just developed a laravel web application with mail system. i got error like

我刚刚开发了一个带有邮件系统的laravel web应用程序。我有错误

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

controller

控制器

Mail::send('timesheet/emailtemplate',array('data'=>$query),function($message) 
    {
$message->to('example@gmail.com')->cc('expalecc@gmail.com')->subject('Work Report on - ');
    });

email template file : emailtemplate.blade.php

电子邮件模板文件:emailtemplate.blade.php

<h2>hai</h2>

mail.php (config)

邮件。php(配置)

'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => null, 'name' => null),
'encryption' => 'ssl',
'username' => 'myemail@example.com',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,

1 个解决方案

#1


0  

instead of using smtp use Mandrill Driver it is simpler and quicker than use smtp server. by default laravel comes with Mandrill Driver. mandrill required Guzzle 4 HTTP library.. for geting that into your project add

与使用smtp驱动程序不同,它比使用smtp服务器更简单、更快。默认情况下,laravel附带了man钻机驱动程序。mandrill需要Guzzle 4 HTTP库。用于将其添加到项目add中

"guzzlehttp/guzzle": "~4.0"

to your composer.json file (in your project root directory)

你的作曲家。json文件(在项目根目录中)

Lravel邮件不发送-无法与主机smtp.gmail.com建立连接[连接超时#110]

inside app/config/mail.php

在app / config / mail.php

change this line

改变这条线

'driver' => 'mandrill',

go to https://mandrillapp.com/settings
and sign up and generate api key

转到https://mandrillapp.com/settings并注册并生成api密钥

create an app/config/services.php configuration file if one does not already exist for your project and add below configurations and generated api key

创建一个应用程序/配置/服务。如果您的项目中还没有php配置文件,请添加以下配置和生成的api密钥

return array(

'mailgun' => array(
    'domain' => '',
    'secret' => '',
),

'mandrill' => array(
    'secret' => 'enter your mandrill api key here',
),

'stripe' => array(
    'model'  => 'User',
    'secret' => '',
),

);

check this out this will be help full Youtube video for setting up Mandrill for laravel

这将有助于完整的Youtube视频设置Mandrill for laravel

#1


0  

instead of using smtp use Mandrill Driver it is simpler and quicker than use smtp server. by default laravel comes with Mandrill Driver. mandrill required Guzzle 4 HTTP library.. for geting that into your project add

与使用smtp驱动程序不同,它比使用smtp服务器更简单、更快。默认情况下,laravel附带了man钻机驱动程序。mandrill需要Guzzle 4 HTTP库。用于将其添加到项目add中

"guzzlehttp/guzzle": "~4.0"

to your composer.json file (in your project root directory)

你的作曲家。json文件(在项目根目录中)

Lravel邮件不发送-无法与主机smtp.gmail.com建立连接[连接超时#110]

inside app/config/mail.php

在app / config / mail.php

change this line

改变这条线

'driver' => 'mandrill',

go to https://mandrillapp.com/settings
and sign up and generate api key

转到https://mandrillapp.com/settings并注册并生成api密钥

create an app/config/services.php configuration file if one does not already exist for your project and add below configurations and generated api key

创建一个应用程序/配置/服务。如果您的项目中还没有php配置文件,请添加以下配置和生成的api密钥

return array(

'mailgun' => array(
    'domain' => '',
    'secret' => '',
),

'mandrill' => array(
    'secret' => 'enter your mandrill api key here',
),

'stripe' => array(
    'model'  => 'User',
    'secret' => '',
),

);

check this out this will be help full Youtube video for setting up Mandrill for laravel

这将有助于完整的Youtube视频设置Mandrill for laravel