<%@ Page Language="VB" Debug="True" Explicit="True"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="System.IO" %>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>邮件列表</title>
<style>
<!--
a:link{color:#0066FF;text-decoration:none;font-size:"9 pt"}
a:visited{color:#000066;text-decoration:none;font-size:"9 pt"}
a:actived{color:#FF0000;font-size:"9 pt"}
a:hover{color:#FF0000;font-size:"9 pt"}
table{font-size:"11 pt"}
-->
</style>
</head>
<body>
<SCRIPT language=VB RUNAT="server">
Sub SendMail(Obj As Object, E As EventArgs)
lbmsg.Text=""
Dim mailObj AS new MailMessage
Dim smtp AS new SmtpMail
'定义SMTP服务器的名称
Smtp.smtpserver="127.0.0.1"
'定义邮件的发送地址
mailObj.From=sendmailbox.value
'定义邮件的接收地址
Dim conn AS OleDbConnection
conn=connectdb("data\mail.mdb")
conn.open()
Dim reader As oledbdatareader
reader=readdb(conn,"select * from mail")
while (reader.read())
try
mailObj.To=reader("mail")
mailObj.Subject =subject.value
mailObj.Body =content.value
'默认发送邮件格式为纯文本TEXT,如果选择HTML格式,设置为HTML格式
if mode.value="HTML" then
mailObj.BodyFormat=MailFormat.Html
end if
'设置邮件发送级别为高
mailObj.Priority = MailPriority.High
Smtp.Send(mailObj)
lbmsg.text=lbmsg.text+reader("mail")+"OK!Time:"+Now().ToString()+"<br>"
catch er as Exception
lbmsg.text=lbmsg.text+er.message+"<br>"
finally
End Try
End While
reader.close()
Dim strwriterobj As StreamWriter
try
strwriterobj= File.CreateText(Server.MapPath("log\")+subject.value+".htm")
strwriterobj.Write("<HTML><head><meta http-equiv='Content-Language' content='zh-cn'><meta http-equiv='Content-Type' content='text/html; charset=gb2312'></head><BODY>"+lbmsg.text+"</BODY></HTML>")
catch er as Exception
lbmsg.text=lbmsg.text+er.message+"<br>"
finally
strwriterobj.close
lbmsg.text=lbmsg.text+"日志保存成功!保存目录:<br>"+Server.MapPath("log\")+subject.value+".htm"
End Try
End Sub
'链接数据库
'www.knowsky.com
Function ConnectDB(txtdatabase AS String) As Oledbconnection
Dim conn AS OledbConnection
Dim connstr As String
connstr="Provider=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source=" +Server.MapPath(txtdatabase)
connectdb=New OledbConnection(connstr)
End Function
'读取一条记录
Function readdb(conn As Oledbconnection,txtsql As String) As OledbDataReader
Dim cmd As OledbCommand
cmd=new oledbcommand(txtsql,conn)
readdb=cmd.executereader()
End Function
</SCRIPT>
<p align="center"><font size="5" face="楷体_GB2312">邮件列表</font></p>
<hr width="60%" size="1">
<div align="center">
<center>
<table border="0" width="770">
<tr>
<td width="100%">
<form method="POST" runat="Server">
<table border="0" width="100%" height="125">
<tr>
<td width="15%" align="right" height="24"> 发送邮箱: </td>
<td width="85%" height="24"><input type="text" name="sendmailbox" id="sendmailbox" size="50" runat="Server"/></td>
</tr>
<tr>
<td width="15%" align="right" height="24"> 标题: </td>
<td width="85%" height="24"><input type="text" name="subject" id="subject" size="50" runat="Server"/></td>
</tr>
<tr>
<td width="15%" align="right" height="60">内容:</td>
<td width="85%" height="60"><textarea rows="6" name="content" cols="80" id="content" runat="Server"/></textarea></td>
</tr>
<tr>
<td width="15%" align="right" height="23">方式:</td>
<td width="85%" height="23"><select size="1" name="mode" id="mode" runat="Server">
<option value="Text" selected>Text</option>
<option value="HTML">HTML</option>
</select></td>
</tr>
</table>
<p align="center"><input type="button" value=" 提 交 " name="ok" onserverclick="sendmail" runat="Server"/></p>
</form>
<ASP:Label id="lbmsg" runat="Server"/>
<p>
</td>
</tr>
<tr>
<td width="100%"></td>
</tr>
</table>
</center>
</div>
</body>
</html>
自由广告区 |
分类导航 |
邮件新闻资讯: IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮 电子邮箱 | 反垃圾邮件|邮件客户端|网络安全 行业数据 | 邮件人物 | 网站公告 | 行业法规 网络技术: 邮件原理 | 网络协议 | 网络管理 | 传输介质 线路接入 | 路由接口 | 邮件存储 | 华为3Com CISCO技术 | 网络与服务器硬件 操作系统: Windows 9X | Linux&Uinx | Windows NT Windows Vista | FreeBSD | 其它操作系统 邮件服务器: 程序与开发 | Exchange | Qmail | Postfix Sendmail | MDaemon | Domino | Foxmail KerioMail | JavaMail | Winwebmail |James Merak&VisNetic | CMailServer | WinMail 金笛邮件系统 | 其它 | 反垃圾邮件: 综述| 客户端反垃圾邮件|服务器端反垃圾邮件 邮件客户端软件: Outlook | Foxmail | DreamMail| KooMail The bat | 雷鸟 | Eudora |Becky! |Pegasus IncrediMail |其它 电子邮箱: 个人邮箱 | 企业邮箱 |Gmail 移动电子邮件:服务器 | 客户端 | 技术前沿 邮件网络安全: 软件漏洞 | 安全知识 | 病毒公告 |防火墙 攻防技术 | 病毒查杀| ISA | 数字签名 邮件营销: Email营销 | 网络营销 | 营销技巧 |营销案例 邮件人才:招聘 | 职场 | 培训 | 指南 | 职场 解决方案: 邮件系统|反垃圾邮件 |安全 |移动电邮 |招标 产品评测: 邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端 |