<%@ 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="VB" runat="server">
	sub sendMail_Click(sender as object,e as EventArgs)
		Dim NowDS as DataSet = Ctype(Session("DBEmail"),DataSet)
		Dim NewMail as MailMessage = new MailMessage()
		Dim MailAddress as string=""
		dim i as Integer=0
		for i=0 to NowDS.Tables("Employees").Rows.Count-1
			if NowDS.Tables("Employees").Rows(i)("Send").ToString()="-1" then
				MailAddress+="" & NowDS.Tables("Employees").Rows(i)("Email")
			end if
		next
		if MailAddress <> "" then'取得多位收件人后,去掉最左方的
			MailAddress=MailAddress.Remove(0,1)
		end if
		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)'发送					
	end sub
	</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>