连接尝试失败,因为连接方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应。
应用程序.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',
],
],
控制器类
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!');
}
电子邮件凭据是正确的。并尝试关闭防火墙但仍然无法正常工作
ABOUTYOU