회사에서 저는 Microsoft Exchange Server와 ofcourse ms Outlook을 사용하여 이메일을 보내고받습니다.PHPMailer 왜 연결 시간 초과 오류가 발생합니까?
andriod 우리 메일에 액세스하려면 다음과 같이 교환 신청서를 사용합니다.
내가 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
메일 서버에 연결하는 데 문제가 있습니다. ISP가 아웃 바운드 SMTP를 차단하기 때문일 수 있습니다. 오류 메시지가 링크 된 문제점 해결 안내서를 읽으십시오. – Synchro
그래, 그래도 알아 냈어. 아웃 바운드 SMTP가 차단되면 안드로이드에서 타사 앱을 사용하여 어떻게 연결할 수 있니? –
은 서버가있는 네트워크에서는 차단되지만 휴대 전화는 차단되어 있기 때문에 차단됩니다. 클라이언트 코드가 아니라 네트워크에 달려 있습니다. PHPMailer가 휴대 전화에서 실행 중이면 제대로 작동합니다. – Synchro