윈도스 서버 회원메일 보내기 정보
윈도스 서버 회원메일 보내기첨부파일
본문
안녕하세요^^
몇일전 회원메일로 골치 많이 아팠습니다.
메일 테스트도, 테스트 메일도 보냈다고 창이 뜨지만 메일에는 무소식^^
리눅스는 거의 설정을 않해도 잘 나가지만 xp? windows? 는 메일이 않나간다는것...
너무 많이 도움만 받다가 혹이 도움이 되실지 올립니다.
첨부파일 중 smtp.lib.php은 lib 폴더에 넣고
mailer.lib.php 중
--------------------------------------------------------
// 메일발송 사용을 하지 않는다면
if (!$config[cf_email_use]) return;
$fname = "=?$g4[charset]?B?" . base64_encode($fname) . "?=";
$subject = "=?$g4[charset]?B?" . base64_encode($subject) . "?=";
//$g4[charset] = ($g4[charset] != "") ? "charset=$g4[charset]" : "";
$header = "Return-Path: <$fmail>\n";
$header .= "From: $fname <$fmail>\n";
$header .= "Reply-To: <$fmail>\n";
if ($cc) $header .= "Cc: $cc\n";
if ($bcc) $header .= "Bcc: $bcc\n";
$header .= "MIME-Version: 1.0\n";
//$header .= "X-Mailer: SIR Mailer 0.91 (sir.co.kr) : $_SERVER[SERVER_ADDR] : $_SERVER[REMOTE_ADDR] : $g4[url] : $_SERVER[PHP_SELF] : $_SERVER[HTTP_REFERER] \n";
// UTF-8 관련 수정
$header .= "X-Mailer: SIR Mailer 0.92 (sir.co.kr) : $_SERVER[SERVER_ADDR] : $_SERVER[REMOTE_ADDR] : $g4[url] : $_SERVER[PHP_SELF] : $_SERVER[HTTP_REFERER] \n";
if ($file != "") {
$boundary = uniqid("http://sir.co.kr/");
$header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n";
$header .= "--$boundary\n";
}
if ($type) {
$header .= "Content-Type: TEXT/HTML; charset=$g4[charset]\n";
if ($type == 2)
$content = nl2br($content);
} else {
$header .= "Content-Type: TEXT/PLAIN; charset=$g4[charset]\n";
$content = stripslashes($content);
}
$header .= "Content-Transfer-Encoding: BASE64\n\n";
$header .= chunk_split(base64_encode($content)) . "\n";
if ($file != "") {
foreach ($file as $f) {
$header .= "\n--$boundary\n";
$header .= "Content-Type: APPLICATION/OCTET-STREAM; name=\"$f[name]\"\n";
$header .= "Content-Transfer-Encoding: BASE64\n";
$header .= "Content-Disposition: inline; filename=\"$f[name]\"\n";
$header .= "\n";
$header .= chunk_split(base64_encode($f[data]));
$header .= "\n";
}
$header .= "--$boundary--\n";
}
@mail($to, $subject, "", $header);
}
--------------------------------------------------------
이 부분을 아래 소스로 교체
include_once "$g4[path]/lib/smtp.lib.php";
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
{
global $config;
global $g4;
$type_array = array("TXT","HTML");
$smtpserver = "mail.example.com"; //
$port = 25; //smtp
$smtpuser = "example@example.com"; //
$smtppwd = "password"; //
$mailtype = $type_array[$type]; //
$sender = $smtpuser; //
$smtp = new smtp($smtpserver,$port,true,$smtpuser,$smtppwd,$sender);
//$smtp->debug = false; //
$send=$smtp->sendmail($to,$sender,$subject,$content,$mailtype);
}
이 부분을 메일주소 비번을 설정해주시면 됩니다.
다만 보낸는 분 메일주소가 *** 개인정보보호를 위한 이메일주소 노출방지 *** 설정하신 메일로 나타납니다.
smtp.lib.php 파일은 UTF-8 파일입니다^^
저작권 혹은 관련 규정에 어긋난다면 자삭하겠습니다.
0
댓글 3개
위 내용은 서버구축해서 운영하시는 분들에게는 의미가 없을 수도 있겠지만 웹호스팅 이용자들에게는 효과적인 방법이라고 할 수 있습니다.
대부분 호스팅업체를 이용하다보면 서버ip가 블럭된 경우가 많아 화이트 도메인을 등록해도 포털사이트의 메일을 사용하는 유저에게는 수신이 안되더군요 이 경우 호스팅업체 문의해도 해결방법은 없다고 볼 수 있습니다
해결방법
1. 호스팅업체에서 지원하는 메일서버계정 생성
2. 위의 소스를 수정하시면 메일발송 및 수신 잘됩니다.