Getting error while trying to send email in localhost php-ThrowExceptions

Exception or error:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.


'EmailTransport' => [
    'default' => [
        //**'className' => MailTransport::class,
         * The following keys are used in SMTP transports:
        'host' => 'ssl://',
        'port' => 567,
        //'timeout' => 30,
        'username' => '',
        'password' => 'abc',
        'className' => 'Smtp',
       // 'client' => null,
        'tls' => true,
        //'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),

'Email' => [
    'default' => [
        'transport' => 'default',
        'from' => '',


Controller class

 public function mail()
        $session = $this->request->session();
        $id = $session->read('req_id');
        $email = new Email();
        $email->from(['' => 'abc REPLY']);
        $email->sender(['' => 'abc NO-REPLY']);
        $email->to(''); /** This must be changed to abc's confirmed email */
        $email->subject('abc Request Number : '.$id);

        $path = 'C:/xampp/htdocs/request_form/webroot/pdfresults/';
        $email->attachments($path. 'abc Cost Estimate Request Information_'.$id.'_'.'v.3online'.'.pdf');

        $email->send('Please look for the attachment to see the form. Cheers!');

enter image description here

email credential are correct. and tried turning off the firewalls as well but still not working

enter image description here

How to solve:

The error means exactly what it says – the service you’re trying to connect to doesn’t exist or is not responding.

This is explained two ways. Either the service you’re connecting to is indeed down, or you’re trying to connect to the wrong server or port.

In this case, it’s the latter. You’re trying to connect to an implicit TLS SMTP service on a port not associated with that service.

Change this:

'host' => 'ssl://',
        'port' => 567,


'host' => 'ssl://',
        'port' => 465,


'host' => 'tls://',
        'port' => 587,

Leave a Reply

Your email address will not be published. Required fields are marked *