邮件发送测试页面--前台页面
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Test.SendMailSample" %>
<HTML>
<HEAD>
<title>邮件发送例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">TD {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
.TextBox {
BORDER-RIGHT: #000000 thin dashed; BORDER-TOP: #000000 thin dashed; BORDER-LEFT: #000000 thin dashed; BORDER-BOTTOM: #000000 thin dashed
}
</style>
</HEAD>
<body text="#000000" bgColor="#ffffff">
<form runat="server">
<table style="BORDER-COLLAPSE: collapse" borderColor="#111111" cellSpacing="0" cellPadding="3" width="500" align="center" border="1">
<tr>
<td align="middle" colSpan="2">邮件发送例子(SOCKET类)</td>
</tr>
<asp:panel id="pelMessage" Visible="False" Runat="server">
<TR>
<TD align="middle" colSpan="2">
<asp:Label id="lblMessage" runat="server"></asp:Label></TD>
</TR>
</asp:panel>
<tr>
<td align="right" width="150">SMTP服务器:</td>
<td width="350"><asp:textbox id="txtSmtpHost" runat="server" CssClass="TextBox" MaxLength="50"></asp:textbox><asp:requiredfieldvalidator id="rfvSmtpHost" runat="server" ErrorMessage="*" ControlToValidate="txtSmtpHost" Display="Dynamic"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td align="right" width="150">SMTP服务器端口:</td>
<td width="350"><asp:textbox id="txtPort" runat="server" CssClass="TextBox" MaxLength="6"></asp:textbox><asp:requiredfieldvalidator id="rfvPort" runat="server" ErrorMessage="*" ControlToValidate="txtPort" Display="Dynamic"></asp:requiredfieldvalidator><asp:regularexpressionvalidator id="revPort" runat="server" ErrorMessage="只能输入数字" ValidationExpression="d{1,}" ControlToValidate="txtPort" Display="Dynamic"></asp:regularexpressionvalidator></td>
</tr>
<tr>
<td align="right" width="150">邮件发送者:</td>
<td width="350"><asp:textbox id="txtFrom" runat="server" CssClass="TextBox" MaxLength="50"></asp:textbox><asp:requiredfieldvalidator id="rfvFrom" runat="server" ErrorMessage="*" ControlToValidate="txtFrom" Display="Dynamic"></asp:requiredfieldvalidator>
<asp:regularexpressionvalidator id="revFrom" runat="server" ErrorMessage="邮件格式错误" ValidationExpression="w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*" ControlToValidate="txtFrom" Display="Dynamic"></asp:regularexpressionvalidator></td>
</tr>
<tr>
<td align="right" width="150">发送者显示名称:</td>
<td width="350"><asp:textbox id="txtFromName" runat="server" CssClass="TextBox" MaxLength="20"></asp:textbox></td>
</tr>
<tr>
<td align="right" width="150">邮件接收者:</td>
<td width="350"><asp:textbox id="txtTo" runat="server" CssClass="TextBox" MaxLength="50"></asp:textbox><asp:requiredfieldvalidator id="rfvTo" runat="server" ErrorMessage="*" ControlToValidate="txtTo" Display="Dynamic"></asp:requiredfieldvalidator>
<asp:regularexpressionvalidator id="revTo" runat="server" ErrorMessage="邮件格式错误" ValidationExpression="w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*" ControlToValidate="txtTo" Display="Dynamic"></asp:regularexpressionvalidator></td>
</tr>
<tr>
<td align="right" width="150">接收者显示名称:</td>
<td width="350"><asp:textbox id="txtToName" runat="server" CssClass="TextBox" MaxLength="20"></asp:textbox></td>
</tr>
<tr>
<td align="right" width="150">邮件发送优先级:</td>
<td width="350"><asp:dropdownlist id="ddlPriority" runat="server">
<asp:ListItem Value="高">高</asp:ListItem>
<asp:ListItem Value="默认" Selected="True">默认</asp:ListItem>
<asp:ListItem Value="低">低</asp:ListItem>
</asp:dropdownlist></td>
</tr>
<tr>
<td align="right" width="150">发送HTML格式的邮件:</td>
<td width="350"><asp:dropdownlist id="ddlHtml" runat="server">
<asp:ListItem Value="是" Selected="True">是</asp:ListItem>
<asp:ListItem Value="否">否</asp:ListItem>
</asp:dropdownlist></td>
</tr>
<tr>
<td align="right" width="150">邮件主题:</td>
<td width="350"><asp:textbox id="txtSubject" runat="server" CssClass="TextBox" MaxLength="50"></asp:textbox>
<asp:RequiredFieldValidator id="rfvSubject" runat="server" ErrorMessage="*" ControlToValidate="txtSubject" Display="Dynamic"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td align="right" width="150">邮件内容:</td>
<td width="350">
<asp:textbox id="txtMessage" runat="server" Rows="15" TextMode="MultiLine" CssClass="TextBox" Columns="40"></asp:textbox>
<asp:RequiredFieldValidator id="rfvMessage" runat="server" ErrorMessage="*" ControlToValidate="txtMessage" Display="Dynamic"></asp:RequiredFieldValidator>
</td>
</tr>
<tr align="middle">
<td colSpan="2">
<asp:Button id="btnSendMail" runat="server" Text="发送邮件" CssClass="TextBox" BackColor="Silver" ForeColor="Blue"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>