duan6832168 2017-11-14 16:45
浏览 58
已采纳

在共享主机上使用Laravel发送邮件

I'm trying to send mail from my website.

I'm using laravel 5.5 and the shared hosting of hostnet.nl.

I'm very sure i have all my configuration correct..

My .env :

MAIL_DRIVER=mail
MAIL_HOST=smtp02.hostnet.nl
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=TLS

But when i try to send mail this allways returns

Whoops there was an error:

proc_open() has been disabled for security reasons I already chat with the hosting company and they said this is not a php setting that is allowed to be changed. So i cannot enable this.

When i try to set MAIL_DRIVER=smtp it says connection refused.

I have another laravel installation/website at this shared hosting, which has the same MAIL_DRIVER=mail and this works perfectly.

This installation is on laravel 5.2.*

Is this something that has changed inside swiftmailer from laravel 5.2 to 5.5?

I don't know how to fix this issue.

Any help is appreciated.

  • 写回答

1条回答 默认 最新

  • duandao2306 2017-11-14 17:31
    关注

    You should try changing this :

    MAIL_DRIVER=mail
    

    There is no "mail" driver for laravel's mailing service (Laravel 5.5), you could have problems with the "smtp" because of wrong credentials. I think Laravel 5.2 might be using php's built-in "mail()" function when the "mail" driver is set, which could work on some shared hosting and fail on other.

    Most shared hosting providers allow sending via the default server "sendmail" so you could also try this :

    MAIL_DRIVER=sendmail
    

    If you can't get "sendmail" or "smtp" to work, you could try the "mailgun" or any other external mail service provider. Mailgun for example gives you 10 000 free mails per month so you will not need any paid subscriptions and the set-up tutorials are very easy, plus you have great tools for monitoring the sent mails.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效