台灣最大程式設計社群網站
線上人數
573
 
會員總數:245785
討論主題:189420
歡迎您免費加入會員
討論區列表 >> 專欄文章 >> 用Filesystemobject將檔案讀進到發信物件的body中
[]  
[我要回覆]
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
用Filesystemobject將檔案讀進到發信物件的body中
價值 : 0 QP  點閱數:581 回應數:0
樓主

站務人員 站長
門外漢
0 1580
542 9
發送站內信

捐贈 VP 給 站務人員
用++++++++++++圍起來的就是讀取文字檔的程式碼


<!--#include file="connect.txt" -->

<%
Dim object,sender,fromemail,receive
Dim explain,strdate,receiver,name

'****************變數名稱***************
'object 電子報標題
'sender 寄件者
'fromemail 寄件者電子郵件
'receive 收件者讀取方式
'***************************************

object = Request.Form("object")
sender = Request.Form("sender")
fromemail = Request.Form("fromemail")
receive = Request.Form("receive")
toemail = Request.Form("toemail")

If (toemail = "") and (receive = 1) Then
Response.Redirect"../errormessage/inputerror.asp?err=4"
Else
End If

If receive = "" Then
object = Request.QueryString("object")
sender = Request.QueryString("sender")
fromemail = Request.QueryString("fromemail")
receive = Request.QueryString("receive")
Else
End If



' 寄發處理電子報
' ========================
' 載入電子報內容 epaper.txt
' ========================

'++++++++++++++++++++++++++++++++++++++++++++++++++++
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fp = fso.OpenTextFile(Server.MapPath("epaper.txt"))
Do While fp.AtEndOfStream = Ture
'explain = fp.ReadLine
explain = explain & "" &fp.ReadLine
Loop
fp.close
Set fp = Nothing
Set fso = Nothing
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
explain = explain & "<HR>"
explain = explain & chr(10) & ""
explain = explain & "昌博科技有限公司" & ""
explain = explain & "<A HREF=http://www.microwire.com.tw/>http://www.microwire.com.tw/ </A>" & ""
explain = explain & "如有任何問題歡迎您來信" & ""
explain = explain & "<A HREF=mailto:mw@microwire.com.tw>mw@microwire.com.tw </A>" & ""


If receive = 1 Then ' 單一電子郵件
'// 建立 cdonts.newmail 物件
set mail=server.createobject("CDONTS.NewMail")

'// 設定支援 HTML 語法
mail.BodyFormat = 0
mail.MailFormat = 0


'// 收件者
mail.To= Request.Form("toemail")

'// 寄件者
mail.From= Request.Form("fromemail")

'// 主旨
mail.subject= Request.Form("object")

'// 取得寄件者之姓名
name = Request.Form("sender")
mail.body = explain

mail.send

Else ' 讀取資料庫電子郵件

'// 收件者

strSQL = " Select Name,Email From Toemail Order By RecSerialNo"
Set objRS = conn.Execute(strSQL)
If Not objRS.Eof Then
Do While Not objRS.Eof
name = objRS("Name") & ";"
receiver = receiver + name

'// 建立 cdonts.newmail 物件
set mail=server.createobject("CDONTS.NewMail")

'// 設定支援 HTML 語法
mail.BodyFormat = 0
mail.MailFormat = 0

toemail = objRS("Email")
Response.Write toemail
Response.Write "<BR>"

mail.To= toemail

'// 寄件者
mail.From= Request.Form("fromemail")

'// 主旨
mail.subject= Request.Form("object")

'// 取得寄件者之姓名
name = Request.Form("sender")
mail.body = explain

mail.send

objRS.MoveNext
Loop
Else
End If


End If

%>

