묻고답하기

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 남기남
이영희441 [php_폼메일]메일은 잘오는데 빈메일이 따라와서 2개씩 와요.  
파파민 z4에서 사용한 메일 보내기 팁 Xe에서 사용하는 법?  
수학사랑. xe에서 회원에게 메일 보내는 기능이 없는 것같은데. [2] 2008.03.25 by 쏘프티
JnCsoft [Q] 캐릭터셋에 따라 폼메일이 안돼요.  
VagaBond 아이디/비밀번호 찾기는 나만 안되는거야??? [3] file 2008.07.03 by JZY
개돌 메일 인증 받기 전에 로그인 하기 [3] 2008.12.18 by 느까끼
Appler 관리자 메일 문제입니다.  
채연파파 댓글 알리미 사용하시는 분들께 여쭙니다. [2] 2009.02.19 by 채연파파
parksungho 인증메일 문제 다시 질문 드립니다. [2] file 2009.04.28 by 비밀이야288
웹드 메일 모듈이 필요한데 없나요?  
비밀입니다 비회원이 글쓰기 할때 이메일과 홈페이지 작성 공간 삭제 질문 [2] 2010.10.13 by 비밀입니다
wiwi 회원가입및 아이디비밀번호 인증메일 시 에러 [1] file 2010.10.13 by HwangTi
토치송 관리자 메일 받는 폼 수정하기?  
frieden 제로보드 4에서 xe로 데이터이전시 회원 오류 [3] 2011.01.29 by cycix
starless 메일보내기 [1] 2011.02.19 by SeklutZ
주하니 글,댓글 자동메일로 발송시 스팸으로 처리 해결책 [1] 2011.02.24 by 라르게덴
이화준 구글앱스로 메일서버 도메인에 MX등록, 메일 인증이 안되요..ㅜㅜ  
daniel28 회원 가입 후 메일 인증이 오지 않습니다. [2] 2011.04.09 by 왜늘배가고플까T^T
후르방 XE 회원정보 출력 할수 있나요?? [1] 2011.07.27 by 송동우
채연파파 게시판에 올라온 글을 트위터로 보내는 알림 방법을 찾습니다. [2] 2011.08.03 by ehdgkr97