Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29758

Getting error while trying to send email in localhost php

$
0
0

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.

app.php

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


'Email' => [
    'default' => [
        'transport' => 'default',
        'from' => 'abc@gmail.com',

    ],
],

Controller class

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

        //THIS PATH NEEDS TO BE CHANGED DURING DEPLOYMENT
        $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


Viewing all articles
Browse latest Browse all 29758

Trending Articles