2017-04-02 2 views
-2

회사에서 저는 Microsoft Exchange Server와 ofcourse ms Outlook을 사용하여 이메일을 보내고받습니다.PHPMailer 왜 연결 시간 초과 오류가 발생합니까?

andriod 우리 메일에 액세스하려면 다음과 같이 교환 신청서를 사용합니다.

enter image description here

내가 PHP에서 이메일을 전송하려면 다음 코드를 사용하는 것을 시도하고있다 : 많이

require 'PHPMailer/PHPMailerAutoload.php'; 

$mail = new PHPMailer; 

$mail->SMTPDebug = 3;        // Enable verbose debug output 

$mail->isSMTP();          // Set mailer to use SMTP 
$mail->Host = 'mail.dom-domain.com'; // Specify main and backup SMTP servers 
$mail->SMTPAuth = true;        // Enable SMTP authentication 
$mail->Username = 'username';     // SMTP username 
$mail->Password = 'password123';       // SMTP password 
$mail->SMTPSecure = 'tls';       // Enable TLS encryption, `ssl` also accepted 
$mail->Port = 587;         // TCP port to connect to 

$mail->setFrom('[email protected]', 'Mailer'); 
$mail->addAddress('[email protected]', 'Joe User');  // Add a recipient 
//$mail->addAddress('[email protected]');    // Name is optional 
$mail->addReplyTo('[email protected]', 'Information'); 
//$mail->addCC('[email protected]'); 
//$mail->addBCC('[email protected]'); 

//$mail->addAttachment('/var/tmp/file.tar.gz');   // Add attachments 
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name 
$mail->isHTML(true);         // Set email format to HTML 

$mail->Subject = 'Here is the subject tls587'; 
$mail->Body = 'This is the HTML message body tls587 <b>in bold!</b>'; 
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients tls587'; 

if(!$mail->send()) { 
    echo 'Message could not be sent.'; 
    echo 'Mailer Error: ' . $mail->ErrorInfo; 
} else { 
    echo 'Message has been sent'; 
} 

하지만 페이지가로드 나는이 오류 얻을 :

2017-04-02 13:13:45 Connection: opening to mail.dom-domain.com:587, timeout=300, options=array () 2017-04-02 13:14:48 Connection failed. Error #2: stream_socket_client(): unable to connect to mail.dom-domain.com:587 (Connection timed out) [/home/xxxxxxx/public_html/ml/PHPMailer/class.smtp.php line 294] 2017-04-02 13:14:48 SMTP ERROR: Failed to connect to server: Connection timed out (110) 2017-04-02 13:14:48 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

+0

메일 서버에 연결하는 데 문제가 있습니다. ISP가 아웃 바운드 SMTP를 차단하기 때문일 수 있습니다. 오류 메시지가 링크 된 문제점 해결 안내서를 읽으십시오. – Synchro

+0

그래, 그래도 알아 냈어. 아웃 바운드 SMTP가 차단되면 안드로이드에서 타사 앱을 사용하여 어떻게 연결할 수 있니? –

+0

은 서버가있는 네트워크에서는 차단되지만 휴대 전화는 차단되어 있기 때문에 차단됩니다. 클라이언트 코드가 아니라 네트워크에 달려 있습니다. PHPMailer가 휴대 전화에서 실행 중이면 제대로 작동합니다. – Synchro

답변

0

보관할를 안드로이드 장치에서 포트 443을 통해 대부분 Microsoft Active Sync를 사용하고 있다고 언급했습니다. 포트 587을 통해 기본 SMTP 연결을 사용하지 마십시오 ould는 IMAP/POP3를 통해 사용됩니다.) HTTP/Outlook Anywhere를 통한 MAPI 또는 MAPI가 사용되는 일반 Outlook 연결에서도 마찬가지입니다. 두 가지 모두 네이티브 SMTP 연결을 사용하지 않으며 작동하지 않는 이유 일 수 있습니다. 하지만 GMail 계정에서는 IMAP을 주로 사용합니다. Microsoft Active Sync를 지원하는 Exchange Server가 아니기 때문입니다.

따라서 Exchange 관리자가 Outlook 사용자의 외부 인증 연결에 대해 SMTP 커넥터를 구성하지 않았을 수 있으므로 보안상의 이유로이 기능이 필요하지 않을 수 있습니다. 당신이 Exchange 관리자이고 어떤 버전을 사용하고 있는지 명시하지 않았으므로 여기에 방법을 알려주기가 쉽지 않습니다. 그래서 대신에, 당신은 Microsoft에서 여기이 하우투을 따라야합니다 :

당신은 Microsoft Exchange 관리자를 됐소 경우는 Microsoft Exchange를 통해 이메일을 보내려고 수 있습니다 웹 서비스 (here 참조). 그러나 위에서 말한 것처럼 Exchange 관리자는 환경을 보호하기 위해 여기에서 특별한 구성을 실행할 수 있습니다.