묻고답하기

2004년도에 홈페이지 만들면서 썼던 소스로 작업을 했습니다. 메일은 첨부파일까지 잘 오는데 빈 메일이 꼭 함께 오네요.
예전엔 그러지 않았거든요. 그땐 엠파스에서 포워딩으로 메일을 받았었구요,
지금은 가비아에서 호스팅 중이라 가비아에서 제공하는 웹메일을 사용중입니다.

빈 메일은 아래와 같은 형식으로 옵니다.
보낸 사람이 nobody@linux2-10.gabia.com  제목은 [제목없음] 그리고 내용은 없이....

소스에서 무엇을 고쳐야 하는 걸까요? 아니면 가비아 메일서버에서 자동으로 작동하는 건가요?
필요없는 것이 항상 딸려오니 신경이 많이 쓰이네요.

고수님들 좀 도와주세요~~~

이건 우선 메일폼 양식입니다. mail_form.php 이구요.
-------------------------------------------------------------------------------------------------------------------------------
<script language="JavaScript" type="text/JavaScript">
<!--

function checkIt(form) {
      if(!form.sender.value) {
         alert('보내시는 분 성함을 입력해주세요.');
         form.sender.focus();
         return;
      }
      if(!form.sender_email.value) {
         alert('회신 받으실 Email주소를 입력해주세요.');
         form.sender_email.focus();
         return;
      }
      if(!form.subject.value) {
         alert('제목을 입력해주세요.');
         form.subject.focus();
         return;
      }
      if(!form.messages.value) {
         alert('내용을 입력해주세요.');
         form.messages.focus();
         return;
      }
    form.submit();
}
//-->
</script>

<script language=javascript>
function frm_reset(){
document.frm_mail.reset()
}
</script>
</head>

<body>
<br>           
                      <form name="frm_mail" method="post" enctype="multipart/form-data"  action="mail_ok.php">
                      <input type=hidden name="LocalConfig" value="Default">
                      <input type=hidden name="receiver" value="<? echo $receiver ?>">
                      <input type=hidden name="receiver_mail" value="<? echo $receiver_email ?>">
                        <table border=0 width=620 cellspacing=1 cellpadding=0>
                         <tr>
                           <td colspan="2" height="3" bgcolor="#EBD9D9" align="center"></td>
                        </tr>
                           <td width="120" align="right" style="font-family:돋움;font-size:8pt; font-weight: bold; padding-right:10px; padding-top:8px;">이 름 </td>
                           <td width="500" style="padding-top:8px;"><input name="sender" type="text" class="input" size="30"></td>
                        </tr>
      <tr>
                           <td height="1" colspan="2" align="center" bgcolor="#EBD9D9"></td>
                        </tr>
                        <tr>
                          <td align="right" style="font-family:돋움;font-size:8pt; font-weight: bold; padding-right:10px;">회신 이메일 </td>
                          <td><input type="text" name="sender_email" class="input" size="60"> <span class="pname">* 답장 받으실 주소</span> </td>
                        </tr>
      <tr>
                           <td height="1" colspan="2" align="center" bgcolor="#EBD9D9"></td>
                        </tr>
                        <tr>
                          <td align="right" style="font-family:돋움;font-size:8pt; font-weight: bold; padding-right:10px;">제 목 </td>
                          <td><input type="text" name="subject" class="input" size="80" value="상담문의:"></td>
                        </tr>
      <tr>
                           <td height="1" colspan="2" align="center" bgcolor="#EBD9D9"></td>
                        </tr>
      <tr>
                          <td align="right" style="font-family:돋움;font-size:8pt; font-weight: bold; padding-right:10px;">첨부 파일</td>
                          <td><input type=file name=userfile size=30 value=''></td>
        </tr>
      <tr>
                           <td height="1" colspan="2" bgcolor="#EBD9D9"></td>
                        </tr>
      <tr>
                           <td height="1" colspan="2"></td>
                        </tr>
      <tr>
                           <td height="1" colspan="2" bgcolor="#EBD9D9"></td>
                        </tr>
                        <tr>   
                           <td align="right" style="font-family:돋움; font-size:8pt; font-weight: bold; padding-right:10px;padding-bottom:8px;">내 용 </td>
                           <td style="padding-top:8px; padding-bottom:8px;"><textarea name="messages" cols="80" rows="18" style="border-color:#d8b3b3;" class="textarea">"상담문의"내용 :
         </textarea></td>
                        </tr>
      <tr>
                           <td height="1" colspan="2" align="center" bgcolor="#EBD9D9"></td>
                        </tr>
                        <tr>
                           <td height="50" colspan="2" align="center"><br>
                              <!--<input name="submit" type="submit" value="편지보내기">&nbsp;<input name="reset" type="reset" value="취        소">-->
                              <input name="vutton" type="image"  onfocus="blur()" src="../img/btn_writeok.gif" border="0" onClick="checkIt(this.form)">&nbsp;
         <a href="javascript:frm_reset()"><img src="../img/btn_cancel.gif" border="0"></a>
                           <!--<input name="reset" type="image" src="../img/btn_cancel.gif" border="0">--></td>
                          </tr>
                      </table>
                     </form>
-------------------------------------------------------------------------------------------------------------------------------
다음은 메일 보내는 설정 페이지 입니다. mail_ok.php
-------------------------------------------------------------------------------------------------------------------------------
<?

include "config.inc";
$current_time = time();
$signdate = date("Y년 m월 d일 H시 i분 s초", $current_time);

