1
<%@ Import Namespace = "System.Web.Mail"%>
2
<%@ Import Namespace = "System"%>
3
<%@ Import Namespace = "System.Text"%>
4
<%@ Import Namespace = "System.IO"%>
5
<%@ Import Namespace = "System.Net"%>
6
<%@ Import Namespace = "System.Net.Sockets"%>
7
<%@ Import Namespace = "System.Collections"%>
8
<%@ Page validateRequest="false"%>
9
<script language="C#" runat="Server">
10![]()
11
void Page_Load(object sender,EventArgs e)
12
{
13
info.Text = "你好,欢迎使用本邮件发送系统!";
14
}
15
void SendMail(object sender,EventArgs e)
16
{
17
MailMessage mm = new MailMessage();
18
//密送地址
19
mm.Bcc = black_send.Text;
20
//邮件内容
21
mm.Body = TextArea1.Value;
22
//mm.BodyEncoding = System.Text.UTF8Encoding;
23
//正文格式
24
mm.BodyFormat = MailFormat.Html;// MailFormat.Text
25
//抄送地址
26
mm.Cc = copy_send.Text;
27
//发送地址
28
mm.From = address_send.Text;
29
//优先级
30
mm.Priority = /*group.SelectedItem.Value;//*/MailPriority.High; //Low Normal
31
//邮件主题
32
mm.Subject = subject.Text;
33
//目的地址
34
mm.To = address.Text;
35
//附件
36
//mm.Attachments.Add(new MailAttachment("c:\\SCANDISK.LOG"));
37![]()
38
try
39
{
40
SmtpMail.Send(mm);
41
info.Text = "邮件发送成功!";
42
}
43
catch(Exception ex)
44
{
45
info.Text = ex.ToString();
46
}
47
}
48![]()
49
</script>
50
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
51
<HTML>
52
<HEAD>
53
<title>mail</title>
54
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
55
<meta content="C#" name="CODE_LANGUAGE">
56
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
57
<meta content="JavaScript" name="vs_defaultClientScript">
58
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
59
<LINK href="style.css" type="text/css" rel="stylesheet">
60
</HEAD>
61
<body MS_POSITIONING="FlowLayout">
62
<p>
63
</p>
64
<p>
65
</p>
66
<form runat="server">
67
68
<table cellSpacing="1" cellPadding="3" width="100%" align="center" bgColor="#000000" border="0">
69
<tr>
70
<td bgColor="#e7e7e7">收件人姓名:</td>
71
<td width="26%" bgColor="#e7e7e7"> <asp:textbox id="getname" runat="server" Wrap="false" TextMode="SingleLine" ReadOnly="false" AutoPostBack="false" BorderStyle="groove"></asp:textbox></td>
72
<td colspan="2" rowspan="8" bgColor="#e7e7e7"><textarea id="TextArea1" cols=55 rows=15 runat=server width="100%" height="100%"/>
73
</td>
74
</tr>
75
<tr>
76
<td bgColor="#d6d6d6">收件人地址:</td>
77
<td bgColor="#d6d6d6"><asp:textbox id="address" runat="server" Wrap="false" TextMode="SingleLine" ReadOnly="false" AutoPostBack="false" BorderStyle="groove"></asp:textbox></td>
78
</tr>
79
<tr>
80
<td bgColor="#e7e7e7">回复地址:</td>
81
<td bgColor="#e7e7e7"><asp:textbox BorderStyle="groove" ID="address_back" runat="server" TextMode="SingleLine" /></td>
82
</tr>
83
<tr>
84
<td bgColor="#d6d6d6">发件人姓名:</td>
85
<td bgColor="#d6d6d6"><asp:textbox BorderStyle="groove" ID="name_send" runat="server" /></td>
86
</tr>
87
<tr>
88
<td bgColor="#e7e7e7">发件人地址:</td>
89
<td bgColor="#e7e7e7"><asp:textbox BorderStyle="groove" ID="address_send" runat="server" TextMode="SingleLine" Text="emaildemo@963.net"/></td>
90
</tr>
91
<tr>
92
<td bgColor="#d6d6d6">抄送:</td>
93
<td bgColor="#d6d6d6"><asp:textbox BorderStyle="groove" ID="copy_send" runat="server" TextMode="SingleLine" /></td>
94
</tr>
95
<tr>
96
<td bgColor="#e7e7e7">暗送:</td>
97
<td bgColor="#e7e7e7"><asp:textbox BorderStyle="groove" ID="black_send" runat="server" TextMode="SingleLine" /></td>
98
</tr>
99
<tr>
100
<td bgColor="#d6d6d6">邮件主题:</td>
101
<td bgColor="#d6d6d6"><asp:textbox BorderStyle="groove" ID="subject" runat="server" TextMode="SingleLine" /></td>
102
</tr>
103
<tr>
104
<td width="20%" bgColor="#e7e7e7">优先级:</td>
105
<td bgColor="#e7e7e7"> <asp:dropdownlist ID="group" runat="server">
106
<asp:listitem>快速</asp:listitem>
107
<asp:listitem selected>普通</asp:listitem>
108
<asp:listitem>慢速</asp:listitem>
109
</asp:dropdownlist></td>
110
<td width="28%" bgColor="#e7e7e7">邮件格式:</td>
111
<td width="26%" bgColor="#e7e7e7"> <asp:dropdownlist ID="format" runat="server">
112
<asp:listitem>文本格式</asp:listitem>
113
<asp:listitem selected>HTML格式</asp:listitem>
114
</asp:dropdownlist></td>
115
</tr><tr>
116
<td colspan="4" bgColor="#d6d6d6"><asp:label ID="info" runat="server" Text="你好,欢迎使用本邮件发送系统!"></asp:label></td>
117
</tr>
118
<tr>
119
<td colspan="4" bgColor="#d6d6d6"><asp:button BorderStyle="groove" ID="submit" runat="server" Text="提交" ToolTip="如果都填好了,就按这个按钮发送!" OnClick="SendMail"/></td>
120
<!--td colspan="4" bgColor="#d6d6d6" width="50%"><asp:button id="cancel" runat=server text="sss"/></td-->
121
</tr>
122
</table>
123
<p> </p></form>
124
</body>
125
</HTML>
126![]()
<%@ Import Namespace = "System.Web.Mail"%> 2
<%@ Import Namespace = "System"%> 3
<%@ Import Namespace = "System.Text"%> 4
<%@ Import Namespace = "System.IO"%> 5
<%@ Import Namespace = "System.Net"%> 6
<%@ Import Namespace = "System.Net.Sockets"%> 7
<%@ Import Namespace = "System.Collections"%> 8
<%@ Page validateRequest="false"%> 9
<script language="C#" runat="Server"> 10

