[英]PHPMailer generates PHP Warning: stream_socket_enable_crypto(): Peer certificate did not match expected
[英]Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate with PHPMailer
我正在使用以下代碼發送郵件。 它在 gmail 服務器中運行良好,但不適用於我的域。
它顯示了一個錯誤,如
連接失敗。 錯誤 #2:stream_socket_enable_crypto():對等證書 CN=`*.999servers.com'
我該如何解決這個問題?
到目前為止,這是我的代碼:
require("PHPMailer/src/PHPMailer.php");
require("PHPMailer/src/SMTP.php");
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$mail->IsSMTP();
$mail->SMTPDebug = 4;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "mail.mydomain.in";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username = "mail";
$mail->Password = "password";
$mail->SetFrom($admin_user_mail);
$mail->AddAddress($login_user_mail);
$mail->AddCC($admin_user_mail);
$mail->Subject = "Mail Subject";
$mail->Body = "Mail Content";
if($mail->send())
{
echo "Mail Send";
} else
{
echo "Mail Not sent";
}
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.