묻고답하기
폼메일 적용좀 할려고하는데 포미님꺼 이용해서 하려는데 잘안되네요.. 아시는분;;
2009.05.14 02:19
페이지띠우기는 했는데 메일이 안날라가는거 같습니다.
컴터 초보라 적용이 잘 안되네요;; 아시는분 답변좀 부탁드립니다.
소소올려놓을게요;; 고수분들 부탁 좀 드려요;;
<html>
<META http-equiv=Content-Type content="text/html; charset=ks_c_5601-1987">
<LINK href="./style.css" type=text/css rel=stylesheet>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<?
$_zb_url = "해당주소넣었구요";
$_zb_path = "절대경로주소넣어놨어요";
$mail = base64_decode($str);
// Sendmail 폼
if(!$mailsend)
{
?>
<form method='post' enctype='multipart/form-data' action='<?=$PHP_SELF?>?mailsend=send'>
<TABLE cellSpacing=0 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD><IMG src="./box_top_write.gif" border=0></TD>
<td></td></TR>
<TR>
<TD noWrap></TD>
<TD> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD noWrap align=middle height=25>
<TABLE cellSpacing=0 width="100%" border=0>
<TBODY>
<TR>
<TD background="board_line.gif" height=10></TD></TR>
<TR>
<TD align=right height=20><INPUT type=image src="./write_send.gif" border=0 accesskey="s">
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor="#cfe3ec">
<TBODY>
<TR>
<col width=125></col><col width=></col>
<TD align=middle height=40 width="100"> </TD>
<TD><FONT color="#2D4492">* 글은 인터넷에서 자신을 나타내는 유일한 모습입니다. *</FONT></TD></TR>
<TR>
<TD colSpan=2 background="board_line.gif" height=5></TD></TR>
<TR>
<TD align=middle width="100" height=22><IMG src="./dot_gold.gif" align=absMiddle border=0> 받는 사람 </TD>
<TD>이름 <INPUT class="input" name=to_name size="10" value="<?=$data[name]?>">
<br>메일 <INPUT class=input name=to size="48" value="<?=$mail?>"></TD></TR>
<TR>
<TD colSpan=2 background="board_line.gif" height=5></TD></TR>
<TR>
<TD align=middle width="100" height=22><IMG src="./dot_gold.gif" align=absMiddle border=0> 보내는 사람</TD>
<TD>이름 <INPUT class="input" name=from_name size="10" value='<?=$member[name]?>'>
<br>메일 <INPUT class=input name=from size="48" value='<?=$member[email]?>'></TD></TR>
<TR>
<TD colSpan=2 background="board_line.gif" height=5></TD></TR>
<TR>
<TD align=middle height=22 width="100"><IMG src="./dot_gold.gif" align=absMiddle border=0> 제 목 </TD>
<TD><INPUT class="input" name=subject size="65"></TD></TR>
<TR>
<TD align=middle height=22 colspan="2">
<p align="middle"><TEXTAREA class="textarea" style="WIDTH:98%; HEIGHT: 200px" name=message></TEXTAREA></TD>
</TR>
</TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfe3ec border=0>
<TBODY>
<TR>
<TD colSpan=2 height=10></TD></TR>
<TR>
<TD align=middle width="100" height=25><IMG src="./dot_gold.gif" align=absMiddle border=0> 첨부파일 </TD>
<TD><INPUT class="input" type=file size="50" name=userfile><FONT color='#999999'> (10.0MB 이하)</FONT></TD></TR>
<TR>
<TD colSpan=2 height=5></TD></TR>
<TR>
<TD colSpan=2 height=5></TD></TR>
<TR>
<TD colSpan=2 height=10></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD height=20></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD noWrap align=middle height=25>
<TABLE cellSpacing=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=right><INPUT type=image src="./write_send.gif" border=0 accesskey="s">
</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD background="board_line.gif" height=5></TD></TR></TBODY></TABLE></FORM>
<br>
<?
}
// 메일 프로그램 시작
if($mailsend==send)
{
// 에러
if(!$to || !$subject)
{
echo("
<script>
window.alert('받는 사람의 메일주소나 제목은 반드시 입력해야 합니다.')
history.go(-1)
</script>
");
}
elseif(!$member[no])
{
echo("
<script>
window.alert('회원만 메일을 보낼 수 있습니다.')
history.go(-1)
</script>
");
}
elseif($member[no])
{
// 받는 사람 처리
$to = $to_name." <".$to.">";
// 헤더부분
$mailheader .= "Return-Path: $from\r\n";
$mailheader .= "From: $from_name <$from>\r\n";
$mailheader .= "X-Mailer: Gfew Interface\r\n";
//첨부화일이 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";
$messages = $mail_head."\r\n";
$messages .= nl2br(addslashes($message))."\r\n";
$messages .= $mail_tail."\r\n";
}
mail($to,$subject,$messages,$mailheader);
echo("
<meta http-equiv='Refresh' content='0; URL=$PHP_SELF?mailsend=choice'>
");
}
}
// 메일 전송
if($mailsend==choice)
{
echo("
<table width=502 border=0>
<tr>
<td height=20> </td>
</tr>
<tr>
<td align=center><b>메일이 성공적으로 전송 되었습니다!</b></td>
</tr>
<tr>
<td height=20> </td>
</tr>
<tr>
<td align=center>
<a href="./$PHP_SELF"><img src="http://www.xpressengine.com/btn_ok.gif border=0></a>
</td>
</tr>
</table>
);
}
?>
</body>
</html>