<%@ Register TagPrefix="Title" TagName="TitleShow" Src="/aspnetdata/Title.ascx" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<html>
<head>
	<script language="C#" runat="server">
	void sendMail_Click(object sender,EventArgs e){
		DataSet NowDS=(DataSet)Session["DBEmail"];
		MailMessage NewMail = new MailMessage();
		string MailAddress="";
		for(int i=0;i<=NowDS.Tables["Employees"].Rows.Count-1;i++){
			if(NowDS.Tables["Employees"].Rows[i]["Send"].ToString()=="-1"){
				MailAddress+=";" + NowDS.Tables["Employees"].Rows[i]["Email"];
			}
		}
		if(MailAddress != ""){//取得多位收件人后,去掉最左方的;
			MailAddress=MailAddress.Remove(0,1);
		}
		NewMail.To=MailAddress;
		NewMail.Subject=Subject.Text;
		NewMail.From=SendE.Text	;
		NewMail.Body=TextBody.Text;
//		MailAttachment NewAttach = new MailAttachment(C:\test.doc")
//		NewMail.Attachments=NewAttach
		SmtpMail.Send(NewMail);//发送					
	}
	</script>
</head>
<body background="/aspnetdata/images/winback.gif">
<Title:TitleShow id="BookT" Runat="server" />
<form runat="server">
<table>
<tr><td align="right">发件人：</td><td><asp:Textbox Columns="30" ID="SendE" Runat="server" />
        <asp:RequiredFieldValidator id="SendER" ControlToValidate="SendE" Display="Dynamic" Font-Name="Arial" Font-Size="11" runat="server">
            必须输入发件人
        </asp:RequiredFieldValidator>
</td></tr>
<tr><td align="right">主题：</td><td><asp:Textbox Columns="30" ID="Subject" Runat="server" /></td></tr>
<tr><td align="right" valign="top">本文：<p>本文格式<asp:RadioButtonList id="Frm" runat="server">
            <asp:ListItem Selected="True">Text</asp:ListItem>
            <asp:ListItem >HTML</asp:ListItem>
        </asp:RadioButtonList></td><td><asp:Textbox ID="TextBody" Rows="7" Columns="45" TextMode="MultiLine" Runat="server" /></td></tr>
<tr><td align="center"><ASP:Button id="sendMail" Runat="server" Text="发送" onclick="sendMail_Click" /></td></tr>
</table>

</form>
</body>