PHPMailerを使用してメールを送信していますが、 SSLではありません。私はそれからのメールが受信トレイに行っているが、私は私のホスティングの詳細を使用していたときに私のGmailのIDでsmtp.gmail.comを使用していた場合、私は$ mail-> SMTPSecureに$mail->SMTPSecure = 'tls';
を設定した場合、私はエラーStream_socket_enable_crypto():ピア証明書CN = `* .webhostbox.net 'が期待通りに一致しませんでした。CN =` mail.maydomain.com' PHPMailerを使用しています
Warning: stream_socket_enable_crypto(): Peer certificate CN=`*.webhostbox.net' did not match expected CN=`mail.mydomain.com' in C:\xampp\htdocs\sendmail\mail\class.smtp.php on line 337
Mailer Error: SMTP connect() failed.
を取得しています= 'false';エラーは表示されませんが、電子メールは迷惑メールになります。 私は以下のコードを試しました。
$mail->SMTPOptions = array (
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true));
あなたは私を助けてくれますか?
は
require 'mail/PHPMailerAutoload.php';
function sendMail($subject, $content, $email){
$phpMailerSubject = $subject;
$phpMailerText = $content;
$phpMailerTo = $email;
include 'mail/PHPMailerConfig.php';
}
PHPMailerConfig.php
<?php
//Create a new PHPMailer instance
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = 'mail.mydomain.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "Pass#@123";
$mail->setFrom('[email protected]', 'naren');
$mail->addReplyTo('[email protected]', 'naren');
$mail->addAddress($phpMailerTo, 'Customer');
$mail->Subject = $phpMailerSubject;
$mail->msgHTML($phpMailerText);
$mail->AltBody = ' ';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "sucessfully";
}
いずれにしても私を助けることができますか? –