네임서버 정보
1차 ns.gnameserver.net
203.236.229.21
2차 ns2.gnameserver.net
203.236.229.20
입금 계좌 정보
은행: 우리은행
계좌: 810-184634-02-001
예금주: 전재우
선납가능(개월수 관계없음)
(납부자명에 회원 ID로 입금 후 납부내역등록,일대일 게시판에 알려주세요.)
(guideline QR code)
제목 :
PHP 에서 외부 smtp 서버 이용하기
글 번호
글자 크기 :
하루 50통 이상의 메일을 발송하실 경우 외부의 smtp 서버를
이용할 경우가 생깁니다. Java 의 경우는 자바메일 API 를
이용하시면 됩니다만, PHP 의 경우는 Linux 버전에서는 따로
라이브러리를 이용하셔야 합니다.
다음은 smtp class 라이브러리의 예제입니다.
다운받으실 주소는 http://www.phpclasses.org/browse.html/package/14.html 입니다.
아래는 저희가 작성한 예제입니다.
smtp_host_name 에는 사용하실 외부 smtp 서버의 호스트명을 입력하시면
됩니다. 자신의 PC 를 smtp 서버로 사용하실려면 자신의 PC 의 IP 를
입력하시면 됩니다.
<?php
if ($flag == "") {
?>
<html>
<title>Smtpclass Example</title>
<body>
<form method=post action="smtpclass.php">
<input type=hidden name=flag value="ok">
<table border=0 width=500>
<tr>
<td>smtp 서버 주소</td>
<td><input type=text name=smtp_host_name size=30></td>
</tr>
<tr>
<td>From:</td>
<td><input type=text name=smtp_from size=30></td>
</tr>
<tr>
<td>To:</td>
<td><input type=text name=smtp_to size=30></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type=text name=smtp_subject size=80></td>
</tr>
<tr>
<td>Body:</td>
<td><textarea name=body cols=80 rows=10></textarea></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Send"></td>
</tr>
</table>
</fotm>
</body>
</html>
<?php
}
else if ($flag == "ok") {
require("smtp.php");
$smtp = new smtp_class;
if(!function_exists("GetMXRR")) {
$_NAMESERVERS=array();
include("getmxrr.php");
}
$smtp->host_name = $smtp_host_name;
$smtp->localhost = "localhost";
$smtp->direct_delivery=0; /* Set to 1 to deliver directly to the recepient SMTP server */
$smtp->debug=0; /* Set to 1 to output the communication with the SMTP server */
$smtp->user=""; /* Set to the user name if the server requires authetication */
$smtp->realm=""; /* Set to the authetication realm, usually the authentication user e-mail domain */
$smtp->password=""; /* Set to the authetication password */
$body = $body;
$from = $smtp_from;
$bodytext = stripslashes($body);
$subject = $smtp_subject;
$to = $smtp_to;
if ($smtp->SendMessage($from, array($to),
array(
"From: $from",
"To: $to",
"Subject: $subject",
"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
),
"$bodytext"))
echo "$to Mail Send Success!n";
else {
echo "$to Mail Send Failed!!nError: ".$smtp->error."n";
}
}
?>
등록일
2003-03-31
조회수
29770
리스트 수 5 10 15 20 30 50 100 150
1 2 3 4 5 6 7 8
가이드라인 , 사업자등록번호 109-03-42915, 대표자 전재우
TEL) 070-4155-6478
통신판매번호 2022-서울성북-0661