CI 묻고 답하기

제목 email 라이브러리가 동작하지않습니다.
카테고리 CI 2, 3
글쓴이 케케케 작성시각 2020/08/07 10:11:53
댓글 : 4 추천 : 0 스크랩 : 0 조회수 : 9006   RSS

email 라이브러리를 사용하여 메일 발송을하려고하는데

디버거를 찍어보니 다음과 같은 에러가 발생합니다.

서버 환경은 윈도우에서 도커환경입니다.

 

    function __construct() {

        parent::__construct();

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

    }

    public function test() {

            $config['protocol'] = 'mail';           

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

    

            $mailContents = "test";

            $title = "제목";

            $bcc = 'c@test.com';

            

            $this->email->from('a@test.com', 'bugboard');

            $this->email->to('b@test.com');

            $this->email->bcc($bcc);

            $this->email->subject($title);

            $this->email->message($mailContents);

            $this->email->send();       

            echo $this->email->print_debugger();

    }

 

 

 

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

Date: Fri, 7 Aug 2020 10:11:00 +0900
From: "bugboard" <a@test.com>
Return-Path: <a@test.com>
Bcc: c@test.com
Reply-To: <a@test.com>
User-Agent: CodeIgniter
X-Sender: a@test.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5f2caa24827fb@test.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
=?UTF-8?Q?=EC=A0=9C=EB=AA=A9?=
test

 

mail함수를 제대로 사용하지 못하는것 같습니다.

구글링을 하였지만 원하는 답변은 얻지 못하였는데

조언 부탁드립니다.

 다음글 php7 에서 ajax 오류 (9)
 이전글 CI 다중언어 사이트 제작시 궁금증 (1)

댓글

변종원(웅파) / 2020/08/07 10:52:39 / 추천 0

윈도우에서 메일을 발송할 수 있는 서버가 설치되어 있어야 합니다.

서버가 없다면 smtp로 발송하셔야 합니다.

케케케 / 2020/08/07 11:08:55 / 추천 0

웅파님 답변 감사드립니다.

해당 OS는 윈도우안에서 docker로 동작하고 있기때문에 Linux의 우분투환경입니다.

한대승(불의회상) / 2020/08/07 12:14:40 / 추천 0

메일 서버 동작중인지 확인 필요합니다.

php mail 라이브러리는 기본값이 sendmail로 지정되어 있는데 설치되어 있는지 확인 필요합니다.

메일 서버 동작하고 있다면 프로토콜을 smtp 로 수정하여 테스트 하여 보십시오.

케케케 / 2020/09/04 20:17:25 / 추천 0

smtp를 사용하여 해결하였습니다

한대승님 감사합니다