2016-09-05 3 views
2

Ich stieß auf ein seltsames Problem. Seit gestern (oder so) weigert sich der php-Mailer, sich mit dem SMTP-Server zu verbinden. Das hat vorher gut geklappt. Ich überprüft, ob das Passwort oder irgendetwas anderes geändert wurde, aber es sollte alles richtig sein, aber ich diese Fehler bekommen:phpMailer smtp funktioniert nicht mehr

2016-09-05 10:06:43 SMTP ERROR: Failed to connect to server: Connection timed out (110) 2016-09-05 10:06:43 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

Mailer Fehler: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
Warning: Error while sending STMT_CLOSE packet. PID=25524 in Unknown on line 0 

der Setup-Code ist:

$mail->IsSMTP(); 
//$mail->SMTPDebug = 1;      
$mail->SMTPAuth = true;     
$mail->Host  = "smtp.office365.com"; 
$mail->Port  = 587;   
$mail->SMTPSecure = "tls"; 
$mail->Username = "theCorrectUsername"; 
$mail->Password = "theCorrectPassword"; 

Jede Idee, was könnte die Ursache sein?

Kleines Update:

es scheint, wie phpmailer kann nicht auf SMTP-Server verbinden ... Dies ist eine Firewall-Problem des Servers sein kann, wo die PHP-Datei ist?

Ein weiteres Update:

-> SMTPDebug = 2; gibt mir:

2016-09-05 17:11:31 Connection: opening to smtp.office365.com:587, timeout=30, options=array () 2016-09-05 17:12:01 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to smtp.office365.com:587 (Connection timed out) 2016-09-05 17:12:01 SMTP ERROR: Failed to connect to server: Connection timed out (110) 
+0

die Portnummer überprüfen, diese Google-Suche 'office365.com SMTP-Port number'' 587' schlägt vor, nicht korrekt ist, vielleicht verändert sie etwas – RiggsFolly

+0

ich es überprüft, sollte die richtige Schnittstelle sein für smtp – user2839873

+0

Lesen Sie den Fehlerbehebungsleitfaden, der mit der Fehlermeldung verknüpft ist. Führen Sie die Tests durch, um zu sehen, ob es DNS, Firewall-Block usw. ist. – Synchro

Antwort

0

Ich denke, Ihre Portnummer ist falsch. Verwenden Sie diese Demo-Code:

<?php 

//SMTP needs accurate times, and the PHP time zone MUST be set 
//This should be done in your php.ini, but this is how to do it if you don't have access to that 
#require '../PHPMailerAutoload.php'; 
//Create a new PHPMailer instance 
$mail = new PHPMailer; 
//Tell PHPMailer to use SMTP 
$mail->isSMTP(); 
//Enable SMTP debugging 
// 0 = off (for production use) 
// 1 = client messages 
// 2 = client and server messages 
$mail->SMTPDebug = 0; 
//Ask for HTML-friendly debug output 
$mail->Debugoutput = 'html'; 
//Set the hostname of the mail server 
$mail->Host = 'mail.domain.com'; 
// if your network does not support SMTP over IPv6 
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission 
$mail->Port = 25; 
//Set the encryption system to use - ssl (deprecated) or tls 
//$mail->SMTPSecure = 'tls'; 
//Whether to use SMTP authentication 
$mail->SMTPAuth = true; 
//Username to use for SMTP authentication - use full email address for gmail 
$mail->Username = "[email protected]"; 
//Password to use for SMTP authentication 
$mail->Password = "password"; 
//Set who the message is to be sent from 
$mail->setFrom('[email protected]', 'subillion'); 
//Set an alternative reply-to address 
#$mail->addReplyTo('[email protected]', 'Demo'); 
//Set who the message is to be sent to 
$mail->addAddress("[email protected]"); 

//Set the subject line 
$mail->Subject = 'Demo !!'; 
//Read an HTML message body from an external file, convert referenced images to embedded, 
$mail->isHTML(true); 

$msgbody = "This is a demo test !"; 
$mail->Body = $msgbody; 
//send the message, check for errors 
if (!$mail->send()) { 
// echo "Mailer Error: " . $mail->ErrorInfo; 
} else { 
    echo "Message sent!"; 
} 

?> 
+0

Danke, aber ich bekomme einen weiteren Verbindungsfehler: Verbindung: Verbindung zum Server fehlgeschlagen. Fehler Nummer 2. "Fehlermeldung: stream_socket_client(): keine Verbindung zu smtp.office365.com:25 (Zeitüberschreitung der Verbindung) Es hat gut funktioniert bis gestern mit Port 587, aber jetzt dauert es ewig zu verbinden und dann Gibt einen Zeitüberschreitungsfehler aus – user2839873

Verwandte Themen