2012-05-23 3 views
0

codeigniter에서 mediatemple을 사용하여 전자 메일을 보낼 수 없습니다. 전자 메일 암호와 smtp 호스트를 확인했으며 올바른 내용입니다. 이 내 코드입니다mediatemple - codeigniter를 사용하여 전자 메일을 보낼 수 없습니다.

Severity: Notice 

Message: fwrite() [function.fwrite]: send of 12 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. 

Filename: libraries/Email.php 

Line Number: 1846 

: : 내 올바른 SMTP와 sxxxxx.gridserver.com을 교체 한

는 오류입니다.

function _sendEmail($from,$fromname,$to,$subject,$message){ 
      $config = array(
      'protocol' => 'smtp', 
      'smtp_host' => 'sxxxxx.gridserver.com', 
      'smtp_port' => 465, 
      'smtp_user' => '[email protected]', 
      'smtp_pass' => 'mypass' 
     ); 


     $this->load->library('email',$config); 
     $this->email->set_newline("\r\n"); 

     $this->email->from($from,$fromname); 
     $this->email->to($to); 
     $this->email->subject($subject); 
     $this->email->message($message); 
     $this->email->send(); 
    } 

어떤 도움을 주시면 감사하겠습니다.

편집 : 나는 당신이 the codeigniter documentation for the email class를 참조하여 설정을 초기화 할 필요가 포트 25

+0

당신이 SSL을 통해 연결하는과가 연결을 거부 있다면, 당신은 SSL이/사용/사용에 올바르게 구성 설치되어 있지 않은 가능성이 있습니다 당신의 섬기는 사람. 'phpinfo()'는 어떻게 생겼습니까? – Seabass

+0

SSL이 지원되고 사용 가능합니다. – user1217380

+0

로컬 컴퓨터에서 사용하고있을 수도 있습니다 – saravanabawa

답변

0

를 사용하여이 문제를 해결했습니다. 여기

잘 작동 나의 예 ...

function send_email($attributes) { 

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

     $this->email->set_newline("\r\n"); 

     $config['protocol'] = 'smtp'; 
     $config['smtp_host'] = 'host'; 
     $config['smtp_port'] = '465'; 
     $config['smtp_user'] = '[email protected]'; 
     $config['smtp_from_name'] = 'FROM NAME'; 
     $config['smtp_pass'] = 'XXX'; 
     $config['wordwrap'] = TRUE; 
     $config['newline'] = "\r\n"; 
     $config['mailtype'] = 'html';      

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

     $this->email->from($config['smtp_user'], $config['smtp_from_name']); 
     $this->email->to($attributes['to']); 
     $this->email->cc($attributes['cc']); 
     $this->email->bcc($attributes['cc']); 
     $this->email->subject($attributes['subject']); 

     $this->email->message($attributes['message']); 

     if($this->email->send()) { 
      return true;   
     } else { 
      return false; 
     }  

} 
+0

gmail에서는 작동하지만 mediatemple과는 작동하지 않는 코드는 mediatemple과 관련이 있습니다. 코드를 사용해 보았지만 동일한 오류가 발생했습니다. – user1217380

+0

나는 당신이 오류에 관해 Mediatemplate에 연락 할 필요가 있다고 생각한다. smtp 호스트에 문제가있는 것 같다. 아마도 메일을 보내지 못하게하는 보안 기능이있을 수 있습니다. –

+1

문제를 해결했습니다. 포트 456은 ssl에만 사용됩니다. 어쨌든 도움을 주셔서 감사합니다. – user1217380

관련 문제