2017-12-04 18 views
0

PHPMailerが動作しておらず、次のエラーが発生しています。SMTPエラー:SMTPホストに接続できませんでした。 PHPMailer。 PHP

2017-12-04 13:34:14 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP y19sm20173980pgv.19 - gsmtp 
2017-12-04 13:34:14 CLIENT -> SERVER: EHLO solutions.proprompt.com 
2017-12-04 13:34:14 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [103.58.144.11]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8 
2017-12-04 13:34:14 CLIENT -> SERVER: STARTTLS 
2017-12-04 13:34:14 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 
SMTP Error: Could not connect to SMTP host. 
2017-12-04 13:34:14 CLIENT -> SERVER: QUIT 
2017-12-04 13:34:15 
2017-12-04 13:34:15 
SMTP Error: Could not connect to SMTP host. 
Message could not be sent.Mailer Error: SMTP Error: Could not connect to SMTP host. 

以前は正しく動作していました。私は次のコード行を使用しました:

$mail->SMTPDebug = 2;         // Enable verbose debug output 
    $mail->isSMTP();          // Set mailer to use SMTP 
    $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers 
    $mail->SMTPAuth = true;        // Enable SMTP authentication 
    $mail->Username = '[email protected]';     // SMTP username 
    $mail->Password = 'somepassword';       // SMTP password 
    $mail->SMTPSecure = 'tls';       // Enable TLS encryption, `ssl` also accepted 
    $mail->Port = 587; 

どこが間違っているか教えてください。

+4

** DONOT ** [phpmailerのヘルプトピック]を読む –

+1

ここにあなたの資格情報を投稿(https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail.phps) – Martin

+1

アイムこの質問は問題のソフトウェアのgitHubリポジトリ(PhpMailer)で具体的かつ完全に回答されているため、この質問を議論の対象外としています。 – Martin

答えて

1

次のコード行がこの問題を解決しました。

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false, 
'verify_peer_name' => false, 
'allow_self_signed' => true 
) 
); 
関連する問題