【问题标题】:Unable to send mail from Laravel 4 on godaddy hosting无法在 Godaddy 主机上从 Laravel 4 发送邮件
【发布时间】: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


【解决方案1】:

您可以尝试其他端口:

return array(    
    'driver' => 'smtp',
    'host' => 'ailstore1.asia.secureserver.net',
    'port' => 465,
    'from' => array('address' => 'mail@mysite.in', 'name' => 'name'),
    'encryption' => 'ssl',   
    'username' => '',    
    'password' => '',
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => false
);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-03
    • 1970-01-01
    • 2018-04-27
    • 2015-11-27
    • 1970-01-01
    相关资源
    最近更新 更多