  <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="19"
	dir="../err.asp" 
  %>
  <!--#include file="../../conn/conn.asp"-->
 <!--#include file="../rolecheck.asp"-->
<script language="javascript">
<!--
function checks()
{
if(document.sendmail.frommail.value=="")
{
alert("发信人不能为空!");
return false;
}
 if(document.sendmail.mailsubject.value=="")
{
alert("请输入信件标题!");
return false;

}
 if(document.sendmail.mailbody.value=="")
{
alert("请输入信件内容!");
return false;

}
if(document.sendmail.tomail.value=="")
{
var i=confirm("你没有输入收信人地址！那么将进行群发邮件！你确定要群发吗，请考虑网络传输速率和系统资源!");
if(i)
{
return true;
}
else
{
return false;
}
}
 }
 function istrues()
 {
 var i=confirm("你确定要进行自动匹配商机发送吗？此操作可能消耗较多资源！");
 if(i)
 {
 return true;
 }
 else
 {
 return false;
 }
 }
 
 function UType(n){
	var ToUserGroup = document.getElementById("ToUserGroup");
	if (n==0){
		ToUserGroup.style.display = "none";
	}
	else{
		if (n==1){
			ToUserGroup.style.display = "";
		}
		else{
			ToUserGroup.style.display = "none";
		}
	}
}

function SendGroup()     //邮件群发
{
var Title=document.sendmail.mailsubject.value;
var Content=document.sendmail.mailbody.value;
var frommail=document.sendmail.frommail.value;
var mail_pwd=document.sendmail.mail_pwd.value;
var mail_smtp=document.sendmail.mail_smtp.value;
if (Title=="")
{
alert("标题不可缺！");
return false;
}
if (Content=="")
{
alert("内容不可缺！");
return false;
}

for (i=0;i<document.sendmail.GetGroupID.length;i++)
{
  var Typeid;
  if (document.sendmail.GetGroupID[i].checked)
  {
  Typeid=document.sendmail.GetGroupID[i].value;
  }
}
location.href='Member_sendmail.asp?tit='+Title+'&con='+Content+'&id='+Typeid+'&mailsmtp='+mail_smtp+'&frommail='+frommail+'&mailpwd='+mail_pwd
}
//-->
</script>
<LINK href="../css/style.css" rel=stylesheet type=text/css>
<%

	Function IsObjInstalled(strClassString)
		on error resume next
		IsObjInstalled = False
		Err = 0
		Dim xTestObj
		Set xTestObj = Server.CreateObject(strClassString)
		If 0 = Err Then IsObjInstalled = True
		Set xTestObj = Nothing
		Err = 0
	End Function
 	Dim theInstalledObjects(0)
     theInstalledObjects(0) = "JMail.SMTPMail"
 %>
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<table width="98%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#7698DD" class="a2">
 	<tr bgcolor="#D6DFEF" class="a4">
		<td height="30" align="center" bgcolor="#7698DD">
      
      <span class="STYLE1">发 送 邮 件</span>  <br>      </td>
 	</tr><tr><td height="20">
      Jmail组件支持：
      <%If Not IsObjInstalled(theInstalledObjects(0)) Then%><font color="red">对不起！不能用Jmail组件发送邮件,需安装了jmail组件才可发送邮件！<b>×</b></font><%else%><b><font color="red">√</font></b><%end if%>
    </td></tr><tr><td>
     <table border="0"  bordercolor="#B8CFE4" cellpadding="0"  cellspacing="0" align="center" width="100%" >
	 <form name="emform" method="post" action="sendinfoemail.asp?LogName=69" onsubmit="return istrues();"><tr><td  >  
 	 <font   color="#0099CC">提示：由于随着会员数量的增加和订阅商机有关的代理信息的增加，会造成系统定时自动发送时消耗大量的服务器资源而引起系统无法正常运行！由此采用后台事件触发的方式进行发送，以缓解上述问题的严重性！请不要随意的触发此功能！后果自负！</font></td></tr><tr><td height="40" align="center" valign="middle" bgcolor="#D6DFEF"> 
 	       <input type="submit" name="sendgo" value="点击进行订阅商机自动匹配发送至会员Email处理"   />
  </td></tr>
	<tr><td bgcolor="#0099CC"  height="2" ></td></tr>
	</form></table>
  	  
	  
 	  <form name="sendmail" action="Bs_Mail_Send_to.asp" method="post"    onsubmit="return checks();">
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#D3DCEE">
          <tr> 
            <td width="84" height="25" align="right" bgcolor="#DFE6F3">
 <font color="#000000">发信人地址：</font> </td>
            <td width="572" height="30" bgcolor="#DFE6F3"> <input name="frommail" type="text" value="<%=SystemEmail%>" size="30" maxlength="50">
            (默认设置在基本设置中)</td>
          </tr>
          <tr>
            <td width="84" align="right" bgcolor="#D3DCEE">发信人邮箱密码：</td>
            <td height="35" bgcolor="#D3DCEE"><input name="mail_pwd" type="password" id="mail_pwd" value="<%=HOPE_MailPwd%>" size="30" maxlength="50" />              
              (
            默认设置在基本设置中)</td>
          </tr>
          <tr>
            <td width="84" align="right" bgcolor="#DFE6F3">发件人邮箱的邮件服务器地址：</td>
            <td height="35" bgcolor="#DFE6F3"><input name="mail_smtp" type="text" id="mail_smtp" value="<%=SMTPServer%>" size="30" maxlength="50">
