使用asp實(shí)現(xiàn)支持附件的郵件系統(tǒng):大家經(jīng)常探討使用asp,而不使用其他組建能否實(shí)現(xiàn)文件的上傳,從而開發(fā)出支持郵件附件的郵件系統(tǒng),答案是可以的。請(qǐng)看: 以下是發(fā)送郵件的頁(yè)面,郵件的帳號(hào)是員工號(hào),假設(shè)是5位的數(shù)字,sendmail.asp當(dāng)然是在合法登陸后才能夠看到的
郵件系統(tǒng) < script language="java script "> <% if session("myid")="" or len(session("myid"))<>5 then response.write "window.open('nolog.asp',target='_top');" end if %> function check(theform) { if (theform.geterempl.value=='') { alert('請(qǐng)輸入收件人!'); theform.geterempl.focus(); return false; } if (theform.emailtitle.value=='') { alert('請(qǐng)輸入主題!'); theform.emailtitle.focus(); return false; } if (theform.emailtitle.value.length>200) { alert('主題請(qǐng)少于200字節(jié)'); theform.emailtitle.focus(); return false; } if (theform.body.value.length>15*1024) { alert('正文請(qǐng)少于16k'); theform.body.focus(); return false; } if (theform.emailshowname.value.length>1024) { alert('簽名請(qǐng)少于1k'); theform.emailshowname.focus(); return false; } } script > <% meth=request.querystring("meth") if meth=1 then geterempl=trim(request.querystring("geterempl")) emailtitle=trim(request.querystring("emailtitle")) elseif meth=2 then mailid=trim(request.querystring("mailid")) set conn=server.createobject("adodb.connection") conn.open "dsn=;uid=;pwd=" dsnpath="dsn=;uid=;pwd=" set rs=server.createobject("adodb.recordset") selectnew="select * from t_mail where ((geterempl like '%"&session("myid")&"%' or deleempl like '%"&session("myid")&"%' or receempl like '%"&session("myid")&"%')and (not deleverempl like '%"&session("myid")&"%')) and mailid='"&mailid&"' " rs.open selectnew,dsnpath,3,3 if rs.bof or rs.eof then %> < script language="java script "> alert("您沒(méi)有查看這封郵件的權(quán)限!"); window.history.back(); script > <% response.end else body=rs("body") emailtitle=rs("emailtitle") rs.close set rs=nothing conn.close set conn=nothing end if end if %>
===========================================================================================================用cdont組件發(fā)郵件:最近看到充許多網(wǎng)友要用自動(dòng)發(fā)郵件的討論, 這個(gè)東東我以前也研究過(guò)現(xiàn)在把它發(fā)布到這兒,希望能給大家?guī)?lái)用處: <% fromwho=request("fromwho") frommail=request("frommail") towho=request("towho") tomail=request("tomail") subject=request("subject") content=request("content") title=request("title") %> <% '建立一個(gè)cdonts.newmail對(duì)象 set objmail=server.createobject("cdonts.newmail") '設(shè)置寄件人 objmail.from=fromwho objmail.from=frommail '設(shè)置收件人 objmail.to=towho objmail.to=tomail '設(shè)置郵件主題 objmail.subject=subject '設(shè)置郵件內(nèi)容 objmail.body=content&title&towho&fromwho '將郵件格式設(shè)成html,若沒(méi)有這兩行,則默認(rèn)的是txt格式 'objmail.bodyformat=0 'objmail.mailformat=0 objmail.send %> <% response.write"< script language=java script >alert('你已經(jīng)成功寄出了?。。?); script >" response.write"< script language=java script >window.location.href='vb script :history.back' script >" %> 這個(gè)程序已經(jīng)測(cè)試通過(guò)的 -------------------------------------------------------------------------------- 關(guān)于這篇文章的評(píng)論 [注意:這里僅僅是給大家提供了一個(gè)發(fā)表對(duì)文章本身看法的地方,如果有疑問(wèn),請(qǐng)到論壇提出] 我要提問(wèn)! hyijiao 2003-10-14 11:33:00 請(qǐng)問(wèn)如何把下面的jmail改成用ms.cdonts 發(fā)郵件?謝謝 -------------------------------------------------------------------------------- 您好! 請(qǐng)問(wèn)如何把下面的jmail改成用ms.cdonts 發(fā)郵件?謝謝! set jmail = server.createobject("jmail.smtpmail") jmail.serveraddress = "mail.powercord911.com:25" jmail.sender = "mis@powercord911.com" jmail.subject = "您的登錄密碼" jmail.addrecipient(rsuserinfo.fields.item("useremail").value) jmail.body = "尊敬的用戶您好,首先感謝您使用我們的服務(wù)!." & vbcrlf & vbcrlf jmail.body = jmail.body & "您的用戶名是:" &(rsuserinfo.fields.item("user_name").value) & vbcrlf jmail.body = jmail.body & "您的注冊(cè)郵箱是:" &(rsuserinfo.fields.item("useremail").value) & vbcrlf jmail.body = jmail.body & "您的登錄密碼是:" &(rsuserinfo.fields.item("fpassword").value) & vbcrlf jmail.body = jmail.body & "請(qǐng)妥善保管您的密碼,如再次遺忘密碼,請(qǐng)登錄至本站取回您的密碼,謝謝您使用本系統(tǒng)。" & vbcrlf jmail.body = jmail.body & "順祝商祺!" & vbcrlf jmail.body = jmail.body & "××××××有限公司" jmail.priority = 3 jmail.addheader "originating-ip", request.servervariables("remote_addr") jmail.execute 在以上代碼中兩句代碼: jmail.serveraddress = "mail.powercord911.com:25" jmail.sender = "mis@powercord911.com" mail.powercord911.com:25是你的發(fā)送郵件服務(wù)器,25是端口號(hào)
該文章在 2010/7/3 10:50:17 編輯過(guò)