2017-12-04 5 views
0

PHPMailer funktioniert nicht und wirft folgenden Fehler.SMTP-Fehler: Verbindung zum SMTP-Host konnte nicht hergestellt werden. 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. 

Es funktionierte einwandfrei vorher. Ich habe folgende Codezeilen verwendet:

$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; 

Kann mir jemand sagen, wo es schief gelaufen ist?

+4

** Donot ** Posten Sie Ihre Zugangsdaten hier –

+1

Lesen Sie die [PHPMailer Hilfethemen] (https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail.phps) – Martin

+1

Ich bin Abstimmung, um diese Frage als off-topic zu schließen, weil diese Frage speziell und vollständig auf dem gitHub-Repository der betreffenden Software (PhpMailer) beantwortet wird. – Martin

Antwort

1

Folgende Zeilen des Codes lösten dieses Problem.

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false, 
'verify_peer_name' => false, 
'allow_self_signed' => true 
) 
); 
Verwandte Themen