Unable to send emails in Laravel using Swift Mailer - proc_open() function disabled by the provider

扶醉桌前 提交于 2019-12-31 03:25:06

问题


My web host disabled proc_open function in php and I can't send emails anymore.

I get this error log:

proc_open() has been disabled for security reasons

I use laravel default Swiftmailer. What can I do?


回答1:


proc_open should only be required when Swiftmailer is using an external executable, like sendmail. You should still be able to use a different transport like SMTP, Mailgun, or one of the other drivers described in the docs.

As a test, try using the SMTP driver, and just entering your own SMTP mail details - whatever you use to send mail from your mail client. Try the following in your .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)

This is probably not suitable for a permanent solution but will let you test that you can send mail without proc_open. I use the free tier of Mailgun and can recommend it.




回答2:


Check and changes are your php.ini has this line.

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

Check this a list of functions disabled by safe mode here.

UPDATE
Once you found that, follow below instruction: Remove the proc_open from the disable_functions at php.ini file

OR

Ask your hosting provider to remove the string above if you don't have an access/right to do that.



来源:https://stackoverflow.com/questions/45854659/unable-to-send-emails-in-laravel-using-swift-mailer-proc-open-function-disab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!