<%
option explicit							'强制变量定义开关，建议保留此项
'------------------------------------------------------------------------------------------------------
'----------------------------------    用户配置接口      ---------------------------------
'----------------------------------         请按照提示进行设置        ---------------------------------
'------------------------------------------------------------------------------------------------------
Sub V_JMail_Config()
sSMTPServer="mail.163.com"					'SMTP服务器，可以直接输入SMTP的IP地址或者网址
sMailUser="aosx@aosx.com"					'代发送邮件的帐号，如果是不含@的帐号，就不能写@
sSenderPassword="aosx123456789"					'邮件服务器的登陆密码
sSysTitle="西安手机网邮件系统"				'本系统的名称
sVersion="1.0"							'版本号，建议只能是数值格式
lShowSMTPSvr=1							'是否允许发送者查看SMTP服务信息。允许为1，禁止为0
End Sub
'------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------
'
'                     以下为程序核心，如果对VBScript不熟悉的朋友请不要擅自修改
'
'------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------
dim JmailMsg									'JMail.Message COM对象
dim sMailUser									'邮件服务器的登陆帐号，如果是不含@的帐号，就不能写@
dim sSenderPassword								'邮件服务器的登陆密码
dim sSMTPServer									'SMTP服务器
dim sRecMail									'收件人Email
dim sRecMailArr									'收件人Email数组
dim sFromName									'在对方接收人中显示的发信人名称
dim sFromMail									'在对方接收人中显示的发信人地址
dim sMailSubject								'邮件主题
dim sMailBody									'邮件主体
dim lAnonymous									'是否匿名
dim lHTML									'是否HTML发送
dim sSysTitle									'系统标题
dim sVersion									'版本
dim sErrorMsg									'错误消息文本
dim RecMail_i									'收件人数组索引
dim lShowSMTPSvr								'是否显示SMTP服务器(代发邮件信息)
'------------------------------------------------------------------------------------------------------
Call VJMail_Config()
sErrorMsg="" %>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title><%=sSysTitle%></title>
<style>
A:link {
	COLOR: #000000; TEXT-DECORATION: none
}
A:visited {
	COLOR: #000000; TEXT-DECORATION: none
}
A:active {
	COLOR: #FF0000; TEXT-DECORATION: none
}
A:hover {
	COLOR: #FF0000; TEXT-DECORATION: underline
}
body    {
	font-family: Arial;
style; 	font-size: 12px;
	color: #111111;
	letter-spacing:0px;
	SCROLLBAR-HIGHLIGHT-COLOR: buttonface;
	SCROLLBAR-SHADOW-COLOR: buttonface;
	SCROLLBAR-3DLIGHT-COLOR: buttonhighlight;
	SCROLLBAR-TRACK-COLOR: #eeeeee;
	SCROLLBAR-DARKSHADOW-COLOR: buttonshadow;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
td	{
	font-family: "宋体"; font-size: 12px; color: #111111; letter-spacing:0px; word-break:break-all
}
.bigfont1 {
	FONT-SIZE: 20px; font-weight:bold
}
.style1 {
	color: #CC0033;
	font-weight: bold;
}
</style>
<SCRIPT language=javascript>
    <!--
 window.document.attachEvent("onselectstart",f_CancelEvent);
 window.document.attachEvent("ondragstart",f_CancelEvent);
 window.document.attachEvent("oncontextmenu",f_CancelEvent);
 function f_CancelEvent()
 {
  event.returnValue = false;
 }
// -->
</SCRIPT>
</head>
<body onmouseover="self.status='西安手机网邮件系统-www.xasjw.com';return true">
<% if lcase(trim(request("action")))="smtp" then %>
<table border="0" width="250" bgcolor="#000000" cellspacing="1" cellpadding="3" align="center">
  <tr>
    <td colspan="2" bgcolor="#CCCCCC" width="238" align="center"><b><%=sSysTitle%></b></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" align="right" width="88">SMTP服务器：</td>
    <td bgcolor="#FFFFFF" width="140"><u><%=sSMTPServer%></u></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" align="right" width="88">SMTP帐号：</td>
    <td bgcolor="#FFFFFF" width="140"><u><%=sMailUser%></u></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" colspan="2" width="238" align="center">[<a href="javascript:window.close();">关闭</a>]</td>
  </tr>
</table><%
response.write "</body></html>"
response.end
end if
if lcase(trim(request("action")))="preview" then %>
<table border="0" width="380" bgcolor="#000000" cellspacing="1" cellpadding="3" align="center">
  <tr>
    <td width="368" colspan="2" align="center" bgcolor="#CCCCCC"><b><%=sSysTitle%></b><br>邮件预览</td>
  </tr>
  <tr>
    <td width="61" bgcolor="#E7E7E7" align="right">收件人：</td>
    <td width="297" bgcolor="#E7E7E7" id="sRecMail"></td>
  </tr>
  <tr>
    <td width="61" bgcolor="#E7E7E7" align="right">发件人：</td>
    <td width="297" bgcolor="#E7E7E7" id="sSender"></td>
  </tr>
  <tr>
    <td width="61" bgcolor="#E7E7E7" align="right">主　题：</td>
    <td width="297" bgcolor="#E7E7E7" id="sTitle"></td>
  </tr>
  <tr>
    <td width="358" bgcolor="#FFFFFF" colspan="2" height="120" valign="top" id="sContent"></td>
  </tr>
  <tr>
    <td width="358" bgcolor="#FFFFFF" align="center" colspan="2">[<a href="javascript:window.close();">关闭</a>]</td>
  </tr>
</table>
<script language="vbscript">
dim sStrTmp
sStrTmp=trim(window.opener.document.send_mail_form.sEMail.value)
sRecMail.innerHTML="<u>" & sStrTmp & "</u>"
sStrTmp=trim(window.opener.document.send_mail_form.sSender.value)
if sStrTmp="" then sStrTmp="<%=Request.ServerVariables("REMOTE_ADDR")%>"
if trim(window.opener.document.send_mail_form.sFrom.value)="" then
    sStrTmp=sStrTmp & " &lt;aosx@aosx.com&gt;"
   else
    sStrTmp=sStrTmp & " &lt;" & window.opener.document.send_mail_form.sFrom.value & "&gt;"
end if
sSender.innerHTML="<u>" & sStrTmp & "</u>"
sStrTmp=trim(window.opener.document.send_mail_form.sTitle.value)
sTitle.innerHTML="<u>" & sStrTmp & "</u>"
sStrTmp=trim(window.opener.document.send_mail_form.sContent.value)
if window.opener.document.send_mail_form.lHTML.checked then
    sContent.innerHTML=sStrTmp
   else
    sStrTmp=replace(sStrTmp,vbCrLf,"<br>")
    sStrTmp=replace(sStrTmp,Chr(32),"&nbsp;")
    sContent.innerHTML=sStrTmp
end if
</script><%
response.write "</body></html>"
response.end
end if %>
<table width="500" height="400" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#000000">
  <tr>
    <td width="100%" bgcolor="#E7E7E7" height="42" align="center">    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%" align="center" class="bigfont1"><%=sSysTitle%></td>
      </tr>
      <tr>
        <td width="100%" align="center">Version<%=sVersion%></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#FFFFFF" align="center">
<% if lcase(trim(request("action")))="" then
dim ids,urls,types,M_mobile,m_number,names
ids=trim(request("number"))
types=trim(request("types"))
M_mobile=trim(request("M_mobile"))
m_number=trim(request("m_number"))
names=trim(request("names"))
if types= "flea" then
urls="http://www.xasjw.com/old/show.asp?number="&ids
names=names
else
urls="http://www.xasjw.com/"&M_mobile&"/"&m_number&".htm"
names=names&"手机最新价格,测评,铃声,图片"
end if
if ids="" then
urls="http://www.xasjw.com"
end if
%>
<script language="vbscript">
Sub ConfirmSend()
if ChkInputData() then 
    document.send_mail_form.btn_send.disabled=true
    document.send_mail_form.btn_reset.disabled=true
    document.send_mail_form.action="index.asp?action=sendmail"
    document.send_mail_form.submit
end if
End Sub

Sub DoPreview()
if ChkInputData() then 
    window.open "index.asp?action=preview","SHOW_PREVIEW","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=0,scrollbars=1,width=420,height=300"
end if
End Sub

Sub ConfirmRet()
If MsgBox("是否清空当前数据？", vbYesNo + vbQuestion + vbDefaultButton2, "<%=sSysTitle%>") = vbYes Then document.send_mail_form.reset
End Sub

Sub ShowSMTPSvr()
    window.open "?action=smtp","SHOW_SMTP","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=0,scrollbars=0,width=280,height=120"
End Sub

Function ChkInputData()
if trim(document.send_mail_form.sEMail.value)="" then
    MsgBox "邮件发送失败：收件人地址不能为空！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
    document.send_mail_form.sEMail.focus
    ChkInputData=False
    exit function
end if
if CHKMail(trim(document.send_mail_form.sEMail.value))=False then
    MsgBox "邮件发送失败：收件人地址格式错误！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
    document.send_mail_form.sEMail.focus
    document.send_mail_form.sEMail.select
    ChkInputData=False
    exit function
end if
if document.send_mail_form.lAnonymous.checked=false then
    if trim(document.send_mail_form.sSender.value)="" then
         MsgBox "邮件发送失败：因为您选择了非匿名发送，因此发件人名称不能为空！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
         document.send_mail_form.sSender.focus
         ChkInputData=False
         exit function
    end if
    if trim(document.send_mail_form.sFrom.value)="" then
         MsgBox "邮件发送失败：因为您选择了非匿名发送，因此发件人邮件地址不能为空！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
         document.send_mail_form.sFrom.focus
         ChkInputData=False
         exit function
    end if
    
    if CHKMail(trim(document.send_mail_form.sFrom.value))=False then
         MsgBox "邮件发送失败：发件人邮件地址格式错误！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
         document.send_mail_form.sFrom.focus
         document.send_mail_form.sFrom.select
         ChkInputData=False
         exit function
    end if
end if
if trim(document.send_mail_form.sTitle.value)="" then
    MsgBox "邮件发送失败：邮件主题不能为空！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
    document.send_mail_form.sTitle.focus
    ChkInputData=False
    exit function
end if
if Len(trim(document.send_mail_form.sTitle.value))>50 then
    MsgBox "邮件发送失败：邮件主题长度不能大于50字节！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
    document.send_mail_form.sTitle.focus
    document.send_mail_form.sTitle.select
    ChkInputData=False
    exit function
end if
if trim(document.send_mail_form.sContent.value)="" then
    MsgBox "邮件发送失败：邮件主体不能为空！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
    document.send_mail_form.sContent.focus
    ChkInputData=False
    exit function
end if
if Len(trim(document.send_mail_form.sContent.value))>16384 then
    MsgBox "邮件发送失败：邮件主体长度不能大于16K！", vbOKOnly + vbCritical, "<%=sSysTitle%>"
    document.send_mail_form.sContent.focus
    document.send_mail_form.sContent.select
    ChkInputData=False
    exit function
end if
ChkInputData=True
End Function

Function CHKMail(byval sMail)
Dim sMailStr
dim lFoundError
lFoundError=0
sMailStr=sMail
if instr(sMailStr,"@")=0 or instr(sMailStr,".")=0 then lFoundError=1
if lFoundError=1 then
    CHKMail=False
   else
    CHKMail=True
end if    
End Function

Sub SendToDuclika()
if trim(document.send_mail_form.sEMail.value)<>"" or trim(document.send_mail_form.sContent.value)<>"" then
    If MsgBox("系统检测到您好象正在编写邮件，是否清空当前数据？", vbYesNo + vbQuestion + vbDefaultButton1, "<%=sSysTitle%>") = vbNo Then
         Exit Sub
    End If
end if
document.send_mail_form.sEMail.value="aosx@aosx.com"
document.send_mail_form.sTitle.value="发送程序反馈"
document.send_mail_form.sContent.value="请在这里输入您的反馈信息"
document.send_mail_form.sContent.focus
document.send_mail_form.sContent.select
End Sub
</script>
      <form method="post" action="index.asp" name="send_mail_form">
      <table border="0" width="100%" bgcolor="#C0C0C0" cellspacing="1" cellpadding="3">
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">朋友地址：</td>
          <td width="81%" bgcolor="#FFFFFF"><input type="text" name="sEMail" size="20">            (如:aosx@aosx.com 多帐号用,分隔)</td>
        </tr>
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">您的名称：</td>
          <td width="81%" bgcolor="#FFFFFF"><input type="text" name="sSender" size="20">(使用匿名发送时此项没效)</td>
        </tr>
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">您的地址：</td>
          <td width="81%" bgcolor="#FFFFFF"><input type="text" name="sFrom" size="20">(使用匿名发送时此项没效)</td>
        </tr>
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">邮件主题：</td>
          <td width="81%" bgcolor="#FFFFFF"><input type="text" name="sTitle" size="47"></td>
        </tr>
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">邮件主体：</td>
          <td width="81%" bgcolor="#FFFFFF"><textarea rows="7" name="sContent" readonly="ture" cols="46">您好：
    您的朋友在本站（西安手机网http://www.xasjw.com）
为您推存以下信息：
<%=names%>
信息地址链接为：
<%=urls%>
以上链接信息经本站审核为合法信息，内含最新手机价格，二手手机买卖
信息。您可以放心打开查看。

注：您的朋友为你推荐时间为<%=now()%>

本邮件为您的朋友匿名发送，请勿直接回复。

               西安手机网 <%=date()%></textarea></td>
        </tr>
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">邮件选项：</td>
          <td width="81%" bgcolor="#FFFFFF">
              <input type="checkbox" name="lAnonymous" value="1">匿名发送(使用系统默认名称)                                                                                                                         
              <input type="checkbox" name="lHTML" value="1">使用HTML正文                                                                                                                         
              [<a href="#" onclick="vbscript:call DoPreview()">预览</a>]
          </td>
        </tr>
        <tr>
          <td width="19%" bgcolor="#FFFFFF" align="right">　</td>
          <td width="81%" bgcolor="#FFFFFF">
              <input type="button" value="立即发送" name="btn_send" onclick="vbscript:call ConfirmSend()">
              <input type="button" value="重写" name="btn_reset" onclick="vbscript:call ConfirmRet()">
              <input type="button" value="官方网站" onclick="javascript:window.open('http://www.xasjw.com/');">
			  <input type="button" value="返馈意见" onclick="vbscript:call SendToDuclika()" title="联系站长：aosx@aosx.com">
          </td>
        </tr>
      </table>
      </form><%
   else
      response.write "<script language=vbscript>" & vbCrLf & "Sub SendToDuclika()" & vbCrLf & "End Sub" & vbCrLf & "</script>"
end if
Sub VJMail_Config()
Call V_JMail_Config()
if sMailUser="" or sSenderPassword="" or sSMTPServer="" or (Not IsNumeric(lShowSMTPSvr)) then
   response.write "系统初始化错误，请联系管理员"
   response.end
end if
if sSysTitle="" then sSysTitle="西安手机网邮件系统"
if sVersion="" then sVersion="1.0"
End Sub
if lcase(trim(request("action")))="sendmail" then
if len(request("lAnonymous"))=0 then
    lAnonymous=0
   else
    lAnonymous=clng(request("lAnonymous"))
end if
if len(request("lHTML"))=0 then
    lHTML=0
   else
    lHTML=clng(request("lHTML"))
end if
sRecMail=lcase(trim(request("sEMail")))
if instr(sRecMail,"@")=0 or instr(sRecMail,".")=0 then sErrorMsg=sErrorMsg & "·收件人邮件格式错误<br>"
sFromName=trim(request("sSender"))
if sFromName="" then
   if lAnonymous=1 then
      sFromName=Request.ServerVariables("REMOTE_ADDR")
     else
      sErrorMsg=sErrorMsg & "·发件人名称为空<br>"
   end if
end if
sFromMail=trim(request("sFrom"))
if sFromMail="" then
   if lAnonymous=1 then
      sFromMail="aosx@aosx.com"
     else
      sErrorMsg=sErrorMsg & "·发件人邮件为空<br>"
   end if
  else
   if instr(sFromMail,"@")=0 or instr(sFromMail,".")=0 then sErrorMsg=sErrorMsg & "·发件人邮件格式错误<br>"
end if
sMailSubject=trim(request("sTitle"))
if sMailSubject="" then sErrorMsg=sErrorMsg & "·邮件主题为空<br>"
sMailBody=request("sContent")
if trim(sMailBody)="" then
    sErrorMsg=sErrorMsg & "·邮件主体为空<br>"
  else
    if lHTML=0 then
        sMailBody=sMailBody
      else
        sMailBody=Trim(sMailBody)
    end if
end if

if sErrorMsg<>"" then
    response.write "邮件发送失败，可能有如下的原因：<br><br>" & sErrorMsg & "<br><a href=javascript:history.back()>·返回</a>"
    response.end
end if

Set JmailMsg = Server.CreateObject("JMail.Message")
JmailMsg.silent = true
JmailMsg.Logging = true
JmailMsg.Charset = "gb2312"
if lHTML=1 then
   JmailMsg.ContentType="text/html"
   sMailBody=sMailBody & "<p>此邮件是由西安手机网网友为您推荐发送。<br>详细情况请访问西安手机网网站：<a href=http://www.xasjw.com/ target=_blank>http://www.xasjw.com</a></p>"
  else
   JmailMsg.ContentType="text/plain"
   sMailBody=sMailBody & "此邮件是由西安手机网网友为您推荐发送。。" & vbCrLf & "详细情况请访问西安手机网网站：：http://www.xasjw.com/"
end if
JmailMsg.MailServerUserName = sMailUser
JmailMsg.MailServerPassword = sSenderPassword
JmailMsg.From = sFromMail
JmailMsg.FromName = sFromName
if instr(sRecMail,",")>0 then
    sRecMailArr=split(sRecMail,",")
    for RecMail_i=0 to UBound(sRecMailArr)
         JmailMsg.AddRecipient sRecMailArr(RecMail_i)
    next
  else
    JmailMsg.AddRecipient sRecMail
end if
JmailMsg.Subject = sMailSubject
JmailMsg.Body = sMailBody & vbCrLf
JmailMsg.Send sSMTPServer

if JmailMsg.ErrorCode>0 then
   response.write "邮件发送失败：" & JmailMsg.ErrorMessage & "<br><br>可能错误来源：" & JmailMsg.ErrorSource & "<br><br><a href=javascript:history.back()>返回</a>"
  else
   response.write "== 邮件已成功发送到以下地址 ==<br><br>"
   if instr(sRecMail,",")>0 then
      for RecMail_i=0 to UBound(sRecMailArr)
         response.write sRecMailArr(RecMail_i) & "<br>"
      next
     else
      response.write sRecMail & "<br>"
   end if
   response.write "<br><a href=?>返回</a>"
end if
JmailMsg.close
set JmailMsg = nothing
end if %>
    </td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#FFFFFF" align="center"></td>                                                                                           
  </tr>
  <tr>
    <td width="100%" bgcolor="#FFFFFF" align="center">Copyright &copy; [<a href="http://www.xasjw.com" target="_blank" title="http://www.xasjw.com/">西安手机网</a>] <span class="style1">xasjw.com</span> 2006</td>                                                                                            
  </tr>
</table>
<script src="http://www.xasjw.com/tuoji/mystat.asp?siteid=1"></script>
</body>
</html>