//메일  header
$add_header .= "Return-Path: $sender\r\n";
$add_header .= "From: $sender_email\r\n";
$add_header .= "X-Mailer: webmail\r\n";

$boundary = "----".uniqid("part");

if($userfile && $userfile_size) {
$filename = basename($userfile_name);
$fp = fopen($userfile, "r");
$file = fread($fp, $userfile_size);
fclose($fp);

if($userfile_type == "") {
$userfile_type = "application/octet-stream";
}

// header part
// Multipart/mixed 일경우 첨부파일이 있다는 것을 의미한다.
$add_header .= "MIME-Version: 1.0\r\n";
$add_header .= "Content-Type: Multipart/mixed; boundary = \"$boundary\"";

// 본문파트
$mailbody = "This is a multi-part message in MIME format.\r\n\r\n";
$mailbody .= "--$boundary\r\n";
$mailbody .= "Content-Type: text/html; charset=\"ks_c_5601-1987\"\r\n";
$mailbody .= "Content-Transfer-Encoding: base64\r\n\r\n";
$mailbody .= base64_encode(nl2br($messages))."\r\n\r\n";


// 파일첨부파트
$mailbody .= "--$boundary\r\n";
$mailbody .= "Content-Type: $userfile_type; name=\"$filename\"\r\n";
$mailbody .= "Content-Transfer-Encoding: base64\r\n";
$mailbody .= "Content-Disposition: attachment; filename=\"$filename\"\r\n\r\n";
$mailbody .= base64_encode($file)."\r\n\r\n";

// 멀티파트 종료
$mailbody .= "--$boundary--";
}

else {

$current_time = time();
$signdate = date("Y년 m월 d일 H시 i분 s초", $current_time);

$messages_temp = nl2br("$messages");


$mailbody = "받는사람 : $receiver";
$mailbody .= "<p>";
$mailbody .= "제목 : $subject";
$mailbody .= "<p>";
$mailbody .= "======================= 내용 ==================== <p>";
$mailbody .= "$messages_temp";
$mailbody .= "<p>";
$mailbody .= "================================================= <p>";
$mailbody .= "보낸사람: $sender";
$mailbody .= "<br>";
$mailbody .= "<p>";
$mailbody .= "보낸사람 메일: $sender_email";
$mailbody .= "<p>";
$mailbody .= "보낸시각 : $signdate\n";

$add_header = "From: $sender_email\n";
$add_header .= "Reply-To: $sender_email\n";
$add_header .= "Content-Type: text/html;charset=EUC-KR";

}

mail($receiver_email, $subject, $mailbody, $add_header);


        // 되돌아 가기
        echo(" 
         <script>
            window.alert('메일이 홈주인에게 발송되었습니다. 감사합니다. ');
            location = 'mail_form.php';
         </script>
         ")    
?>
-------------------------------------------------------------------------------------------------------------------------------
그리고 config파일엔 그냥 메일 받을 사람의 정보와 주소가 들어있습니다.

태그 연관 글
  1. [2021/01/21] 묻고답하기 ZBXE VERSION 1.1.5 업그레이드 문의 by maverick *1
  2. [2018/08/29] 묻고답하기 로그인해야만 사이트가 보여요 by sselang *2
  3. [2018/02/01] 묻고답하기 php 구문 오류라고 나오는데 어디가 잘못된건지 ㅠㅠ by babi****
  4. [2016/12/07] 묻고답하기 유튜브(YouTube) 모듈 반응형으로!!! by 힐디
  5. [2016/05/21] 묻고답하기 제로보드 코딩 관련 질문입니다ㅠㅠ 메뉴가 안 눌려요... by Ashleya9757
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
유치뽕 자꾸 오류발생... 도와주세여.. [1] 2007.08.10
koyomiro™ 네이버의 오른쪽 큰 광고가 있는 부분을 고정시키고싶어요.  
soo♡ 이런표현을 하고싶은데요.. [3] 2007.08.10
새우깡 전용서버가 있나요? [2] 2007.08.10
히라기 노프레임이 전혀안먹혀요 [3] 2007.08.10
Maro_choco IIS 문제 좀 봐주십시요..  
조춘우 include 가 않되요(제발 도움주세요) [3] 2007.08.10
한승진 키보드로 거치지 않는 링크 만들기 [2] 2007.08.10
개가죽 [ASP] 환경변수에관해서  
임정환 랜덤으로 게시물 출력하는법 아시는분 부탁드립니다 [4] 2007.08.10
김현경 완전 초보입니다. 안되는것이 있어서요..apm설치했는데... [9] 2007.08.10
J. 개인컴퓨터를 서버로 만들때 서버랑 계정 어떻게 아나요?  
김현경 ㅠㅠ 아래처럼해서 되는데..저만들려요.. [9] 2007.08.10
廢人 cgi 예제좀 구할수 없을까요?; [2] file 2007.08.10
데빈타운젠드 이 이미지효과는 무슨효과일까요? [2] 2007.08.10
박영택 html에서 테이블 테크를 써서 만들엇는뎅 잘안되네요 좀 봐주세요 [1] 2007.08.10
차칸넘 무료 포워딩(도메인)으로 접속 후, 주소 표시줄이 바뀌는 방법 좀.. [1] 2007.08.10
NZ 배경 음악 바꾸기. 어떻게 하나요.?? [1] 2007.08.10
간영우 ㅠㅠ 군바리 군장위기 입니다.. 제잘 도와주세요,.... [1] 2007.08.10
김소영 테이블 handler에서 127 오류 발생 이뭔가요 ㅜ.ㅡ [1] 2007.08.10