질문Q #18858
aws ses 사용 방법
닉네임 입니다2017-10-13 10:48:46

aws에서 사용허가 및 인증키를 받았는데

php 에서 어떻게 사용하나요??

아래 소스 보면서 하고 있는데

PHP Fatal error: Using $this when not in object context in E:\php\test.php on line 11  이런 에러가 나오는데

어떤걸 선언 해줘야 하나요??

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

$config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://email-smtp.us-west-2.amazonaws.com',
            'smtp_port' => 465,
            'smtp_user' => '인증키를넣으세요',
            'smtp_pass' => '인증키를 넣으세요',
            'mailtype'  => 'html',
            'charset'   => 'utf-8'
        );
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
         
        $this->email->from(""); //보내는쪽
        $this->email->to(""); //받는쪽
 
        $this->email->subject("aws mail test mail form origon!  !");
        $this->email->message("test!"); //메세지
        $status = $this->email->send();
         
        print_r($status);
        if($status) echo "이메일이 정상적으로 전송 되었습니다! form origon!";
        $this->email->print_debugger();
답변3
#1 이제다시 2017-10-13 11:39:13

$this 는 객체 안에서만 사용 가능합니다. 

 

CI 라이브러리를 사용하려면 CI 컨트롤러 내에서 해당 소스를 붙여 넣으세요.

#2 닉네임 입니다 2017-10-13 12:07:34

/이제다시

어떤 소스를 붙여 넣어야 하는건가요?? 개념이 아직 안잡혀서 ㅠ

#3 한대승(불의회상) 2017-10-13 12:59:02

@닉네임 입니다. 개념과 기초가 부족하다면 메뉴얼부터 차근차근 살펴 보세요.