SMTP ERROR: Failed to connect to server: (0) 2020-07-26 10:39:34 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'mail.yourdomain.com';
$mail->Port= '465'; //587 465
$mail->SMTPAuth = TRUE;
$mail->Username= 'user@yourdomain.com';
$mail->Password ='password';
$mail->SMTPSecure= 'ssl';
//$mail->SMTPAuth = SMTP_AUTH;
$mail->setFrom = 'user@domain.com';
$mail->FromName= 'User name';
$mail->AddAddress(hello@yourdomain.com, Testing);
$mail->WordWrap =50;
$mail->IsHTML= TRUE;
$mail->Subject = 'Forget Password';
$mail->MsgHTML('Testing');
$mail->IsHTML(true);
below these lines paste this
---------------------------------------------------------------------------
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
---------------------------------------------------------------------------
Why it shows error?
It worked successfully. The problem however is it's a bad idea because it goes against the whole idea of sending mail securely from one application to another.
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'mail.yourdomain.com';
$mail->Port= '465'; //587 465
$mail->SMTPAuth = TRUE;
$mail->Username= 'user@yourdomain.com';
$mail->Password ='password';
$mail->SMTPSecure= 'ssl';
//$mail->SMTPAuth = SMTP_AUTH;
$mail->setFrom = 'user@domain.com';
$mail->FromName= 'User name';
$mail->AddAddress(hello@yourdomain.com, Testing);
$mail->WordWrap =50;
$mail->IsHTML= TRUE;
$mail->Subject = 'Forget Password';
$mail->MsgHTML('Testing');
$mail->IsHTML(true);
below these lines paste this
---------------------------------------------------------------------------
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
---------------------------------------------------------------------------
Why it shows error?
It worked successfully. The problem however is it's a bad idea because it goes against the whole idea of sending mail securely from one application to another.
Report