2016-09-05 3 views
2

이상한 문제가 발생했습니다. 어제 (또는 그렇게) 이후 PHP 메일러는 SMTP 서버에 연결을 거부합니다. 이것은 이전에 잘 작동했습니다. 암호 또는 다른 어떤이 변경된 경우 내가 확인하지만, 모든 정확해야, 그러나 나는 이러한 오류 받고 있어요 :phpMailer smtp의 작동이 중지되었습니다.

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 

설치 코드입니다 : 무엇을 할 수

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

어떤 생각 원인이 되겠습니까?

리틀 업데이트 :

이 ... 이것은 PHP 파일이있는 서버의 방화벽 문제가 될 수있는 SMTP 서버에 연결할 수 없습니다 phpmailer 것 같아?

또 다른 갱신 :

-> SMTPDebug = 2; 나를 준다 :

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

포트 번호를 확인,이 Google 검색은'587'을 제안 number' 포트가 정확하지 office365.com SMTP, 어쩌면 그들이 뭔가 내가 그것을 확인 – RiggsFolly

+0

을 변경'에 대한 올바른 포트해야한다 smtp – user2839873

+0

오류 메시지에서 링크 된 문제 해결 설명서를 읽으십시오. 테스트가 DNS인지, 방화벽 블록인지 등을 확인하십시오. – Synchro

답변

0

나는 당신의 포트 번호가 맞지 않는다고 생각한다. 이 데모 코드를 사용

<?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

감사하지만 다른 연결 오류가 발생합니다. 연결 : 서버에 연결하지 못했습니다. 오류 번호 : 2. 오류 알림 : stream_socket_client() : smtp.office365.com:25에 연결할 수 없습니다 (연결 시간이 초과되었습니다) 어제까지 포트 587에서 정상적으로 작동했지만 지금은 영원히 연결되면 시간 초과 오류가 발생합니다. – user2839873

관련 문제