(
            默认设置在基本设置中)</td>
          </tr>
		    <tr>
            <td width="84" align="right" bgcolor="#DFE6F3">用户类别：</td>
            <td height="35" bgcolor="#DFE6F3"><input name="mailtype" type="radio" value="0" checked="checked" style="border:0" onclick="UType(this.value)" />
用户名单
  <input type="radio" name="mailtype" value="1" style="border:0" onclick="UType(this.value)" />
会员类型
			<div id="ToUserGroup" style="display:none;">
	<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center>
	<tr class='tdbg' onmouseout="this.className='tdbg'" onmouseover="this.className='tdbgmouseover'"><td height=20>指定会员类型</td></tr>
	<tr class='tdbg' onmouseout="this.className='tdbg'" onmouseover="this.className='tdbgmouseover'"><td>
<%
set rsmail=server.CreateObject("adodb.recordset")
sqlmail="select * from yixiang_vipgrade"
rsmail.open sqlmail,conn,1,1
If rsmail.eof then
  response.Write("<script language='javascript'>alert('请先添加会员类型');history.go(-1);</script>")
  response.end
End if
do while not rsmail.eof
%>
<INPUT type="radio" NAME="GetGroupID" id="GetGroupID" value="<%=rsmail("roleid")%>" style="border:0" onclick="SendGroup()"><%=rsmail("gradename")%>
<%
rsmail.movenext
loop
rsmail.close
set rsmail=nothing
%>
	</td></tr>
	<tr><td height=20 ID="UpSetting" style="display:NONE">
	</td></tr>
	</table>
</div>
</td>
          </tr>
          <tr> <%email=request("email")%>
            <td align="right" bgcolor="#D3DCEE"><font color="#000000">收信人地址：</font></td>
            <td height="40" bgcolor="#D3DCEE"> 
              <textarea name="tomail" id="tomail" style="width:530px; height:100px"></textarea>
              <br>
            <font color="#000000">（如果为空，从数据库取地址群发！多个用户请用“,”号隔开。） </font></td>
          </tr>
          <tr> 
            <td align="right" bgcolor="#D3DCEE"><font color="#000000">信件标题：</font></td>
            <td height="35" bgcolor="#D3DCEE"> 
            <input name="mailsubject" type="text" value="<%=webname%>" size="50" maxlength="50"></td>
          </tr>
          <tr> 
            <td align="right" bgcolor="#D3DCEE"><font color="#000000">信件内容：</font></td>
            <td bgcolor="#D3DCEE"> 
              <textarea name="mailbody" style="width:530px; height:100px"><%=webname%></textarea>
              <br>
              <br>            </td>
          </tr>
          <tr bgcolor="#336699"> 
             <td height="30" align="center" colspan="2" bgcolor="#ECF5FF"> 
             <%
			 If   IsObjInstalled(theInstalledObjects(0)) Then
			 %> <input type="submit" name="Submit" value=" 发 送 ">&nbsp;&nbsp;
              <input type="button" name="Submit" value=" 取 消 " onClick="javascript:history.back();"> 
            <input type="hidden" name="action" value="我发">  
			 <%
			 end if 
			 %>			         </td>
          </tr>
        </table>
</form>
	  </td>
	</tr>
</table>
  