我試圖通過使用php郵件通過php發送電子郵件,但它顯示SMTP連接()失敗。這是我的代碼。無法找出那是什麼問題。如果有人幫助追蹤錯誤,那對我來說會非常有幫助。SMTP connect()失敗。雖然發送身份驗證電子郵件顯示coonect()faild
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'dds.uemtv.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('[email protected]', 'domain');
$mail->addReplyTo($email, '$name');
$mail->addAddress($email); // Add a recipient
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
$mail->isHTML(true); // Set email format to HTML
$bodyContent = '<h1>Your Registration Completed. </h1>'
$mail->Subject = 'Verify Account- Rozgar';
$mail->Body = $bodyContent;
if(!$mail->send()) {
echo $data->msg = $mail->ErrorInfo;
} else {
// echo 'Message has been sent';
echo $data->msg="Please Verify Your Email Address";
}
它顯示了SMTP連接()失敗 –
嘗試啓用調試,檢查下列答案https://stackoverflow.com/questions/2896280/debugging-php-mail-and-or-phpmailer – Aboudeh87