CI 묻고 답하기

제목 메일발송이 안되는데 질문있습니다.
글쓴이 늅b 작성시각 2016/08/26 14:54:13
댓글 : 9 추천 : 0 스크랩 : 0 조회수 : 14357   RSS

소스는 아래와 같습니다..

DB수정작업을 마친뒤 결과를 메일로 발송해주는 로직중

메일 발송부분입니다.

 

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

 

$this->email->from('admin@test.com', $this->config->item('base_name'));

$this->email->to($this->input->post('email'));   //여기서 포스트 email은 사용자 이메일 주소 입니다.

 

$this->email->subject('['.$this->config->item('base_name').'] 문의 주신 내용에 대한 답변 입니다.');

$this->email->message('문의내용<br />'.$row->question.'<br /><br />답변내용'.$answer);

 

$this->email->send();

 

계속 에러가 나네요..

근데 궁금한건 메일정보 셋팅하고 해야할텐데 도대체 라이브러리만 로드해서 어떻게

메일이 나가는지도 잘 이해가 안가네요

 다음글 메일 smtp 관련 조언 부탁드립니다. (1)
 이전글 CI Rest Client (4)

댓글

kaido / 2016/08/26 15:02:40 / 추천 0

config 설정 안하셨죠?

$config['useragent'] = 'send user';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.naver.com';
$config['smtp_user'] = 'your@naver.com';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = 465; 
$config['smtp_timeout'] = 50;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;

 

 

라이브러리만 넣고 메일 전송 하는 소스는 appliction/config/ 폴더에 email.php 이런 파일 하나 만들어서 설정값을 공유 하고 있는것입니다.

늅b / 2016/08/26 15:05:25 / 추천 0
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;

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

매뉴얼에서 방금 이걸 찾았는데..

이걸 어디에 사용하는거죠? 

 

$this->load->library('email');
                $this->email->clear(true);
                $config['protocol'] = 'sendmail';
                $config['mailpath'] = '/usr/sbin/sendmail';
                $config['charset'] = 'iso-8859-1';
                $config['wordwrap'] = TRUE;
                $this->email->initialize($config);

 

이렇게쓰면될까요?

kaido / 2016/08/26 15:07:40 / 추천 0

네 그런식으로 사용하셔도 좋고 email.php 파일을 만드셔서 하셔도 좋고 helper 로 빼셔도 좋고.. 확장해서 사용하셔도 좋고.

 

편한쪽을 선택하세요

늅b / 2016/08/26 15:14:59 / 추천 0

 

늅b / 2016/08/26 15:15:36 / 추천 0
config설정을 해도 에러는 계속 뜨네용...ㅠㅠ
kaido / 2016/08/26 15:16:26 / 추천 0

php 시간 설정 안 하셨군요.

<?php

date_default_timezone_set('Asia/Seoul');  //디폴트 시간 설정

...

?>
해주시거나

php.ini 파일에서

[Date]
; Defines the default timezone used by the date functions
; ....

date.timezone = Asia/Seoul

이렇게 시간 설정

 

php.ini 시간 설정했으면 apache 재시작은 기본! 

늅b / 2016/08/26 15:36:07 / 추천 0

정말 염치불구 하고 마지막한개만 더 질문드려도 될까요..ㅠㅠ

public function subject($subject)
    {
        //$subject='=?UTF-8?B?' . base64_encode ( $subject ) . '?=';
        $subject = $this->_prep_q_encoding($subject);
        $this->_set_header('Subject', $subject);
        return $this;
    }

 

이부분에서 _set_header를 콜하는데 소스 다 찾아봐도

function _set_header 라는 메소드가 없는데 이 메소드 출처를좀 알수있을까요?

kaido / 2016/08/26 15:45:08 / 추천 0

해당 소스는 직접 만든 것입니다.

원본 소스 제작자에게 문의해 보세요.

 

function _func_name(){}

function func_name(){}

이 둘의 차이는 _ 가 붙으면 [외부에서는 접근 못하는 function 이라는 의미입니다.

 

늅b / 2016/08/26 15:46:20 / 추천 0
무슨이유에선지.. _set_header 가 아닌 set_header  메소드였네요 감사합니다