11
void Page_Load(object sender,EventArgs e) 12
{ 13
info.Text = "你好,欢迎使用本邮件发送系统!"; 14
} 15
void SendMail(object sender,EventArgs e) 16
{ 17
MailMessage mm = new MailMessage(); 18
//密送地址 19
mm.Bcc = black_send.Text; 20
//邮件内容 21
mm.Body = TextArea1.Value; 22
//mm.BodyEncoding = System.Text.UTF8Encoding; 23
//正文格式 24
mm.BodyFormat = MailFormat.Html;// MailFormat.Text 25
//抄送地址 26
mm.Cc = copy_send.Text; 27
//发送地址 28
mm.From = address_send.Text; 29
//优先级 30
mm.Priority = /*group.SelectedItem.Value;//*/MailPriority.High; //Low Normal 31
//邮件主题 32
mm.Subject = subject.Text; 33
//目的地址 34
mm.To = address.Text; 35
//附件 36
//mm.Attachments.Add(new MailAttachment("c:\\SCANDISK.LOG")); 37

38
try 39
{ 40
SmtpMail.Send(mm); 41
info.Text = "邮件发送成功!"; 42
} 43
catch(Exception ex) 44
{ 45
info.Text = ex.ToString(); 46
} 47
} 48

49
</script> 50
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 51
<HTML> 52
<HEAD> 53
<title>mail</title> 54
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR"> 55
<meta content="C#" name="CODE_LANGUAGE"> 56
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 57
<meta content="JavaScript" name="vs_defaultClientScript"> 58
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> 59
<LINK href="style.css" type="text/css" rel="stylesheet"> 60
</HEAD> 61
<body MS_POSITIONING="FlowLayout"> 62
<p> 63
</p> 64
<p> 65
</p> 66
<form runat="server"> 67
68
<table cellSpacing="1" cellPadding="3" width="100%" align="center" bgColor="#000000" border="0"> 69
<tr> 70
<td bgColor="#e7e7e7">收件人姓名:</td> 71
<td width="26%" bgColor="#e7e7e7"> <asp:textbox id="getname" runat="server" Wrap="false" TextMode="SingleLine" ReadOnly="false" AutoPostBack="false" BorderStyle="groove"></asp:textbox></td> 72
<td colspan="2" rowspan="8" bgColor="#e7e7e7"><textarea id="TextArea1" cols=55 rows=15 runat=server width="100%" height="100%"/> 73
</td> 74
</tr> 75
<tr> 76
<td bgColor="#d6d6d6">收件人地址:</td> 77
<td bgColor="#d6d6d6"><asp:textbox id="address" runat="server" Wrap="false" TextMode="SingleLine" ReadOnly="false" AutoPostBack="false" BorderStyle="groove"></asp:textbox></td> 78
</tr> 79
<tr> 80
<td bgColor="#e7e7e7">回复地址:</td> 81
<td bgColor="#e7e7e7"><asp:textbox BorderStyle="groove" ID="address_back" runat="server" TextMode="SingleLine" /></td> 82
</tr> 83
<tr> 84
<td bgColor="#d6d6d6">发件人姓名:</td> 85
<td bgColor="#d6d6d6"><asp:textbox BorderStyle="groove" ID="name_send" runat="server" /></td> 86
</tr> 87
<tr> 88
<td bgColor="#e7e7e7">发件人地址:</td> 89
<td bgColor="#e7e7e7"><asp:textbox BorderStyle="groove" ID="address_send" runat="server" TextMode="SingleLine" Text="emaildemo@963.net"/></td> 90
</tr> 91
<tr> 92
<td bgColor="#d6d6d6">抄送:</td> 93
<td bgColor="#d6d6d6"><asp:textbox BorderStyle="groove" ID="copy_send" runat="server" TextMode="SingleLine" /></td> 94
</tr> 95
<tr> 96
<td bgColor="#e7e7e7">暗送:</td> 97
<td bgColor="#e7e7e7"><asp:textbox BorderStyle="groove" ID="black_send" runat="server" TextMode="SingleLine" /></td> 98
</tr> 99
<tr> 100
<td bgColor="#d6d6d6">邮件主题:</td> 101
<td bgColor="#d6d6d6"><asp:textbox BorderStyle="groove" ID="subject" runat="server" TextMode="SingleLine" /></td> 102
</tr> 103
<tr> 104
<td width="20%" bgColor="#e7e7e7">优先级:</td> 105
<td bgColor="#e7e7e7"> <asp:dropdownlist ID="group" runat="server"> 106
<asp:listitem>快速</asp:listitem> 107
<asp:listitem selected>普通</asp:listitem> 108
<asp:listitem>慢速</asp:listitem> 109
</asp:dropdownlist></td> 110
<td width="28%" bgColor="#e7e7e7">邮件格式:</td> 111
<td width="26%" bgColor="#e7e7e7"> <asp:dropdownlist ID="format" runat="server"> 112
<asp:listitem>文本格式</asp:listitem> 113
<asp:listitem selected>HTML格式</asp:listitem> 114
</asp:dropdownlist></td> 115
</tr><tr> 116
<td colspan="4" bgColor="#d6d6d6"><asp:label ID="info" runat="server" Text="你好,欢迎使用本邮件发送系统!"></asp:label></td> 117
</tr> 118
<tr> 119
<td colspan="4" bgColor="#d6d6d6"><asp:button BorderStyle="groove" ID="submit" runat="server" Text="提交" ToolTip="如果都填好了,就按这个按钮发送!" OnClick="SendMail"/></td> 120
<!--td colspan="4" bgColor="#d6d6d6" width="50%"><asp:button id="cancel" runat=server text="sss"/></td--> 121
</tr> 122
</table> 123
<p> </p></form> 124
</body> 125
</HTML> 126




浙公网安备 33010602011771号