|
版主您好,目前正在練習jmail的製作,我將書上的範例放到智邦生活館上執行,但是卻無法執行線上回覆或是線上發信的功能,我有智邦生活館的jmail元件程式碼,但是卻不知道該怎麼將jmail寫入書上的發信範例,我將兩個檔案的程式碼成列如下,還請多幫忙,謝謝!!
PS:書名是 - 挑戰Dreamweaver互動網站百寶箱for ASP
發信範例程式碼:
<%@LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/connMember.asp" --> <% Dim RecMember__MMColParam RecMember__MMColParam = "1" If (Request.Form("m_email") <> "") Then RecMember__MMColParam = Request.Form("m_email") End If %> <% Dim RecMember Dim RecMember_numRows
Set RecMember = Server.CreateObject("ADODB.Recordset") RecMember.ActiveConnection = MM_connMember_STRING RecMember.Source = "SELECT m_email, m_id, m_nick, m_passwd FROM memberData WHERE m_email = '" + Replace(RecMember__MMColParam, "'", "''") + "'" RecMember.CursorType = 0 RecMember.CursorLocation = 2 RecMember.LockType = 1 RecMember.Open()
RecMember_numRows = 0 %> <html> <head> <title>會員系統</title> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <!-- Fireworks MX Dreamweaver MX target. Created Sat May 03 12:18:20 GMT+0800 (¥x¥_?D·CRE?!) 2003--> <script language="JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} }
function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; }
function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <style type="text/css"> <!-- .whiteBox { border: 1px solid #FFFFFF; } --> </style> <style type="text/css"> <!-- li { font-size: 10pt; line-height: 12pt; color: #FFFFFF; } .style1 {color: #FFFBF0} .style2 { color: #FF0000; font-weight: bold; } --> </style> </head> <body link="#FFFF66" vlink="#FFFF66" onLoad="MM_preloadImages('images/member_r2_c6_f2.gif','images/member_r2_c10_f2.gif','images/member_r2_c14_f2.gif','images/member_r2_c18_f2.gif')"> <div align="center"> <table width="700" border="0" cellpadding="4" cellspacing="0"> <tr> <td bgcolor="#4C687E"><table width="100%" border="0" cellpadding="4" cellspacing="0" class="whiteBox"> <tr> <td> <table border="0" width="100%" id="table1"> <tr> <td colspan="5" align="center" valign="bottom"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="770" height="136"> <param name="movie" value="flash/member_show.swf"> <param name="quality" value="high"> <embed src="flash/member_show.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="770" height="136"></embed> </object> </td> <td width="0" rowspan="2"> <div align="right"> </div> </td> </tr> <tr> <td width="104"> <font size="2"><a href="index.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('member_r2_c61','','images/member_r2_c6_f2.gif',1)"><img src="images/member_r2_c6.gif" alt="" name="member_r2_c61" width="48" height="48" border="0" id="member_r2_c61"></a>會員首頁</font></td> <td width="102"> <font size="2"><a href="memberAdd.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('member_r2_c101','','images/member_r2_c10_f2.gif',1)"><img src="images/member_r2_c10.gif" alt="" name="member_r2_c101" width="49" height="48" border="0" id="member_r2_c101"></a>加入會員</font></td> <td width="101"> <font size="2"><a href="memberzone.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('member_r2_c141','','images/member_r2_c14_f2.gif',1)"><img src="images/member_r2_c14.gif" alt="" name="member_r2_c141" width="48" height="48" border="0" id="member_r2_c141"></a>會員專區</font></td> <td width="104"><font size="2"><a href="memberAdmin.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('member_r2_c181','','images/member_r2_c18_f2.gif',1)"><img src="images/member_r2_c18.gif" alt="" name="member_r2_c181" width="48" height="48" border="0" id="member_r2_c181"></a>會員管理</font></td> <td width="343"> <div align="center"><font size="2"><a href="../index.asp"><img src="images/home.gif" width="43" height="49" border="0"></a>回首頁</font></div></td> </tr> </table> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><hr size="1" color="#FFFFFF"></td> </tr> </table> <% If Not RecMember.EOF Or Not RecMember.BOF Then %> <table width="60%" border="0" align="center" cellpadding="0" cellspacing="4"> <tr valign="top"> <td align="center"> <p style="margin-top: 0; margin-bottom: 5px"><strong> <% myMailServer = "127.0.0.1" sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = Server.CreateObject("CDO.Configuration") cdoConfig.Fields.Item(sch & "sendusing") = 2 cdoConfig.Fields.Item(sch & "smtpserver") = myMailServer cdoConfig.fields.update Set cdoMessage = Server.CreateObject("CDO.Message") Set cdoMessage.Configuration = cdoConfig cdoMessage.From = "david@e-happy.com.tw" cdoMessage.To = Request("m_email") cdoMessage.Subject = "會員系統密碼認證信" cdoMessage.HTMLBody = RecMember("m_nick")&"您好:<br>您的密碼為:"&RecMember("m_passwd") cdoMessage.Send Set cdoMessage = Nothing Set cdoConfig = Nothing %> <span class="style1">《 補寄會員密碼 》</span></strong></p> <p style="margin-top: 0; margin-bottom: 5px"><span class="style1">親愛的</span><font color="#000080"><%=(RecMember.Fields.Item("m_nick").Value)%> </font> <span class="style1">您好 ~</span><font color="#000080"><br> </font><span class="style1">您的密碼已經寄發到登錄的信箱中,<br> 請查收並妥善保管密碼。</span></p> <p style="margin-top: 0; margin-bottom: 5px"><font size="2"><span class="style1">請回</span> </font><font color="#FFFFFF" size="2"> <a href="index.asp"> <font color="#0000FF">會員首頁</font></a></font><span class="style1"><font size="2"> 登入。</font></span></p></td> </tr> </table> <% End If ' end Not RecMember.EOF Or NOT RecMember.BOF %> <% If RecMember.EOF And RecMember.BOF Then %> <table width="60%" border="0" align="center" cellpadding="0" cellspacing="4"> <tr valign="top"> <td align="center"> <p class="style1" style="margin-top: 0; margin-bottom: 5px"><strong>《 補寄會員密碼 》</strong></p> <p class="style2" style="margin-top: 0; margin-bottom: 5px">對不起,資料庫中並沒有您的資料!</p> <p style="margin-top: 0; margin-bottom: 5px"><span class="style1"><font size="2">您可</font></span><font color="#FFFFFF" size="2"><a href="Sendpass01.asp"><font color="#0000FF">重新輸入</font></a></font><span class="style1"><font size="2"> 或 </font></span><font color="#FFFFFF" size="2"> <a href="memberAdd.asp"> <font color="#0000FF">申請會員</font></a></font><span class="style1"><font size="2">。</font></span></p></td> </tr> </table> <% End If ' end RecMember.EOF And RecMember.BOF %> <table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <td><div align="center"> <hr size="1" noshade class="whiteBox"> </div></td> </tr> </table></td> </tr> </table> </div> </body> </html> <% RecMember.Close() Set RecMember = Nothing %>
智邦生活館jmail元件:
<%@LANGUAGE="VBSCRIPT" %> <HTML> <BODY> <% Set jmail = Server.CreateObject("JMail.Message")
' 在此鍵入收件人信箱、姓名。此語法可重複使用以同時寄送給更多收件者 jmail.AddRecipient "dickson703@ms95.url.com.tw ", "dickson703"
' 在此鍵入寄件人信箱 jmail.From = "dickson703@ms95.url.com.tw "
' 在此鍵入主旨 jmail.Subject = "白冷圳公告" jmail.Body = ""
jmail.Charset = "big5" jmail.ContentTransferEncoding = "base64" jmail.Encoding = "base64" jmail.ISOEncodeHeaders = false
' 在此鍵入HTML內容 jmail.HTMLBody = "<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=big5""></head><body><font color=""red"">恭喜!JMail測試成功!</font><br>" jmail.appendHTML "<br><br>智邦生活館客服中心</body></html>"
' 在此鍵入純文字內容(收信者無法檢視HTML時的備案) jmail.Body = "" jmail.appendText " 很遺憾您無法閱讀HTML內容"
' 在此鍵入SMTP伺服器,此處以HiNet為例 jmail.Send( "msa.hinet.net" ) %> 寄件成功!</BODY> </HTML>
|