Reputation: 2787
I am working on a laravel 5 application. I recently hosted it on shared server and tried to reset the password. It is throwing the following exception.
Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host mailtrap.io [Connection timed out #110]
I am using default authentication driver.
The code in the Password controller is as follows:
<?php namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords;
class PasswordController extends Controller {
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Create a new password controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
* @return void
*/
public function __construct(Guard $auth, PasswordBroker $passwords)
{
$this->auth = $auth;
$this->passwords = $passwords;
$this->middleware('guest');
}
}
How can I solve this problem?
Upvotes: 1
Views: 5302
Reputation: 17553
in config/mail.php set 'encryption' => 'tls', or set port' => 587,
"Also know that Mailtrap.io is a fake SMTP server for development teams to test, view and share emails sent from the development and staging environments without spamming real customers"
Upvotes: 1
Reputation: 6411
you are getting this error because the default value set in your .env file located in the root of your project has these values
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
change them according to your requirement and if these values are set correctly then change the values of config/mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
by
'driver' => env('MAIL_DRIVER', 'mail'),
Upvotes: 3