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

Saturday, February 19, 2022

[FIXED] laravel5 and GoDaddy Exception when trying to send mail

 February 19, 2022     laravel, laravel-5, php     No comments   

Issue

as the title says, when I'm trying to send a mail with Laravel 5 and with a shared host in GoDaddy I get the following error.

    Swift_TransportException in StreamBuffer.php line 265:
    Connection could not be established with host >localhost [php_network_getaddresses: 
    getaddrinfo failed: Name or service not known #0]

This is the configuration that I'm using:

'driver' => 'smtp',
'host' => 'localhost',
'port' => 587,
'from' => array('address' => 'mail@domain.com', 'name' => 'name'),
'encryption' => 'tls',
'username' => 'cpanel user name',
'password' => 'cpanel password',
'sendmail' => '/usr/lib/sendmail -t',
'pretend' => false,

As the support guy from GoDaddy told me, I use the host as "localhost" instead my domain name but still getting the exception.

Can anyone give me a hand with the correct configuration please?


Solution

I had the same issue when I was using Godaddy web hosting and solved this by editing my .env file as,

MAIL_DRIVER=smtp
MAIL_HOST=XXXX.XXXX.in
MAIL_PORT=587
MAIL_USERNAME=dexxxxx
MAIL_PASSWORD=XXXXXXXX
MAIL_ENCRYPTION=tls

Where MAIL_HOST is your domain name from Godaddy, MAIL_USERNAME is your user name from Godaddy and MAIL_PASSWORD is your password from Godaddy.

I hope this may help you.



Answered By - AmarjaPatil4
  • 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