메일 입력화면 Mail.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<Link rel="stylesheet" type="text/css" href="/main/style.css">
<script language="javascript">
function send_mail()
{
var form = document.mail;
if ( form.subject.value == "")
{
alert("메일제목을 넣어주세요");
form.subject.focus();
return;
}
if ( form.name.value == "")
{
alert("이름을 넣어주세요");
form.name.focus();
return;
}
if ( form.email.value == "")
{
alert("이메일을 넣어주세요");
form.email.focus();
return;
}
if (form.contents.value == "")
{
alert("메일 내용을 넣어주세요");
form.contents.focus();
return;
}
document.mail.submit();
}
</script>
</HEAD>
<BODY topmargin="0" leftmargin="0">
<form runat="server" id="mail" name="mail" method="post" action="mail_ok.asp">
<table cellpadding="0" cellspacing="0" width="100%">
<tr align="center">
<td height="35" background="/board/images/title_back.gif" class="title" align="center" colspan="2"><font size="3">Mail</font></td>
</tr>
<tr>
<td width="20%" align="center" bgcolor="f5f5f5"><strong>Subject</strong></td>
<td width="80%" style="padding:5" bgcolor="ffffff"><input type="text" id="subject" name="subject" style="width:150;border:1 solid #cccccc" value=""></td>
</tr>
<tr>
<td width="20%" align="center" bgcolor="f5f5f5"><b>Name</b></td>
<td width="80%" style="padding:5" bgcolor="ffffff"><input type="text" id="name" name="name" style="width:150;border:1 solid #cccccc" value=""></td>
</tr>
<tr><td height="1" bgcolor="#dddddd" colspan="2"></td></tr>
<tr>
<td width="20%" align="center" bgcolor="f5f5f5"><b>e-Mail</b></td>
<td width="80%" style="padding:5" bgcolor="ffffff"><input type="text" id="email" name="email" style="width:200;border:1 solid #cccccc" value=""></td>
</tr>
<tr><td height="1" bgcolor="#dddddd" colspan="2"></td></tr>
<tr>
<td width="20%" align="center" bgcolor="f5f5f5"><b>Message</b></td>
<td width="80%" style="padding:5" bgcolor="ffffff">
<textarea id="contents" name="contents" style="width:100%;height:250;border:1 solid #cccccc"></textarea>
</td>
</tr>
<tr><td height="1" bgcolor="#dddddd" colspan="2"></td></tr>
<tr><td height="3" bgcolor="#eeeeee" colspan="2"></td></tr>
</table>
<center><a href="javascript:send_mail();"><img src="/images/main/btn_send.gif" border="0" style="margin-top:10"></a></center>
</form>
</body>
</html>
메일 발송을 처리하는 폼 main_ok.asp
<%
' e-Mail 전송
'Post 방식은 Form으로 받아서 전송해야함
s_email = Request.Form("email")
s_contents = Request.Form("contents")
s_Subject = Request.Form("Subject")
s_name = Request.Form("Name")
Set objMail = Server.CreateObject("CDONTS.NewMail") '메일 객체생성
set mail=nothing '메일 객체를 닫습니다.
%>
<script language="javascript">
alert("<%=s_name%> 님께 메일을 전송했습니다.");
top.location.href="../index.html"
</script>
<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio.NET 7.0">
</head>
<body>
</body>
</html>