Front page mail Send test
Last Update:2017-02-28
Source: Internet
Author: User
Pages <%@ page language= "C #" codebehind= "WebForm1.aspx.cs" autoeventwireup= "false" inherits= "test.sendmailsample"% >
<HTML>
<HEAD>
<title> e-Mail Send example </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >TD {
font-size:9pt; font-family: "Song Body"
}
. 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= "align=" Center "border=" 1 ">
<tr>
<TD align= "Middle" colspan= "2" > Mail sending example (socket Class) </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= ":</td>" >SMTP server
<TD width= "><asp:textbox" id= "Txtsmtphost" runat= "Server" cssclass= "textbox" Maxlength= "></asp" : Textbox><asp:requiredfieldvalidator id= "Rfvsmtphost" runat= "Server" errormessage= "*" controltovalidate= " Txtsmtphost "display=" Dynamic "></asp:requiredfieldvalidator></td>
</tr>
<tr>
<TD align= "right" width= "" ">smtp Server port:</td>
<TD width= "><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= " The server "errormessage=" can only enter the number "validationexpression=" \d{1,} "controltovalidate= Txtport" display= "Dynamic" ></ Asp:regularexpressionvalidator></td>
</tr>
<tr>
<TD align= "right" width= ">" Mail Sender:</td>
<TD width= "><asp:textbox" id= "Txtfrom" runat= "Server" cssclass= "textbox" Maxlength= "></asp": Textbox><asp:requiredfieldvalidator id= "Rfvfrom" runat= "Server" errormessage= "*" controltovalidate= "TxtFrom" Display= "Dynamic" ></asp:requiredfieldvalidator>
<asp:regularexpressionvalidator id= "Revfrom" runat= "Server" errormessage= "message Format error" validationexpression= "\w+ ([-+ .] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) * "controltovalidate=" Txtfrom "display=" Dynamic "></asp:regularexpressionvalidator></td>
</tr>
<tr>
<TD align= "Right" width= "I" > Sender display Name:</td>
<TD width= "><asp:textbox" id= "Txtfromname" runat= "Server" cssclass= "textbox" Maxlength= "></asp" :textbox></td>
</tr>
<tr>
<TD align= "right" width= "> Mail Receiver":</td>
<TD width= "><asp:textbox" id= "Txtto" runat= "Server" cssclass= "textbox" Maxlength= "></asp": Textbox><asp:requiredfieldvalidator id= "rfvto" runat= "Server" errormessage= "*" controltovalidate= "TxtTo" Display= "Dynamic" ></asp:requiredfieldvalidator>
<asp:regularexpressionvalidator id= "revto" runat= "Server" errormessage= "message Format error" validationexpression= "\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) * "controltovalidate=" Txtto "display=" Dynamic "></asp:regularexpressionvalidator></td>
</tr>
<tr>
<TD align= "right" width= "> receiver" display name:</td>
<TD width= "><asp:textbox" id= "Txttoname" runat= "Server" cssclass= "textbox" Maxlength= "></asp": Textbox></td>
</tr>
<tr>
<TD align= "right" width= ">" Message priority:</td>
<TD width= "><asp:dropdownlist" id= "ddlpriority" runat= "Server" >
<asp:listitem value= "High" > High </asp:ListItem>
<asp:listitem value= "Default" selected= "True" > Default </asp:ListItem>
<asp:listitem value= "Low" > Low </asp:ListItem>
</asp:dropdownlist></td>
</tr>
<tr>
<TD align= "Right" width= "I" > Send HTML mail:</td>
<TD width= "><asp:dropdownlist" id= "ddlhtml" runat= "Server" >
<asp:listitem value= "yes" selected= "True" > is </asp:ListItem>
<asp:listitem value= "No" > No </asp:ListItem>
</asp:dropdownlist></td>
</tr>
<tr>
<TD align= "Right" width= "I" > Mail theme:</td>
<TD width= "><asp:textbox" id= "Txtsubject" runat= "Server" cssclass= "textbox" Maxlength= "></asp": Textbox>
<asp:requiredfieldvalidator id= "Rfvsubject" runat= "Server" errormessage= "*" controltovalidate= "TxtSubject" Display= "Dynamic" ></asp:RequiredFieldValidator></td>
</tr>
<tr>
<TD align= "right" width= ">" Message content:</td>
<TD width= ">"
<asp:textbox id= "Txtmessage" runat= "rows=" textmode= "MultiLine" cssclass= "textbox" columns= ">" </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= "Send Mail" cssclass= "TextBox" backcolor= "Silver" forecolor= "Blue" ></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>