Laravel 4 无法与主机建立邮件连接 smtp.gmail.org
Laravel 4 Mail Connection could not be established with host smtp.gmail.org
我在发送电子邮件时总是收到错误消息。我已经在 php.ini 上打开了 open_ssl 。目前我正在使用 "guzzlehttp/guzzle": "~4.0" 作为邮件。
这是我的 mail.php 设置:
'driver' => 'smtp',
'host' => 'smtp.gmail.org',
'port' => 587,
'from' => array('address' => 'tokotonight456@gmail.com', 'name' => 'tonight'),
'encryption' => 'tls',
'username' => '', //i already set the username + pass correctly
'password' => '',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
Mail::send('mail', array('firstname'=>'budi'), function($message) {
$message->to('tokotonight456@gmail.com','lukas aa')->subject('Welcome to the Laravel 4 Auth App!');
});
使用 Mandrill 驱动程序而不是 smtp。 Laravel 随附。
在 app/config/mail.php
更改此行
'driver' => 'mandrill',
转到https://mandrillapp.com/settings
注册并创建一个 api 密钥
创建一个 app/config/services.php 配置文件并添加以下配置和 mandrill api 密钥
return array(
'mailgun' => array(
'domain' => '',
'secret' => '',
),
'mandrill' => array(
'secret' => 'enter your mandrill api key here',
),
'stripe' => array(
'model' => 'User',
'secret' => '',
),
);
我在发送电子邮件时总是收到错误消息。我已经在 php.ini 上打开了 open_ssl 。目前我正在使用 "guzzlehttp/guzzle": "~4.0" 作为邮件。 这是我的 mail.php 设置:
'driver' => 'smtp',
'host' => 'smtp.gmail.org',
'port' => 587,
'from' => array('address' => 'tokotonight456@gmail.com', 'name' => 'tonight'),
'encryption' => 'tls',
'username' => '', //i already set the username + pass correctly
'password' => '',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
Mail::send('mail', array('firstname'=>'budi'), function($message) {
$message->to('tokotonight456@gmail.com','lukas aa')->subject('Welcome to the Laravel 4 Auth App!');
});
使用 Mandrill 驱动程序而不是 smtp。 Laravel 随附。
在 app/config/mail.php
更改此行
'driver' => 'mandrill',
转到https://mandrillapp.com/settings
注册并创建一个 api 密钥
创建一个 app/config/services.php 配置文件并添加以下配置和 mandrill api 密钥
return array(
'mailgun' => array(
'domain' => '',
'secret' => '',
),
'mandrill' => array(
'secret' => 'enter your mandrill api key here',
),
'stripe' => array(
'model' => 'User',
'secret' => '',
),
);