我使用以下代码使用Laravel 4发送电子邮件。
Mail::send('emails.welcome', array('data' => 'This is a test content' ), function($message)
{
$message->to('[email protected]', 'TomTom')->subject('Welcome to Laravel!');
});
每当我尝试发送电子邮件时,它都会引发以下错误:
A connection could not be established with the host
smtpout.asia.secureserver.net [Connection refused #111]
但是当我使用php邮件功能发送电子邮件时,它工作正常!
var_dump(mail("[email protected]", "subject", "hello world"));
那有什么问题呢?
你可以尝试另一个端口:
return array(
'driver' => 'smtp',
'host' => 'ailstore1.asia.secureserver.net',
'port' => 465,
'from' => array('address' => '[email protected]', 'name' => 'name'),
'encryption' => 'ssl',
'username' => '',
'password' => '',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false
);