无法使用 Swift Mailer 在 Laravel 中发送电子邮件 - 提供程序禁用了 proc_open() 函数

rob*_*caa 3 swiftmailer laravel

我的网络主机在 php 中禁用了proc_open功能,我无法再发送电子邮件。

我收到此错误日志:

> proc_open() has been disabled for security reasons
Run Code Online (Sandbox Code Playgroud)

我使用 Laravel 默认的 Swiftmailer。我能做什么?

Don*_*nic 5

proc_open只有当 Swiftmailer 使用外部可执行文件时才需要,比如 sendmail。您仍然应该能够使用不同的传输方式,例如 SMTP、Mailgun 或文档中描述的其他驱动程序之一。

作为测试,尝试使用 SMTP 驱动程序,只需输入您自己的 SMTP 邮件详细信息 - 无论您使用什么从邮件客户端发送邮件。在您的.env:

MAIL_DRIVER=smtp
MAIL_HOST=your.smtp.host // (copy from your mail client)
MAIL_PORT=your.smtp.port // (copy from your mail client)
MAIL_USERNAME=your.smtp.username // (copy from your mail client)
MAIL_PASSWORD=your.smtp.password // (copy from your mail client)
Run Code Online (Sandbox Code Playgroud)

这可能不适合永久解决方案,但可以让您测试是否可以在没有 proc_open 的情况下发送邮件。我使用 Mailgun 的免费层,可以推荐它。