웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
네이버 SMTP로 인증메일 보내기
2013.08.26 01:26
참고함 : http://www.xpressengine.com/tip/20953744, http://help.naver.com/ops/step2/faq.nhn?faqId=27449
http://www.xpressengine.com/tip/20953744 의 구글 SMTP를 이용하여 인증메일 보내는 방법을 응용하여
네이버 Works 도메인 메일을 통해 메일을 보내는 방법을 한번 써 봅니다.
구글 방법과 똑같이
mail.class.php 를 열어서
function useNaverAccount($account_name, $account_passwd) { $this->SMTPAuth = TRUE; $this->SMTPSecure = "tls"; $this->Host = 'dsmtp.naver.com'; $this->Port = '587'; if($this->isVaildMailAddress($account_name)) { $this->Username = $account_name; } else { $this->Username = $account_name . '@사용하는도메인'; } $this->Password = $account_passwd; $this->IsSMTP(); }
이 코드를 대략 150~160라인대의 function useGmailAccount 가 끝나는 지점에 붙여넣어주시고
그다음 function mail() 에
function
Mail()
{
$this
->useNaverAccount(
"사용할 이메일주소"
,
"네이버 비밀번호"
);
}
이렇게 넣어주면 됩니다.
네이버메일, 한메일, 네이트메일, 지메일은 제가 테스트해본 결과 잘 갑니다.
PS : PHP에 대한 지식이 전무한지라 GoogleAccount의 코드를 네이버로 수정한 터라, 이상한 부분이 있을 수도 있습니다. 단 제가 XE 1.7.3.4 + PHP 5.3 + 깡패24 호스팅(간접광고 방지용 가명) 환경에서 테스트했을땐 잘 됬습니다.
PS2 : @naver.com 으로 이용할 시는 이렇게 하면 될겁니다.(테스트 안해봤습니다!!!)
function useNaverAccount($account_name, $account_passwd) { $this->SMTPAuth = TRUE; $this->SMTPSecure = "tls"; $this->Host = 'smtp.naver.com'; $this->Port = '587'; $this->Username = $account_name; $this->Password = $account_passwd; $this->IsSMTP(); }
그리고 mail() 코드에는 네이버 아이디와 비밀번호를 입력하면 될듯 합니다.