【原创】请那位大哥帮忙看看这短ASP程序问题出在哪儿,谢谢了。


<%
Set Rs = Server.CreateObject("ADODB.RecordSet")
Const MailServer = "mail.js.gov.cn "
Const MailServerUserName = "abcd"
Const MailServerPassword = "abcd"
Const OrderSubject = "系统信箱"
%>                                                                                                   
                                                                                                                                                                                                                                                               
<html>
<head>
<script language="JavaScript">
<!--
function check() {
if (document.sendmail.tomail.value=="") {
window.alert ("请您输入收信人email !")
document.sendmail.tomail.focus()
return false
}
  if(document.sendmail.tomail.value.length!=0)
{
if (document.sendmail.tomail.value.charAt(0)=="." || document.sendmail.tomail.value.charAt(0)=="@"|| document.sendmail.tomail.value.indexOf('@', 0) == -1 || document.sendmail.tomail.value.indexOf('.', 0) == -1 || document.sendmail.tomail.value.lastIndexOf("@")==document.sendmail.tomail.value.length-1 || document.sendmail.tomail.value.lastIndexOf(".")==document.sendmail.tomail.value.length-1)
{
alert("收信人Email地址格式不正确!");
document.sendmail.tomail.focus();
return false;
}
}
if (document.sendmail.nechen.value=="") {
window.alert ("请您输入您的email !")
document.sendmail.nechen.focus()
return false
}
if(document.sendmail.nechen.value.length!=0)
{
if (document.sendmail.nechen.value.charAt(0)=="." || document.sendmail.nechen.value.charAt(0)=="@"|| document.sendmail.nechen.value.indexOf('@', 0) == -1 || document.sendmail.nechen.value.indexOf('.', 0) == -1 || document.sendmail.nechen.value.lastIndexOf("@")==document.sendmail.nechen.value.length-1 || document.sendmail.nechen.value.lastIndexOf(".")==document.sendmail.nechen.value.length-1)
{
alert("您的Email地址格式不正确!");
document.sendmail.nechen.focus();
return false;
}
}
if (document.sendmail.mailsubject.value=="") {
window.alert ("请您输入邮件主题 !")
document.sendmail.mailsubject.focus()
return false
}
if (document.sendmail.mailbody.value=="") {
window.alert ("请您输入邮件内容 !")
document.sendmail.mailbody.focus()
return false
}
if (document.sendmail.mailbody.value.length>20000) {
window.alert ("请您输入20000以内个字符 !")
document.sendmail.mailbody.focus()
return false
}
return true
}
//-->


</SCRIPT>
</style>
</head>
<body onload=document.sendmail.tomail.focus()>
<div align="center"></div>
<div align="center"><br>
  <table width="760" height="21" border="0" cellpadding="0" cellspacing="0" background="../../img/bw/line.gif">
    <tr>
      <td><div align="center"><span class="style1">邮 件 系 统</span></div></td>
    </tr>
  </table>
</div>
<div align="center">
  <table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#5AAE18">
    <tr>
      <td bgcolor="#FFFFFF"><table width="99%" height="379" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="399CA0">

          <tr valign="top" bgcolor="#FFFFFF">
            <td width="104"><div align="left">收件人email:</div></td>
            <td width="634" valign="top"><div align="left">
                <input name="tomail" type="text" class="input" size="50" maxlength="100">
                <span class="style6">*</span> </div></td>
          </tr>
          <tr valign="top" bgcolor="#FFFFFF">
            <td>发信人email:</td>
            <td valign="top"><input name="nechen" type="text" class="input" id="nechen" size="50">
                <span class="style6">*</span>  (您的email,便于对方回复) </td>
          </tr>
          <tr valign="top" bgcolor="#FFFFFF">
            <td><div align="left">主题:</div></td>
            <td valign="bottom"><div align="left">
                <input name="mailsubject" type="text" class="input" size="50" maxlength="50">
                <span class="style6">*</span> </div></td>
          </tr>
          <tr valign="top" bgcolor="#FFFFFF">
            <td height="135" valign="middle"><div align="left"><img src="../tz/img/down.gif" width="48" height="48"><br>
          信件内容:</div></td>
            <td align="center" valign="middle"><div align="left">
                <textarea name="mailbody" cols="80" rows="15" class="input"></textarea>
                <span class="style6">*</span> </div></td>
          </tr>
          <tr valign="top" bgcolor="#FFFFFF">
            <td valign="middle">签名:</td>
            <td valign="bottom"><input name="nichen111" type="text" id="nichen111" size="12"></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="35"><div align="center"></div></td>
            <td>
          <span class="style7"><span class="bg"><span class="bg style2"><STRONG><FONT color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff>
          <input style="FONT-SIZE: 12px; HEIGHT: 27px" type=submit value=" 发 送 " name=Submit></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></FONT></STRONG></span></span></span><span class="style7"><span class="bg"><span class="bg style2"><STRONG><FONT color=#ffffff>  <STRONG><FONT color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff>
          </font></strong></font></strong></font></strong></font></strong></FONT></STRONG></FONT></STRONG></FONT></STRONG><STRONG><FONT color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff><STRONG><FONT color=#ffffff><strong><font color=#ffffff>
          <input name="重置" type=reset style="FONT-SIZE: 12px; HEIGHT: 27px"  value= " 重 写 " >
           
          </font></strong></FONT></STRONG></font></strong></FONT></STRONG></font></strong></FONT></STRONG></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></FONT></STRONG>
          <input name="按钮" type=button style="FONT-SIZE: 12px; HEIGHT: 27px"  onClick="javascript:history.go(-1)" value= " 取 消 " >
          </font></strong></FONT></STRONG></font></strong></FONT></STRONG></font></strong></FONT></STRONG></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></FONT></STRONG>
          <input type="hidden" name="mail" value="owen">
          <br>
</font></strong></FONT></STRONG></span></span></span>                </td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="12" colspan="2"></td>
            </tr>
        </form>
      </table></td>
    </tr>
  </table>
</div>
<div align="center">
  <p> </p>
  <p><br>
  </p>
</div>
</body>
</html>

<%
Function SendMail(toemail, strSubject, strMailBody, strSendMsg, flag)
    dim mailbody,Jmail
    Set msg=server.createobject("Jmail.Message")
    msg.silent = true
    msg.Logging = true
    msg.Charset = "gb2312"
    msg.MailServerUserName = MailServerUserName            '输入smtp服务器验证登陆名 (邮局中任何一个用户的Email地址)
    msg.MailServerPassword = MailServerPassword    '输入smtp服务器验证密码  (用户Email帐号对应的密码)

    msg.From =document.sendmail.nechen.value                    '发件人Email
    msg.FromName = document.sendmail.nichen111.value                '发件人姓名
    msg.AddRecipient document.sendmail.tomail.value    '收件人Email
    msg.Subject = document.sendmail.mailsubject.value    '信件主题
    msg.Body = document.sendmail.mailbody.value     '正文
    msg.Send (MailServer)    'smtp服务器地址(企业邮局地址)
    set msg = nothing
    Response.write "<font color=red>" & strSendMsg & "</font>"
End Function
%>
最后编辑2007-01-02 15:27:22.280000000