用ASP.Net发送MailList(二)__教程 |
|
日期:2007-5-15 21:09:15 人气:50 [大 中 小] |
|
|
|
{
showmsg.Text="对不起,连接服务器失败";
}
}
String SenSmtpCmd(TCPClient tcpc,String strCmd){
file://为了程序的简单可读,特意写了这个函数
Byte[] arrCmd;
String strRet;
StreamReader sr;
Stream s;
s=tcpc.GetStream();
strCmd = strCmd + "\r\n";
arrCmd= Encoding.Default.GetBytes(strCmd.ToCharArray());
s=tcpc.GetStream();
s.Write(arrCmd, 0, strCmd.Length);
sr = new StreamReader(tcpc.GetStream(), Encoding.Default);
strRet=sr.ReadLine();
return strRet;
}
String SenSmtpCmd1(TCPClient tcpc,String strCmd){
file://为了程序的简单可读,特意写了这个函数
Byte[] arrCmd;
String strRet;
StreamReader sr;
Stream s;
s=tcpc.GetStream();
strCmd = strCmd;
arrCmd= Encoding.Default.GetBytes(strCmd.ToCharArray());
s=tcpc.GetStream();
s.Write(arrCmd, 0, strCmd.Length);
return "";
}
<FORM id=testForm runat="server">
<?xml:namespace prefix = asp /><asp:label id=showmsg runat="server"></asp:label>
SMTP服务器:<asp:TextBox id=txtSmtpserver runat="server"></asp:TextBox><asp:TextBox id=txtPort runat="server" Text="25"></asp:TextBox>
发信人:<asp:TextBox id=sender runat="server"></asp:TextBox>
收信人1:<asp:TextBox id=receive1 runat="server"></asp:TextBox>
收信人2:<asp:TextBox id=receive2 runat="server"></asp:TextBox>
信件主题:<asp:TextBox id=subject runat="server"></asp:TextBox>
信件内容:<asp:TextBox id=content runat="server" TextMode="MultiLine" rows="10/">
<asp:Button id=SendMail onclick=SendMailClick runat="server" Text="发送"></asp:Button>
</FORM>
</asp:TextBox> |
|
出处:本站原创 作者:佚名 |
|
|