2017-04-17 1 views
1

PHPMailer로 이메일을 보낼 수 없습니다. 나는 이미 이것에 대해 질문을 많이 읽고 그러나 아무도이 내 설정이다 나에게PHPMailer 오류 :

을 도울 수 있습니다

$this->IsSMTP(); 
$this->SMTPAuth = true; 
$this->SMTPDebug = 2; 
$this->CharSet = "UTF-8"; 
$this->Port = 587; 
$this->Host = gethostbyname('smtp.googlemail.com'); //fix ipv6 problems 
$this->SMTPSecure = 'tls'; 

그리고 이것은 디버그입니다 :

SMTP -> FROM SERVER:220 smtp.googlemail.com ESMTP m62sm4902317qte.5 - gsmtp 
SMTP -> FROM SERVER: 250-smtp.googlemail.com at your service, [189.61.226.25] 
250-SIZE 35882577 
250-8BITMIME 
250-STARTTLS 
250-ENHANCEDSTATUSCODES 
250-PIPELINING 
250-CHUNKING 
250 SMTPUTF8 
SMTP -> FROM SERVER:220 2.0.0 Ready to start TLS 
SMTP -> FROM SERVER: 
SMTP -> ERROR: RSET failed: 
SMTP -> NOTICE: 
EOF caught while checking if connected 

+0

[SMTP GMAIL 연결] 가능한 복제본 (http://stackoverflow.com/questions/31058038/smtp-gmail-connection) –

+0

동일한 문제가 아니라 연결할 수 있습니다. 문제는 TLS 프로토콜이 시작된 후입니다. –

+0

PHPMailer의 오래된 버전을 사용합니다. 최신 정보. – Synchro

답변

-1

당신에게 이것을 사용할 수 있습니다

define('GUSER', '[email protected]'); // GMail username 
    define('GPWD', 'Password'); // GMail password 
global $error; 
    require_once('phpmailer/class.phpmailer.php'); 
$mail = new PHPMailer(); // create a new object 
//$mail->IsSMTP(); // enable SMTP 
$mail->SMTPDebug =1; // debugging: 1 = errors and messages, 2 = messages only 
$mail->SMTPAuth = true; // authentication enabled 
    $mail->SMTPSecure = false; 
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail 
$mail->Host = 'smtp.gmail.com'; 
$mail->Port = 465; 

$mail->Username = GUSER; 
$mail->Password = GPWD;   
$mail->SetFrom($from, $from_name); 
$mail->Subject = $subject; 


    $mail->IsHTML(true); // send as HTML 

    $mail->Body = $body; 
    $mail->AltBody = $mail->Body; 

$mail->AddAddress($to); 
+0

쓸데없는 예제를 기반으로하는 설명되지 않은 코드 게시물. 질문에 대답하려고하지 않습니다. – Synchro