【问题标题】:Laravel 5.5 - mail not working with `mail` driverLaravel 5.5 - 邮件无法与“邮件”驱动程序一起使用
【发布时间】:2018-05-19 20:31:25
【问题描述】:

观察我的 Laravel 设置,邮件一直在工作,直到我将框架升级到 5.5(从 5.4 开始)。现在它总是在以下情况下失败:

请注意以下几点:

  1. 本地 env 上的邮件服务器 = http://www.toolheap.com/test-mail-server-tool/users-manual.html 我从 5 年前就开始使用它(这是一个一键式安装/无戏剧/无配置/无错误测试邮件服务器),直到昨天它仍然有效不要将其更改为其他内容
  2. 直接调用 php 的 mail() 函数可以工作
  3. 邮件驱动程序 ive 集只是 mail,但它仍然在此处发送到 sendmail(您可以转储 $command 并显示 /usr/sbin/sendmail -bs

这里是邮件的.env

MAIL_DRIVER=mail
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

那么有谁知道如何解决这个问题?它只在 laravel 5.5 中出演

非常感谢

【问题讨论】:

  • 您能否提供带有 MAIL_* 行和调用 Mail 函数的代码的 .env 配置?
  • 我现在已将其添加到问题中,请检查谢谢
  • 如果你直接使用 php 的 mail() 函数而不是 Laravel 的 Mail 门面,那么你可能需要在 php.ini 文件而不是 .env 文件中设置你的邮件驱动程序属性。
  • 我说IF 我直接使用mail()(即作为测试)。否则我使用邮件门面。

标签: php email php-7 swiftmailer laravel-5.5


【解决方案1】:

找到原因,因此不得不寻找替代解决方案。

[原因]:Swiftmailer 不再支持mail 传输

(见这里)

https://github.com/swiftmailer/swiftmailer/issues/866

https://github.com/octobercms/october/issues/3256

[解决方案]: 使用smtp 而不是mail

【讨论】:

【解决方案2】:

如果您不想使用smtp driver,可以使用'sendmail' 代替'mail'。不过,请确保在您的服务器上启用proc_open()

【讨论】:

    猜你喜欢
    • 2019-10-12
    • 1970-01-01
    • 2015-05-13
    • 2019-02-22
    • 2018-06-07
    • 2016-04-20
    • 2015-12-23
    • 1970-01-01
    • 2019-06-19
    相关资源
    最近更新 更多