PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 1, 2022

[FIXED] Sending mail with Laravel on shared hosting

 February 01, 2022     email, laravel, laravel-5.5, php     No comments   

Issue

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.


Solution

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.



Answered By - Kristian Lilov
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing