程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> 關於C# >> 用Socket發郵件的代碼(可以群發)

用Socket發郵件的代碼(可以群發)

編輯:關於C#
 

qunFa.aspx文件的代碼:


<%@ Page language="c#" Codebehind="qunFa.aspx.cs" AutoEventWireup="false" Inherits="liuwei.hanmail.qunFa" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>qunFa</title>
<meta content="Microsoft Visual Studio .NET 7.1" name=GENERATOR>
<meta content=C# name=CODE_LANGUAGE>
<meta content=JavaScript name=vs_defaultClientScript>
<meta content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id=Form1 method=post runat="server">
<asp:ListBox id="ListBoxMsg" style="Z-INDEX: 118; LEFT: 136px; POSITION: absolute; TOP: 344px"
runat="server" Width="440px" Height="184px"></asp:ListBox>
<asp:Label id="Label11" style="Z-INDEX: 108; LEFT: 120px; POSITION: absolute; TOP: 320px" runat="server">信息查看</asp:Label>
<asp:Label id="Label10" style="Z-INDEX: 117; LEFT: 112px; POSITION: absolute; TOP: 16px" runat="server">SMTP服務器地址</asp:Label>
<asp:Label id="Label9" style="Z-INDEX: 100; LEFT: 128px; POSITION: absolute; TOP: 48px" runat="server">用戶名</asp:Label>
<asp:TextBox id="TextBoxSrv" style="Z-INDEX: 101; LEFT: 264px; POSITION: absolute; TOP: 24px"
runat="server" Width="240px"></asp:TextBox>
<asp:Label id="Label8" style="Z-INDEX: 102; LEFT: 360px; POSITION: absolute; TOP: 48px" runat="server">口令</asp:Label>
<asp:TextBox id="TextBoxUser" style="Z-INDEX: 103; LEFT: 192px; POSITION: absolute; TOP: 48px"
runat="server" Width="152px"></asp:TextBox>
<asp:TextBox id="TextBoxPwd" style="Z-INDEX: 104; LEFT: 416px; POSITION: absolute; TOP: 48px"
runat="server" Width="168px" TextMode="Password"></asp:TextBox>
<asp:Label id="Label4" style="Z-INDEX: 105; LEFT: 128px; POSITION: absolute; TOP: 80px" runat="server">發信人</asp:Label>
<asp:Label id="Label5" style="Z-INDEX: 106; LEFT: 360px; POSITION: absolute; TOP: 80px" runat="server">收信人</asp:Label>
<asp:TextBox id="TextBoxSend" style="Z-INDEX: 107; LEFT: 192px; POSITION: absolute; TOP: 80px"
runat="server"></asp:TextBox>
<asp:TextBox id="TextBoxRev" style="Z-INDEX: 109; LEFT: 416px; POSITION: absolute; TOP: 80px"
runat="server" Width="168px"></asp:TextBox>
<asp:Label id="Label6" style="Z-INDEX: 110; LEFT: 128px; POSITION: absolute; TOP: 112px" runat="server">主題</asp:Label>
<asp:TextBox id="TextBoxSubject" style="Z-INDEX: 112; LEFT: 192px; POSITION: absolute; TOP: 104px"
runat="server" Width="392px"></asp:TextBox>
<asp:TextBox id="TextBoxMailText" style="Z-INDEX: 113; LEFT: 144px; POSITION: absolute; TOP: 160px"
runat="server" Width="440px" TextMode="MultiLine" Height="120px"></asp:TextBox>
<asp:Label id="Label7" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 136px" runat="server">郵件內容</asp:Label>
<asp:Button id="ButtonSend" style="Z-INDEX: 115; LEFT: 464px; POSITION: absolute; TOP: 296px"
runat="server" Text="發送"></asp:Button>
<asp:Label id="LabelErr" style="Z-INDEX: 116; LEFT: 696px; POSITION: absolute; TOP: 136px"
runat="server"></asp:Label></FORM>
</body>
</HTML>


 

qunFa.aspx.cs的代碼:

 


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;
using System.Net.Sockets;

namespace Sendmail
{
/// <summary>
/// qunFa 的摘要說明。
/// </summary>
public class qunFa : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label LabelErr;
protected System.Web.UI.WebControls.Button ButtonSend;

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved