2017-11-28 5 views
0

안녕하세요. 내 CI 프로젝트에서 PHPMailer를 설정하는 데 어려움을 겪고 있습니다. 문제는 독서를 많이 한 후에 모든 것이 다 해결되었다고 생각했지만 아니었다.CodeIgniter에서 PHPMailer가 작동하지 않습니다.

: 내 공개 함수 내에서, 나는 다음과 같은 일을 해요,

require './vendor/autoload.php'; 
use PHPMailer\PHPMailer\PHPMailer; 

다음 :

나는 곧 내가 내 컨트롤러에 PHP 태그를 열면, 모든 클래스 외부 폴더를 전화 드렸습니다

2017-11-28 14:24:37 Connection: opening to smtp.gmail.com:587, timeout=300, options=array() 
2017-11-28 14:24:38 Connection: opened 
2017-11-28 14:24:38 SMTP INBOUND: "220 smtp.gmail.com ESMTP d15sm21670245qkc.26 - gsmtp" 
2017-11-28 14:24:38 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP d15sm21670245qkc.26 - gsmtp 
2017-11-28 14:24:38 CLIENT -> SERVER: EHLO localhost 
2017-11-28 14:24:38 SMTP INBOUND: "250-smtp.gmail.com at your service, [190.104.220.99]" 
2017-11-28 14:24:38 SMTP INBOUND: "250-SIZE 35882577" 
2017-11-28 14:24:38 SMTP INBOUND: "250-8BITMIME" 
2017-11-28 14:24:38 SMTP INBOUND: "250-STARTTLS" 
2017-11-28 14:24:38 SMTP INBOUND: "250-ENHANCEDSTATUSCODES" 
2017-11-28 14:24:38 SMTP INBOUND: "250-PIPELINING" 
2017-11-28 14:24:38 SMTP INBOUND: "250-CHUNKING" 
2017-11-28 14:24:38 SMTP INBOUND: "250 SMTPUTF8" 
2017-11-28 14:24:38 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [190.104.220.99]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8 
2017-11-28 14:24:38 CLIENT -> SERVER: STARTTLS 
2017-11-28 14:24:39 SMTP INBOUND: "220 2.0.0 Ready to start TLS" 
2017-11-28 14:24:39 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 
2017-11-28 14:24:39 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [C:\xampp\htdocs\crm\vendor\phpmailer\phpmailer\src\SMTP.php line 403] 
SMTP Error: Could not connect to SMTP host. 
2017-11-28 14:24:39 CLIENT -> SERVER: QUIT 
2017-11-28 14:24:39 
2017-11-28 14:24:39 
2017-11-28 14:24:39 
2017-11-28 14:24:39 Connection: closed 
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

어떤 제안 :

$mail = new PHPMailer; 
    $mail->isSMTP(); 
    $mail->SMTPDebug = 5; 
    $mail->Host = 'smtp.gmail.com'; 
    $mail->Port = 587; 
    $mail->SMTPSecure = 'tls'; 
    $mail->SMTPAuth = true; 
    $mail->AuthType = 'XOAUTH2'; 
    $mail->Username = "username"; 
    $mail->Password = "password"; 

    // Content // 

    $mail->setFrom('[email protected]'); 
    $mail->AddReplyTo('[email protected]'); 
    $mail->addAddress('[email protected]', 'Contacto'); 
    $mail->Subject = 'This is the subject'; 
    $mail->Body = 'This is the message'; 

    if (!$mail->send()) { 
     echo "Mailer Error: " . $mail->ErrorInfo; 
    } else { 
     echo "Awesome sauce!"; 
    } 

그래서, 여기에 디버거의 말씀입니까?

+0

예 - 오류로 연결되는 문제 해결 안내서를 읽으십시오. TLS 오류가 발생했습니다. 여기에 많은 질문이 있지만 잘 설명되어 있습니다. – Synchro

+0

[PHPMailer 5.2 OpenSSL 오류 메시지 : 14090086 : SSL 루틴 : SSL3 \ _GET \ _SERVER \ _CERTIFICATE : 인증서 확인에 실패했습니다.] (https://stackoverflow.com/questions/41511825/phpmailer-5-2-openssl) -error-messages-error14090086ssl-routinesssl3-get-serve) – Synchro

+0

지금 꽤 오랫동안 읽었습니다. 아직 해결책을 찾지 못했습니다. –

답변

0

나는 이번 주에 똑같은 문제를 겪었다.

해결책을 얻었습니까?

감사합니다.