<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/System_Language.asp" -->
<!--#include file="../Include/Version.Asp" -->
<!--#include file="CheckAdmin.Asp"-->
<%
'*********************************************
'软件名称：博科企业网站内容管理系统（BOKECMS）
'软件开发：博科网络科技工作室
'网    址：http://www.bokew.net
'服务  QQ：530051328
'服务邮箱：bbfhq@163.com
'微信公众号：bokewlkj
'*********************************************
%>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>给会员发送邮件</TITLE>
<!--#Include file="BokeCMS_Css.Asp"-->
<script language="javascript" src="../Script/Admin.js"></script>
<!--kindeditor编辑器-->
		<link rel="stylesheet" href="../KindEditor/themes/default/default.css" />
		<script charset="utf-8" src="../KindEditor/kindeditor-min.js"></script>
		<script charset="utf-8" src="../KindEditor/lang/zh_CN.js"></script>
		<script>
			var editor;			
			KindEditor.ready(function(K) {
				editor = K.create('textarea[name="S1htm"]', {
					resizeType : 2,//0:设置kindeditor编辑器大小不可改变; 1:只能该变高度; 2:可以改变高度和宽度
					afterBlur: function(){this.sync();},//失去焦点执行this获得值
					allowPreviewEmoticons : false,
					allowImageUpload : false,					
					items : [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
				});
			});
		</script>
<!--kindeditor编辑器END-->
<script language="javascript">
<!--
//验证邮箱正确性
function checkemail(email){
var str=email;
//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
var Expression=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; 
var objExp=new RegExp(Expression);
if(objExp.test(str)==true){
return true;
}else{
return false;
}
} 

//说明字节数限制，与下面配合=========
String.prototype.Length=function(){
temp=this.replace(/([^\x00-\xff])/g,"$1$1");
return temp.length
}

function formcheck(){
	if (document.email.maildizhi.value=="" )
	{
	  alert("请填邮箱")
	  document.email.maildizhi.focus()
	  return false
	 }
    if((!checkemail(email.maildizhi.value))&&(document.email.maildizhi.value!=""))
	{
    alert("您输入Email地址不正确，请重新输入!");
    document.email.maildizhi.focus();
    return false;
    }
if (document.email.mailbiaoti.value=="" )
	{
	  alert("请填邮件主题")
	  document.email.mailbiaoti.focus()
	  return false
	 }
if (document.email.mail_S1.length>5000)  //字节数限制，与上面配合。
     {
	 alert("邮件内容长度要求<%=5000%>字节(<%=2500%>汉字)内，请重新输入！");
	  return false
  }
}
// --></script>
</HEAD>
<%'邮件发送
Call SiteInfo()
If trim(request("dnjymail"))="ok" Then
Dim aJMail   
Set aJMail=Server.CreateObject("JMail.Message")   
If aJMail Is Nothing Then  
response.write "<script LANGUAGE='javascript'>alert('温馨小提示：服务器不支持JMail.Message组件，请立即安装此组件，此组件用于邮件发送!');history.go(-1);</script>"
Response.End
End If

If Request.form("S1") <> "" and Request("S1htm") <> "" Then  
response.write "<script LANGUAGE='javascript'>alert('温馨小提示：两种格式邮件内容不能同时填写!');history.go(-1);</script>"
Response.End
End If
If Request("radiobutton") = "text" and Request("S1")="" Then  
response.write "<script LANGUAGE='javascript'>alert('温馨小提示：选择文本格式邮件请将内容填写在文本格式邮件内容框!');history.go(-1);</script>"
Response.End
End If
If Request("radiobutton") = "html" and Request("S1htm")="" Then  
response.write "<script LANGUAGE='javascript'>alert('温馨小提示：选择HTML格式邮件请将内容填写在HTML格式邮件内容框!');history.go(-1);</script>"
Response.End
End If
Dim e_info,HostName,E_Subject,Information,S_Type,C_M_Chk
Email=request.form("maildizhi")
HostName=JMailName
E_Subject=request.form("mailbiaoti")
If Request.form("S1") <> "" then
Information=Request.form("S1")
Else
Information=Request.form("S1htm")
End If
S_Type=True
If Request("radiobutton") = "text" Then S_Type=False
C_M_Chk=True
e_info=bokeEmail(Email,HostName,E_Subject,Information,S_Type,C_M_Chk)
response.write "<center>"&e_info&"</center>"
response.end
End If
'邮件发送END

dim id
id=trim(request("id"))
if not isnumeric(id) or id="" then
response.write "<li>参数错误！"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select email from BokeCMS_Members where id="&cstr(id)
rs.open sql,conn,1,1
if rs.eof then
response.write "<li>参数错误！"
response.end
end if

%>
<meta http-equiv="Content-Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="../css/css.css">
<BODY>
<title>发送邮件</title>
<body topmargin="3" leftmargin="0">
<div align="center">
  <center>

  <table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#ADAED6" width="100%" cellpadding="0">
  <tr bgcolor="#BDBEDE">
    <td width="100%" height="28" colspan="8" align="center"><b><span class="style2">发送电子邮件</span></b></td>
  </tr>
</table>
  <form name="email" action="?id=<%=id%>&dnjymail=ok" method="POST" onSubmit="return formcheck()">
 <table border="1" width="99%" height="161"  background="images/greystrip.gif"  bordercolordark="#FFFFFF"  cellspacing="0">
      <tr>
    <td width="100%" colspan="2" height="20">
      <p ><font color="#ff0000"> 注意：由于很多邮局、尤其是免费邮箱群发邮件都受监测，可能因过密或内容相同而被暂时或永久禁止发信功能，如果需经常群发邮件的建议购买不受限制的企业邮局！</font></p>
    </td>
  </tr>
  <tr>
    <td width="100%" colspan="2" height="20" background="images/mmto.gif">
      <p align="center"></p>
    </td>
  </tr>
  <tr>
    <td width="25%" height="26">收信邮箱：</td>
    <td width="75%" height="26"> <%=rs("email")%></td> 
   <input type="hidden" name="maildizhi" value="<%=rs("email")%>">              
  </tr>                                                                   
  <tr>                                                                   
    <td width="25%" height="26">邮件主题：</td>                                                                   
    <td width="75%" height="26"><input type="text" name="mailbiaoti" style="border:1px black solid" size="36">                                                                    
    </td>                                                                   
  </tr>                                                                   
  <tr>                                                                   
    <td width="25%" height="26">邮件格式：</td>                                                                   
    <td width="75%" height="26"><input type="radio" name="radiobutton" value="text" checked  style="border:1px black solid">                                                                   
      文本邮件&nbsp; <input type="radio" name="radiobutton" value="html" style="border:1px black solid">                                                                          
        HTML邮件&nbsp;</td>                                                                           
  </tr>
  <tr>                                                                   
    <td width="25%" height="26"> </td>                                                                   
    <td width="75%" height="26"><font color="#ff0000"> 下面两个内容框要根据选择的邮件格式对应填写，不能同时填写！</font></td>
  </tr>    
  <tr>                                                                           
    <td width="25%" height="26">文本格式邮件内容：</td>                                                                          
    <td width="75%" height="26"><textarea name="S1" cols="66" rows="15" style="border:1px black solid">－－－－本站网址http://<%=SiteUrl%>，欢迎光临！</textarea> </td>                                                                          
  </tr> 
  <tr>                                                                           
    <td width="25%" height="26">HTML格式邮件内容；</td>                                                                          
    <td width="75%" height="26"><textarea id="editor" name="S1htm"  style="width:500px;height:280px;visibility:visible"></textarea></td>                                                                          
  </tr>   
                                                                       
  <tr>                                                                          
    <td width="100%" height="26" colspan="2">                                                                          
      <p align="center"><input type="submit" name="send" value="发送" style="border-style: solid; border-width: 1">                                                                           
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" name="Submit" value="取消" style="border-style: solid; border-width: 1">     
    </td>                                                                          
  </tr> 
    </form>
 </table>

  
  </center>
</div>
<%rs.close
set rs=nothing%>
