2017-11-27 6 views
0

CodeIgniter의 구성 :PHPMailer SMTP connect()가 실패했습니다. 해결 방법?

$config['useragent']  = 'PHPMailer';    // Mail engine switcher: 'CodeIgniter' or 'PHPMailer' 
$config['protocol']   = 'smtp';     // 'mail', 'sendmail', or 'smtp' 
$config['mailpath']   = '/usr/sbin/sendmail'; 
$config['smtp_host']  = 'smtp.gmail.com'; 
$config['smtp_user']  = '[email protected]'; 
$config['smtp_pass']  = '####'; 
$config['smtp_port']  = 465; 

CodeIgniter는 컨트롤러 :

$this->load->library('email'); 
$this->email->from('[email protected]', 'Webers Infotech'); 
$this->email->to('[email protected]','Rushabh Shah'); 
$this->email->subject('Your Subject'); 
$this->email->message('Your Message'); 
if (!$this->email->send()) { 
    show_error($this->email->print_debugger()); 
} 

사람이 내가이 문제를 해결할 수있는 방법 말해 주시겠습니까? 왜 작동하지 않는거야?

+1

무엇이 오류입니까? –

+0

DNS 조회가 서버에서 손상된 경우 SMTP 연결에 실패하는 경우가 있습니다. 체크 했니 – Deep

+0

@DeepKakkar 아니요. 내가 확인하지 않았다. 그것을 어떻게 확인할 수 있습니까? –

답변

0

다음과 같은 코드를 확인할 수 있습니다

$this->load->library('email'); 

$config['protocol'] = 'smtp'; 
$config['smtp_host'] = 'smtp.app.com'; // if via gmail 'ssl://smtp.googlemail.com'; 
$config['smtp_user'] = '[email protected]'; 
$config['smtp_pass'] = 'smtp password'; 
$config['smtp_port'] = port number; 
$config['starttls'] = TRUE; 

$this->email->initialize($config); 

$this->email->from('[email protected]'); 
$this->email->to('[email protected]'); 
$this->email->subject('testing'); 
$this->email->message('Message content'); 

if($this->email->send()) { 
    echo 'Message has been sent'; 
} else { 
    $this->email->print_debugger(); 
} 

는 또한 php_smtp.dll을 확인합니다. 그게 가능한지 아닌지.

는 다음 찾을 수없는 경우 php.ini 파일을 확인

<?php 
phpinfo(); 
?> 

을 사용할 수 있으며

;extension=php_extname.dll 

단지를 제거 할 때 선이있을 것을 확인하려면; 이 줄에서 php 서비스를 다시 시작하십시오 (Apache를 다시 시작하십시오).

+0

afaik 거기에는'php_smtp.dll' 같은 것이 없습니다. – sintakonte