아주 쉽게 제공된다.
예시
<?
// mail send
$stringId = "code0gm@naver.com";
$header = "From:공명<code0gm@gmail.com>\r\n";
$header .= "Content-type:text/html\r\n";
$subject = "welcome to paperbus !";
$mailContent = "Congratulation <br>";
$mailContent .= "click this link and active your email! <br>";
$mailContent .= "<a href='http://test.nachal.com/login/active/?key=123123123'><font color=red>this link</font></a>";
$email = mail($stringId,$subject,$mailContent,$header);
if(!email) echo "mail send failed";
echo "완료";
?>
사용하기위해선 was의 mail관련 설정이 멀쩡한지 살펴본다
SMTP 가 어느서버인지 포트는 정상인지.
개발서버는 윈도우서버를 사용하기때문에 SMTP 서비스를 열어서 로컬에서 사용했다.
1. apache/conf/httpd.conf 수정
<IfModule mime_module> 내부에 추가
AddType application/x-httpd-php .php .html .htm .php3 .php4 .inc
AddType application/x-httpd-php-source .phps
모듈추가
LoadModule php4_module e:/project/php/php5apache.dll
* apache2.2와 php5.2는 안맞는다. 별도로 작업할꺼 아니면 피하기.
2. php.ini 수정
register_globals = Off (변수 전달방법에대한 설정)
default_charset = "euckr" (캐릭터셋 설정)
extension=php_mysql.dll (사용할 db 드라이버를 풀어준다.)
extension_dir = "E:/project/php53/ext" (기타 라이브러리)
3. 파일이동
php.ini -> windows
php5ts.dll -> windows/system32