계속 구글링해보다가 딱히 시원한 글이 없어서 질문드립니다 ..
ses를 그냥 단순히 텍스트로 만드는건 구현해봤는데요.
생각해보니 파일을 첨부해서 보내는 방식은 구현해보질 않아서
좀 막히는데요.. 제가 알기론 SimpleEmailService.php라는 파일을
aws측에서 배포하고 이것을 이용해서 이메일을 수신 발신하는걸로 아는데
http://stackoverflow.com/questions/23829198/aws-ses-with-attach-files
위의 링크에서 나오는 코드는 SimpleEmailService에서 제공하는 메소드도 아니고
뭔가 좀 이상해서요..어떤걸 참조해야할까요?? 영어 실력이 딸리다보니 너무 방대한 양의
영문 페이지는 보기가 조금 힘들긴 하지만 공유 부탁드리겠습니다 ㅠ
그리고 추가적으로 궁금한것이
wkhtmltopdf라는 프로그램을 사용해서 pdf를 다운로드하게하는 기능을 사용하고 있는데
만약에 이 pdf를 다운받으면 지정된 이메일로 이 파일을 첨부해서 전송하는 로직이 가능할까요?
일단은 서버에 저장을 하고 그파일을 이메일로 바로 전송하게끔요..
@kaido
답변 감사합니다 ㅎ
근데 파일 지정은 어디서하나요 ㅠ message에 따로 붙여줘야하는건가요 ?
제 기억이 맞다면 동일 할 겁니다.
$this->email->attach('/path/to/photo1.jpg');
smtp 프로토콜 사용법이 같듯이 말이죠.
정 안되면 aws-sdk 라이브러리 넣어서 사용 하시면 직방 입니다.
해보시고 안 되시면 제가 aws sdk 사용해서 만든거 뒤적거려서 올려드릴게요.
답변에 나온대로 하시면 됩니다.
맞는 말이에요.
다 풀어서 만들면 저렇게 됩니다.
아주 쉽게 CI 메일에 대입해서 풀면 이렇게 됩니다.
$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 "<br />이메일이 정상적으로 전송 되었습니다! form origon!"; $this->email->print_debugger();사전 작업으로 이메일SES 사용허가를 받으셔야 하구요.
사용가능한 인증키값을 넣어셔야합니다.
그리고 smtp_host 도 인증키값과 맞는 호스트를 넣어주셔야 하구요.
생각보다 너무 간단해서 에이~ 싶어보이시죠? 근데 저게 전부 맞습니다.
이런식으로도 표현 됩니다.
$this->load->library('email'); $config['mailtype'] = 'html'; $config['useragent'] = 'ses-smtp-user.20160628-105419'; //origon $config['protocol'] = 'smtp'; $config['smtp_host'] = 'tls://email-smtp.us-west-2.amazonaws.com'; //origon $config['smtp_user'] = '인증키를 넣으세요'; $config['smtp_pass'] = '인증키를 넣으세요'; $config['smtp_port'] = '465'; $config['charset'] = 'utf-8'; $config['crlf'] = '\r\n'; //should be "\r\n" $config['newline'] = '\r\n'; //should be "\r\n" $config['wordwrap'] = TRUE; $config['smtp_crypto'] = 'tls'; // TLS protocol $config['email_newline'] = "\r\n"; // SES hangs with just \n $this->email->initialize($config); $this->email->from("",'별명); //보내는쪽 $this->email->to(""); //받는쪽 $this->email->subject("aws mail test mail form origon! !"); $this->email->message("test!"); //메세지 $status = $this->email->send(); if($status) echo "<br />이메일이 정상적으로 전송 되었습니다! form origon!"; $this->email->print_debugger();$config 에 해당 하는 부분은 config/email.php [없으면 해당 파일 만드세요.]
안에다가 기술하셔도 됩니다.