【发布时间】:2015-07-23 19:00:36
【问题描述】:
我正在使用以下代码使用 Laravel 4 发送电子邮件。
Mail::send('emails.welcome', array('data' => 'This is a test content' ), function($message)
{
$message->to('mymail@site.com', 'TomTom')->subject('Welcome to Laravel!');
});
每当我尝试发送电子邮件时,都会引发以下错误:
A connection could not be established with the host
smtpout.asia.secureserver.net [Connection refused #111]
但是当我使用 php mail 功能发送电子邮件时,它工作正常!
var_dump(mail("mymail@site.com", "subject", "hello world"));
那么问题出在哪里?
【问题讨论】:
-
您能否提供您如何在 Laravel 4 中的 mail.php 下设置您的电子邮件,无需密码。否则我建议你使用 Mailgun 或 ManDrill 服务,少一些头痛。
-
@maytham 这里是 mail.php pastebin.com/PYLNjmeE
-
看到还没有找到解决方案,我会投票,所以也许其他人可以提出想法。
-
@Cody 您在该配置中没有用户名/密码。你审查了他们,还是空白?尝试将驱动程序切换到
mail(这是mail()使用的)或sendmail。 -
将
config/mail.php中的'driver' => 'smtp'更改为'driver' => 'sendmail'或'driver' => 'mail'
标签: php email laravel-4 swiftmailer