各位师父师兄们救命,以下是一个表单,要求是直接将用户在表单上提交的内容发到一个指定的邮箱,服务器支持JMAIL,请大家帮我看看程序有什么错误。十分感谢
<%@ Language=VBScript %>
<%
'+++++++++++++++++++++++++++++
' 参 数 设 置
'+++++++++++++++++++++++++++++
'邮件底部的广告
mailfoot= "写在这里"
'用来发送邮件的SMTP服务器
mailserver= "mail.newxinghua.com"
'如果服务器需要SMTP身份验证则:
'登录用户名
mailserverloginname= "chen"
'登录密码
mailserverloginpass= "758630"
'域名(如果你用“name@domain.com”这样的用户名登录时,请指明domain.com
mailuserdomain= "newxinghua.com"
'+++++++++++++++++++++++++++++
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Copyright" content="Ajiang http://www.ajiang.net">
<title>FormMail - Ajiang.net</title>
<style type="text/css">
<!--
body {
font-size: 12px;
}
td {
font-size: 12px;
}
input {
font-size: 12px;
line-height: 130%;
border: 1px solid #000000;
}
.backc {
color: #FFFFFF;
background-image: url(ok.gif);
height: 20px;
width: 55px;
border: none;
}
textarea {
font-size: 12px;
border: 1px solid #000000;
}
-->
</style>
</head>
<body>
<table width="498" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td height="300">
<table width="390" border="0" align="center" cellpadding="0" cellspacing="0">
<%
'获取表单数据
fromname= Request.Form("fromname")
frommail= Request.Form("frommail")
toname= Request.Form("toname")
tomail= Request.Form("tomail")
mailtitle= Request.Form("mailtitle")
mailbody= Request.Form("mailbody")
'检查是否填写了表单
if tomail="" then
%>
<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method=post>
<tr>
<td><p>发信人姓名:
<input type="text" name="fromname">
<br>
发信人信箱:
<input type="text" name="frommail">
<br>
收信人姓名:
<input type="text" name="toname">
<br>
收信人信箱:
<input type="text" name="tomail">
<br>信件主题:
<input name="mailtitle" type="text" size="51">
<br>
信件内容:<br>
<textarea name="mailbody" cols="49" rows="9"></textarea>
<br>
<input name="Submit" type="submit" class="backc" value="提交">
</p>
</td>
</tr>
</form>
<%
else
if frommail="" then
msg="您必须填写您的邮件地址,才可以发信给别人。"
else
'=============== 发 信 ================
dim JMail
set JMail=server.CreateObject("Jmail.message")
JMail.Silent=true
JMail.Charset = "gb2312"
JMail.FromName = fromname
JMail.from = frommail
JMail.AddRecipient tomail,toname
JMail.Subject = mailtitle
jmail.Body=mailbody & vbcrlf & vbcrlf & mailfoot
JMail.MailServerUserName = mailserverloginname
JMail.MailServerPassWord = mailserverloginpass
JMail.MailDomain = mailuserdomain
sendok=JMail.send(mailserver)
if sendok then
msg="已经成功发送了邮件!"
else
msg="发送邮件失败,可能是您填写了错误的邮件地址。<br>" & _
"如果您确信没有写错邮件地址,则可能是发信程序出了<br>" & _
"故障,请与管理员联系"
end if
end if
%>
<tr>
<td valign=middle>
<table width=80% align=center>
<tr><td><p><%=msg%><br><br><a href='javascript:history.back()'>[返回]</a></p></td></tr>
</table>
</td>
</tr>
<%
end if
%>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
[此贴子已经被作者于2007-11-13 10:30:20编辑过]