前台頁面郵件發送測試

來源:互聯網
上載者:User
頁面 <%@ 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>


相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。