2013-08-26 4 views
2
<?php 
//error_reporting(E_ALL); 
error_reporting(E_STRICT); 
require_once('/PHPMailer/class.phpmailer.php'); 

$mail=new PHPMailer(); 
$body='blah body'; 
$mail->IsSMTP(); // telling the class to use SMTP 
$mail->Host="127.17.7.4"; // SMTP server 
$mail->Port=25; 
$mail->SMTPDebug=1;      // enables SMTP debug information (for testing) 
               // 1 = errors and messages 
               // 2 = messages only 

$mail->SetFrom('[email protected]', 'First Last'); 
$mail->AddReplyTo("[email protected]","First Last"); 
$address = "[email protected]"; //This will be my email address, that I want to receive the mail on 
$mail->AddAddress($address); 
$mail->Subject = "PHPMailer Test Subject via mail(), basic"; 
$mail->MsgHTML($body); 
if(!$mail->Send()) { 
    echo "Mailer Error: " . $mail->ErrorInfo; 
} else { 
echo "Message sent!"; 
} 
?> 

내가 PHPMailer 메일을 보내려고하고 연결하지 않고도 메일() 호출하지만 오류가 계속 : 정확한 오류 메시지PHPMailer() :

SMTP -> ERROR :에 실패 서버에 연결 : 연결된 파티 일정 시간 후에 제대로 응답하지 않았기 때문에 연결 시도가 실패, 또는 ​​연결된 호스트가 응답하지 않았기 때문에 설정된 연결에 실패했습니다. (10060)

주소에서 실패 다음 [email protected] : 메일()가 호출 메일러 오류에 연결하지 않고 : 주소에서 실패 다음 [email protected] : 메일() 호출

을 연결하지 않고

답변

5

smtp를 사용하는 경우 따라야하는 형식입니다.

$mail->IsSMTP();          // Set mailer to use SMTP 
$mail->Host = 'smtpout.secureserver.net'; // Specify main and backup server 
$mail->Port = '80'; 
$mail->SMTPAuth = true;        // Enable SMTP authentication 
$mail->Username = '';       // SMTP username 
$mail->Password = '';       // SMTP password 
$mail->SMTPSecure = '';       // Enable encryption, 'ssl' also accepted 


$mail->From = ''; 
$mail->FromName = ''; 
$mail->AddAddress('[email protected]', ''); // Add a recipient 
$mail->AddReplyTo('', 'reply'); 
//$mail->AddCC(''); 
$mail->AddBCC(''); 

$mail->WordWrap = 50;  
$mail->IsHTML(true);         // Set email format to HTML 

$mail->Subject = ''; 
$mail->Body = "<!DOCTYPE html> 
     <html lang='en-us'> 
      <head> 
       <meta charset='utf-8'> 
       <title></title> 

      </head> 
      <body> 
    <html>";