메모

php mailer for php4... 펌

맘편한넘 2012. 7. 20. 09:21

내가 php 를 사용하고 있다면 한번 메일발송에 사용해 보자.

 

http://sourceforge.net/projects/phpmailer 소스 다운로드

 

소스를 풀고 아래의 스크립트를 만든다.

 

<?php

require("./PHPMailer_v5.1/class.phpmailer.php");  // 현재위치에서  class.phpmailer.php 파일을

포함 시킨다.

$test= new PHPMailer();

$test->IsSMTP();

$test->Host = "ssl://smtp.naver.com"; // 네이버 smtp 주소

$test->Port = 465;  // 네이버는 smtp ssl port 를 465 사용한다.

$test->SMTPAuth = true;  // 인증 하도록 옵션을 넣는다.

$test->Username = "abc@naver.com";  //인증 아이디

$test->Password = "1234"; //패스워드

$test->From = "abc@naver.com";

$test->AddAddress("ccc@hanmail.net","");

$test->IsHTML(true);

$test->Subject = "test-subject11111";

$test->Body = "body 내용"; //HTML Body가 들어간다.

$test->AltBody = "body 내용"  //text body 가 들어간다.

$test->Send();

?>

abc@naver.com 계정으로 1234 란 패스워드로 smtp 서버에 인증(AUTH) 하게 되고 ccc@hanmail.net 유저에게 test-subject11111 란 제목의 "body 내용"내용을 가진 메일을 발송하게 된다.

 

한번 사용해 보자..

 

은근히 편하다..