无法在Laravel中使用Swift Mailer发送邮件 - proc_open()函数被供应商禁用

问题描述:

我的web主机被禁用proc_open函数在php中,我无法再发送电子邮件。无法在Laravel中使用Swift Mailer发送邮件 - proc_open()函数被供应商禁用

我得到这个错误日志:

proc_open()已因安全原因

我用laravel默认Swiftmailer禁用。 我能做什么?

+0

你使用哪种操作系统? – lewis4u

+0

你使用什么邮件驱动程序,你的邮件配置是什么? –

+0

MAIL_DRIVER = sendmail MAIL_HOST = localhost MAIL_PORT = 25 – robcaa

proc_open只有在Swiftmailer使用外部可执行文件(如sendmail)时才需要。您仍然应该能够使用文档中描述的SMTP,Mailgun或one of the other drivers等不同的传输方式。

作为测试,请尝试使用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) 

这可能是不适合永久的解决方案,但将让你测试,你可以发送邮件,而proc_open。我使用免费的Mailgun层,并可以推荐它。

检查和修改是你的php.ini有这条线。

disable_functions = exec,system,dl,passthru,chown,shell_exec,popen,proc_open 

查看此安全模式已禁用的功能列表here

UPDATE
一旦发现,请按照以下说明: 在php.ini文件中删除从disable_functions选项的proc_open

OR

问问你的托管服务提供商,以除去上面的字符串如果你没有访问权/权利来执行此操作。

+0

我调用了phpinfo()并搜索了proc_open()。结果如下: disable_functions:\t dl,system,passthru,kill,virtual,http_connect,connect,link,popen,...,openlog,shell_exec,exec,** proc_open ** – robcaa

+0

@robcaa:Great:Check *更新*从我的答案... –

+0

我问我的主机。我收到了这个答案:**此功能未启用,我们不会因安全原因将其重新启用。** – robcaa