2011-10-10 3 views
2

보안 SMTP 전자 메일을 작성하기 위해 CodeIgniter 전자 메일 클래스를 사용하려고합니다. SSL 또는 TLS (선호). 과거에는 PHPMailer를 Secure Auth 및 TLS와 함께 성공적으로 사용했습니다. 나는 그것이 안전한 연결이라고 생각한다. 이메일 헤더에 TLS가 표시됩니다.CodeIgniter : PHPMailer 코드에서 SSL/TLS SMTP Auth 전자 메일

CodeIngiters의 전자 메일 클래스는 TLS로 안전한 SMTP 인증을 지원합니까?

참고로 Gmail에 관한 질문이 아닙니다. MS Exchange Server와 함께 사용하려고합니다. 아래의 PHPMailer 코드가 제대로 작동하는지 확인했습니다.

include_once('includes/class.phpmailer.php'); 
$mail = new PHPMailer(true); 
$mail->IsSMTP(); 
$mail->Host = 'www.domain.com'; 

$mail->SMTPAuth = true; 
$mail->SMTPSecure = "tls"; 
$mail->Port  = '25'; 
$mail->Timeout = '60'; 

$mail->Username = '[email protected]'; 
$mail->Password = 'password'; 

$mail->From  = '[email protected]'; 
$mail->FromName = 'Alerts'; 

$mail->Subject = 'Test from test email file.'; 
$mail->IsHTML(true); 
$mail->MsgHTML('This is just a test.'); 

// To 
$mail->AddAddress('[email protected]', 'Research'); 
$result = $mail->Send(); 

저는 CodeIgniter를 통해 이미 Email Class (MY_Email.php)를 확장했습니다. 수업은 여기에 게시하기에 조금 큽니다. 그러나 여기에 내가 계속 오류가 있습니다.

설정 :

array(7) { 
["smtp_host"]=> string(26) "tls://www.domain.com" 
["smtp_port"]=> string(2) "25" 
["smtp_user"]=> string(17) "[email protected]" 
["smtp_pass"]=> string(9) "password" 
["smtp_to_email"]=> string(26) "[email protected]" 
["smtp_from_email"]=> string(26) "[email protected]" 
["smtp_from_name"]=> string(24) "Test from Application" 
} 

오류 메시지 :

fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:func(143):reason(267)

267이 무엇인지 이유는 어떤 생각?

+1

더 많은 정보를 얻으려면 오류 코드를 Google로 보내거나 codeigniter에서 PHPMailer를 사용하십시오. CI의 소스 코드 옆에 다른 PHP 라이브러리를 사용할 수 있습니다. * 이미 작동중인 코드가 있다면 좋은 생각 일 수 있습니다 *. – hakre

+2

PHPMailer에서 작업하고 있다면 CI로 라이브러리로 포함하기 만하면됩니다. 저는 개인적으로 과거 CI의 이메일 클래스에 문제가 있었으며 똑같은 일을했습니다. – fire

답변

2

CI 포럼에서 해결책을 찾았습니다.

교환 이메일 클래스 패치 http://codeigniter.com/forums/viewthread/158882/

SMTP 서버가 연결 한 후 그것은 TLS 을 시작한다.

나를 위해 일했습니다. Jeff

+0

링크가 깨졌습니다. –

+1

CodeIgniter V3로 업그레이드하십시오. – jjwdesign

2

OpenSSL이 오류를 진단하는 방법 : 오류

error:1408F10B:SSL routines:func(143):reason(267) 

이 이유 코드 (267)를 가지고 결정 :

grep 267 /usr/include/openssl/ssl.h 
/usr/include/openssl/ssl.h:#define SSL_R_WRONG_VERSION_NUMBER     267 

지금 SSL_R_WRONG_VERSION_NUMBER을 위해 구글을 오류 메시지에서

첫 번째 히트 읽기 : http://www.mail-archive.com/[email protected]/msg02770.html

" 
    Many of SSL clients sends the first CLIENT HELLO with 
    ssl2 format (0x80.....) because they don't know what 
    version the server supports. 
    In this first message, the client sends the version 
    he wants to use (3 for SSL3), then the other exchanged 
    messages are in the appropriate format SSL3 for V3, 
    SSL2 for V2 etc.... 

    So in your server method configuration you must put: 
     SSL_CTX *ctx = SSL_CTX_new (SSLv23_server_method()) 
    to correctely analyse the first client_hello message 
    instead of 
     SSL_CTX *ctx = SSL_CTX_new (SSLv3_server_method()) 
    which i suppose you did. 
" 

결론 : SMTP 서버 따라서 SSLv3_server_method를 사용하고 대신 SSLv23를 사용하여 고정 될 필요가있다.

+0

phpinfo()에 따르면 - 등록 된 스트림 소켓 전송 : tcp, udp, unix, udg, ssl, sslv3, sslv2, tls. TLS 연결에 SSLV3을 사용하도록 PHP를 구성하는 방법이 있습니까? – jjwdesign

+0

당신이 이것을 제대로 이해하지 못한다고 생각합니다. 그러나 PHPMailer 클래스를 사용하면 괜찮습니까? – hakre