用Cdonts實現發送Email
發表于:2007-07-02來源:作者:點擊數:
標簽:
% dimcdo setcdo=server.createobject("cdonts.newmail") cdo.From=fromwho"發件人信箱 cdo.To=towho"收件人信箱 cdo.Subject=subject"主題 cdo.Body=body"郵件正文 cdo.MailFormat=0 "說明是以 MI ME發送 cdo.BodyFormat=0 "可以包含html代碼 cdo.Importance
<%
dim cdo
set cdo=server.createobject("cdonts.newmail")
cdo.From=fromwho "發件人信箱
cdo.To = towho "收件人信箱
cdo.Subject =subject "主題
cdo.Body =body "郵件正文
cdo.MailFormat=0 "說明是以
MIME發送
cdo.BodyFormat=0 "可以包含html代碼
cdo.Importance=0 "郵件的優先級別0-1-2
cdo.
clearcase/" target="_blank" >cc=xx@xx.net "抄送
cdo.Bcc=xx@sf.net "密送
cdo.AttachFile attachfile "附件
cdo.Send
Set cdo=Nothing
%>
下面我們看一個實例:
dim str
str=str&"您好!"
str=str&" 由中國學生網所提供的劣質服務(ASP
服務器癱瘓),導致本站連繼兩天不能訪問。"
str=str&"站長向這段時間不能訪問本站的朋友深表歉意!本工作室也正在考慮更換
網絡提供商!<br>"
str=str&" 本站永久域名:www.chinabs.net 主要面向B/S技術愛好者。<br>"
str=str&" 建站的目的是為B/S愛好者提供一個學習交流的平臺,同時也為商家建立企業上網平" str=str&"臺,企業內部B/S應用提供
解決方案。<br>"
str=str&" 主要內容包括:ASP,ASP.NET,JSP,
PHP,C#,
Java,JavaScript,XML學習文章,B/S技術" str=str&"交流
論壇及一些本工作室
開發的一些B/S應用。<br>"
str=str&" 本站的發展離不開大家的支持!<br>"
str=str&" 謝謝!<br>"
str=str&" 站長:追風<br>"
str=str&" 深圳比艾思工作室<br>"
200469112820.htm="test.gif" "附件文件名
path=Server.MapPath("\jefenet\images\" & 200469112820.htm) "附件的路徑
Set theMail=Server.CreateObject("CDONTS.NewMail")
theMail.From="chinabs@263.net" "發件人信箱
theMail.To ="jeffzb@21cn.com" "收件人信箱
theMail.Subject ="電子郵件
功能測試!" "主題
theMail.BodyFormat=0 "定義以Html的格式發送郵件
theMail.MailFormat=0 "定義以Mime的格式發郵件
theMail.Body=Str "郵件正文
On Error Resume Next "如果找不到附件,則跳過
theMail.AttachFile path,200469112820.htm
theMail.Send
set theMail=nothing
,
原文轉自:http://www.kjueaiud.com