2017-12-04 2 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

** **에서 [PHPMailer 도움말 항목]을 읽어 여기에 –

+1

을 자격 증명을 게시를이 donot 난 (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 
) 
); 
관련 문제