원문 Url : http://www.phpgenious.com/2010/04/send-php-mail-using-smtp/#more-390
downLoad : PHPMailer_v5.1.zip
- Auth 유무 및 HTML 유무 셋팅
실제 메일 발송시 쓰는 Class 파일은
class.phpmailer.php , class.smtp.php
위 2개의 파일입니다.
<?php include("class.phpmailer.php"); $mail = new PHPMailer(); $mail->ContentType = "text/html"; $mail->CharSet = "utf-8"; // 한글/한자 깨짐 방지 $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "host"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "id"; // SMTP username $mail->Password ="password"; // SMTP password $mail->From = "from mail"; //do NOT fake header. $mail->FromName = "from name"; $mail->AddAddress("to mail"); // Email on which you want to send mail $mail->AddReplyTo("reply mail", "rely name"); //optional $mail->IsHTML(true); $mail->Subject = "subject"; $mail->Body = "test mail"; if(!$mail->Send()) { echo $mail->ErrorInfo; }else{ echo "email was sent"; } ?>