폼메일

폼메일
<?php
// 회원 인증 부분
//제로보드 경로 셋팅부분
//<이분분을 자신에 맞게 수정하세요>
$_zb_url = "http://brandus.co.kr/zeroboard/";
$_zb_path = "/home/hosting_users/brandus/www/zeroboard/";
include $_zb_path."lib.php";

//회원 정보접속
$connect=dbconn();        
$member=member_info();
//회원 등급을 지정하실 수 있습니다.
if($member[level]>9) Error("정회원(9) 이상만 폼메일을 이용할 수 있습니다.<p><font

color=red><b>회원 인증을 하는 이유</b></font></b><br><font color=blue>::+::스펨메일

릴레이를 막기위해서::+::</font>");
// 회원등록이 되어 있을때 이름등을 가져옴;;
        if($member[no]) {
                if($mode=="modify"&&$member[no]!=$s_data[ismember]) {
                        $name=$s_data[name];
                        $email=$s_data[email];
                        $homepage=$s_data[homepage];
                } else {
                        $name=$member[name];
                        $email=$member[email];
                        $homepage=$member[homepage];
                }
        }
//회원 인증 요기까지

//======================================
// 메일 보내기  [ $mode == mailsend 일 경우]
//======================================
if($mode=='mailsend')
{
if(!$to)
    {   echo( " <script>
                  window.alert('메일을 받는사람의 메일주소가 필요합니다.')
                  history.go(-1)
                 </script>
               "); exit;
    }
if(!$from)
    {   echo( " <script>
                  window.alert('메일을 보내는사람의 메일주소가 필요합니다.')
                  history.go(-1)
                 </script>
               "); exit;
    }
if(!$subject)
    {   echo( " <script>
                  window.alert('메일 제목이 없습니다. 메일 제목을 입력해 주십시오.')
                  history.go(-1)
                 </script>
               "); exit;
    }
if(!ereg( "([a-zA-Z0-9,_]{2,15})@([a-zA-Z0-9]{2,15}).([a-zA-Z0-9]{2,15})", $to ,

$regs ) )
{    echo("<script name=javascript>
window.alert(' 받는사람의 Email 주소 형식이 틀립니다
  [예] yourmail@server.domain');
          history.go(-1);        
          </script>");
exit;
}

$mailheaders =  "From:$from";
mail($to,$subject,$body,$mailheaders);
echo( "<script name=javascript>
window.alert(' 메일이 발송 되었습니다.');
window.close()
</script>");
exit ;  // 메일을 발송한 후 안내창을 띄우고 창을 닫는다.
}

?>



<html>
<head>
<title>PHP 폼메일</title>
<link href="http://brandus.co.kr/style.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFffFF" text="#4C4C4C" link="#CDEFFF" vlink="#DCD8FF"

alink="#FFD2CD">
<center>
<p><img src="formmail_title.gif" width="500" height="79" border="0"><br>

<table border="0" cellpadding=3 cellspacing=0 width="500" style="border-left:#999999

1px solid;border-right:#999999 1px solid;border-bottom:#999999 1px solid;">
   <tr>
        <td width="120" bgcolor="#cccccc"><form name="form" method="get">
            <p align="center"><span style="font-color:#ffffff;">받는  사람

 Email</span></td>
        <td bgcolor="#cccccc"><p> <input type="text" name="to"

value="mamirine@naver.com" size="30" readonly> </td>
</tr>
<tr>
        <td width="120" bgcolor="#cccccc"><p align="center"><span style="font-

size:9pt;">보내는사람 Email</span></td>
        <td bgcolor="#cccccc"><p> <input type="text" name="from" value="<?

echo"$email"; ?>"size="30"></td>
</tr>
<tr>
        <td width="120" bgcolor="#cccccc"><p align="center"><span style="font-

size:9pt;">제   목</span>
            </td>
        <td bgcolor="#cccccc"><p> <input type="text" name="subject"

size="56"></td>
</tr>
<tr>
        <td width="120" bgcolor="#cccccc" style="border-top:#dddddd 1px solid;"><p

align="center"><span style="font-size:9pt;">내   용</span></td>
        <td height="40" bgcolor="#cccccc" valign="middle" style="border-top:#dddddd

1px solid;"><p> <textarea name="body" rows="15" cols="55"></textarea>
         <br><center><span style="font-color:white;"><input type="submit" name="send"

value="편지보내기" style="border-width:1; border-color:#bbbbbb; border-

style:solid;height:22px;width:80px">  
<input type="reset" name="cancel" value="내용지우기" style="border-width:1; border-

color:#bbbbbb; border-style:solid;height:22px;width:80px"></span>
        <input type="hidden" name="mode" value="mailsend">
                </td>
</tr>
</table></form>

</CENTER>
</body>
</html>


==========================================================
나 스스로 천재라고 신나함. ㅋㅋㅋ -_-;
안내창 띄우고 창닫기 하나 했다고 쯧-_-;
그래도 신나지 뭐야 홍홍 ㅋㅋㅋ

폼메일을 팝엽창이 아닌 현재창에 띄우기
폼메일을 팝엽창이 아닌 현재창에 띄우기  
영진   (Homepage)  2005-04-20 11:09:09, 조회 : 978, 추천 : 0
- Download #1 : na_mail.zip (2.0 KB), Download : 52

헤드와 푸드로 나눈상태에서만 적용됩니다.

<? include "../head.html"; ?>
<? include "../foot.html"; ?>

헤드와 푸드파일이 php 파일인경우 na_mail.php파일을 수정하세요.
그리고 na_mail.php 파일을 제로보드에 넣어주세요.

받는사람의 이름과 메일주소를 숨기시려면 이렇게 수정하세요.

input type="hidden" name=to_name size="48" value="<?=$data[name]?>"
input type="hidden" name=to size="48" value="<?=$mail?>"

폼메일을 팝엽창이 아닌 현재창에 띄우기
script/script_zbLayer.php

수정전
if(mail) {
printMain = printMain +        "<tr onMouseOver=this.style.backgroundColor='#bbbbbb' onMouseOut=this.style.backgroundColor='' onMousedown=window.open('open_window.php?mode=m&str="+mail+"','ZBremote','width=1,height=1,left=1,top=1');><td style=font-family:굴림;font-size:9pt height=18 nowrap> <img src=images/n_mail.gif border=0 align=absmiddle>  메일 보내기  </td></tr>";
                        printHeight = printHeight + 16;
                }

수정후
if(mail) {
printMain = printMain +        "<tr onMouseOver=this.style.backgroundColor='#bbbbbb' onMouseOut=this.style.backgroundColor='' onMousedown=location.href='na_mail.php?str="+mail+"&member_no="+member_no+"'><td style=font-family:굴림;font-size:9pt height=18 nowrap> <img src=images/n_mail.gif border=0 align=absmiddle>  메일 보내기  </td></tr>";
                        printHeight = printHeight + 16;
                }





무상수리
  위의 소스를 이용하여 메일을 받으면 달랑
메세지 내용만 나타나는데 추가하여 나타낼 수 있는 소스좀 알려주세요
실력이 미진하여 해결 불능입니다

제목 /어쩌구 저쩌구
내용 /어쩌구 저쩌구
text field 추가/ 어쩌구 저쩌구

밑에 소스에 예를 들어 text 필드들을 추가하여 message2......message3
을 늘리고 내용까지 보낼 수 있는 방법을 알고 싶습니다
즉 입력폼과 동일한 형태의 내용을 메일에서 받고 싶습니다
고수님들의 조언을 부탁드립니다

좋은 하루 되세요

//첨부화일이 1개일경우
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";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0\r\n";
$mailheader .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";

$messages = "This is a multi-part message in MIME format.\r\n\r\n";
$messages .= "--$boundary\r\n";
$messages .= "Content-Type: text/html; charset=euc-kr\r\n";
$messages .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$messages .= nl2br(addslashes($message)) . "\r\n";
$messages .= "--$boundary\r\n";
$messages .= "Content-Type: $userfile_type; name=\"$filename\"\r\n";
$messages .= "Content-Transfer-Encoding: base64\r\n\r\n";
$messages .= ereg_replace("(.{80})","\\1\r\n",base64_encode($file));
$messages .= "\r\n--$boundary" . "\r\n";
}

//첨부화일이 없을경우
else
{
$mailheader .= "Content-Type: text/html; charset=euc-kr\r\n";
$mailheader .= "Content-Transfer-Encoding: 8bit\r\n\r\n";

$messages1 = $mail_head."\r\n";
$messages1 .= nl2br(addslashes($message1))."\r\n";
$messages1 .= $mail_tail."\r\n";
}
mail($to,$subject,$messages,$mailheader);

echo("
<meta http-equiv='Refresh' content='0; URL=$PHP_SELF?mailsend=choice'>
");
}
} 2005-04-20
15:50:56
  



영진
  이건 메일전송만 할뿐입니다.
어떤 형식으로 메일을 받아보는가하는것은 여기서는 어떻게 할수가 없어요.
메일받는 프로그램에 따라 여러가지로 촐력이 되겠죠. 2005-04-20
16:11:15
  



myung
  현제 (x) -> 현재 (o), 요즈음 이 맞춤법을 실수하시는분이 많더군요.. 하도 현제현제 많아서 저는 맞춤법이 바뀌었나, 국어사전을 확인했었습니다.. 많은 분들이 보실 글이라 생각되어, 말씀드립니다. 좋은소스 감사합니다. 2005-04-25
02:43:16
  



영진
  수정하겠습니다. 감사합니다.