2015-02-05 62 views
0

我刚刚开发了一个带有邮件系统的laravel web应用程序。 我有错误,如Lravel邮件不发送 - 无法建立与主机smtp.gmail.com的连接[连接超时#110]

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

控制器

Mail::send('timesheet/emailtemplate',array('data'=>$query),function($message) 
    { 
$message->to('[email protected]')->cc('[email protected]')->subject('Work Report on - '); 
    }); 

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

<h2>hai</h2> 

mail.php(配置)

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

回答

0

代替使用smtp使用Mandrill驱动程序它比使用smtp服务器更简单快捷。默认情况下,laravel附带Mandrill驱动程序。山魈需要狂饮4 HTTP库。对于该歌厅到您的项目中添加

"guzzlehttp/guzzle": "~4.0" 

composer.json文件(在你的项目的根目录)

enter image description here

应用程序/ config/mail.php

更改此行

'driver' => 'mandrill', 

https://mandrillapp.com/settings
和注册,并生成API密钥

创建一个应用程序/配置/ services.php配置文件,如果一个不存在的项目,并添加下面的配置和生成的API关键

return array(

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

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

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

); 

检查了这一点,这将有助于充分 Youtube video for setting up Mandrill for laravel

+0

Thnks很多猪头... – Jishad 2015-02-06 04:57:38

+0

如何通过mail100.us4.mandrillapp.com **在邮件中删除** – Jishad 2015-02-06 04:58:35

+0

app/config/mail.php ''from'=> array('address'=>'[email protected]', 'name'=>'webAdmin'),' 改变这一行:) – Alupotha 2015-02-06 05:30:44

相关问题