<html>
<head>
<title>自動電子報系統</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<style type="text/css">
<!--
a:link { color: #000000; text-decoration: none}
a:hover { color: #0000FF; text-decoration: underline; background-color: #FFFF00}
a:active { color: #000000; text-decoration: none}
a:visited { color: #000000; text-decoration: none}
-->
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="750" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center" valign="top" colspan="2"><img src="../img/title.gif" width="433" height="77"></td>
</tr>
<tr>
<td align="center" valign="top" colspan="2"> </td>
</tr>
<tr align="center">
<td valign="middle" height="2" colspan="2">
<div id="KBStatic" style="position:absolute; left:10px; top:120px; width:120px; height:50px; z-index:25">
<table width="120" border="0" cellpadding="0" cellspacing="0" align="left">
<tr>
<td width="150" align="center" valign="middle"><font size="2" color="#FF0000"><a href="insert.asp">新增收件者資料</a></font></td>
</tr>
<tr>
<td width="150" align="center" valign="middle"><font size="2" color="#FF0000"><a href="update.asp">修改收件者資料</a></font></td>
</tr>
<tr>
<td width="150" align="center" valign="middle"><font size="2" color="#FF0000"><a href="search.asp">檢視收件者資料</a></font></td>
</tr>
<tr>
<td width="150" align="center" valign="middle"><font size="2" color="#FF0000"><a href="../index.htm">進入電子報系統</a></font></td>
</tr>
</table>
</div>
<script language=JavaScript>
function KB_keepItInIE(theName,theWantTop,theWantLeft) {
theRealTop=parseInt(document.body.scrollTop)
theTrueTop=theWantTop+theRealTop
document.all[theName].style.top=theTrueTop
theRealLeft=parseInt(document.body.scrollLeft)
theTrueLeft=theWantLeft+theRealLeft
document.all[theName].style.left=theTrueLeft
}
function KB_keepItInNN(theName,theWantX,theWantY) {
theRealLay=document.layers[theName]
theBadX=self.pageYOffset
theBadY=self.pageXOffset
theRealX=theBadX+theWantX
theRealY=theBadY+theWantY
theRealLay.moveTo(theRealY,theRealX)
}
IE4=(document.all)?1:0
NN4=(document.layers)?1:0
if (IE4)
setInterval('KB_keepItInIE("KBStatic",120,10)',1)
if (NN4)
setInterval('KB_keepItInNN("KBStatic",120,10)',1)
</script>

<font size="2" color="#FF0000">電子報已發送出去<font color="#000000"></font></font></td>
</tr>
<tr>
<td align="right" valign="middle"> </td>
<td align="left" valign="middle">
<hr width="500" align="left">
</td>
</tr>
<tr>
<%
If receive <> 1 Then
%>
<td align="right" valign="middle"><font size="2">收件者</font></td>
<td align="left" valign="middle"><font size="2" color="#0000FF"><%=receiver%></font></td>
<%
Else
%>
<td align="right" valign="middle"><font size="2"></font></td>
<td align="left" valign="middle"><font size="2" color="#0000FF"></font></td>
<%
End If
%>
</tr>
<tr>
<td align="left" valign="middle"> </td>
<td align="left" valign="middle">
<hr width="500" align="left">
</td>
</tr>
<tr>
<td align="left" valign="middle" height="300" width="200"> <font size="2" color="#FF0000"><font color="#000000">

</font> </font></td>
<td align="left" valign="middle" height="300" width="663"><font size="2" color="#FF0000"><font color="#000000">
<%
Response.Write explain
%>
</font></font></td>
</tr>
<tr>
<td align="center" valign="top" colspan="2">
<table width="551" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="551" align="center" valign="middle"> </td>
</tr>
<tr>
<td width="551" align="center" valign="middle"><a href="http://www.microwire.com.tw" target="_blank"><img src="../img/logo.gif" width="87" height="31" border="0" alt="昌博科技"></a></td>
</tr>
<tr>
<td width="551" align="center" valign="middle"><font size="2" color="#0000B0">昌博科技 版權所有©
2002 MicroWire Technology Inc. All Rights Reserved.</font></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!-- #include file="DBclose.inc" -->

本篇文章發表於2002-07-02 00:00
目前尚無任何回覆
   

回覆
如要回應,請先登入.