I am new to Laravel and I am using Laravel 5.0 in one of my application and I am trying to send an email via smtp in Larvel but I am getting this awkward error everytime, It is also not getting my host, Cannot paste whole error in title so here it is
Connection could not be established with host [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]
My .env file code:
MAIL_DRIVER=smtp
MAIL_HOST=mail.brownrice.com
MAIL_PORT=587
MAIL_USERNAME=cannot show user due to security
MAIL_PASSWORD=cannot show pass due to security
My app/mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'reservations@rezosystems.com', 'name' => 'Rezosystems'],
'encryption' => 'tls',
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
I am using this mail function in my MailController
Mail::send('EmailTemplates/test_email', ['msg' => 'Congratulations!!! Your first email template sent'], function($message)
{
$message->to('test@rezosystems.com', 'John Doe')->subject('Test!');
});