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.

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!