用CDONTS NewMail發郵件

2021-04-07 05:18:34 字數 4809 閱讀 6925

<%

'last updated by recon on 05/14/2001

'on error resume next

'利用cdonts元件在win2k上傳送郵件

dim objmail

'普通郵件

'無主體

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected]"

objmail.subject    = "test1"

objmail.send

set objmail = nothing

'普通郵件

'有主體

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected]"

objmail.subject    = "test2"

objmail.body        = "when i was young, i listened to the radio ..."

objmail.send

set objmail = nothing

'普通郵件

'有多送.有主體

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected];[email protected]"

objmail.subject    = "test3"

objmail.body        = "when i was young, i listened to the radio ..."

objmail.send

set objmail = nothing

'普通郵件

'有抄送.有主體.有重要性

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected]"

objmail.cc            = "[email protected];[email protected]"

objmail.subject    = "test4"

objmail.body        = "when i was young, i listened to the radio ..."

objmail.importance = 2

objmail.send

set objmail = nothing

'普通郵件

'有抄送.有暗送.有主體.有重要性

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected]"

objmail.cc            = "[email protected]"

objmail.bcc             = "[email protected];[email protected]"

objmail.subject    = "test5"

objmail.body        = "when i was young, i listened to the radio ..."

objmail.importance = 2

objmail.send

set objmail = nothing

'普通郵件

'有主體.有重要性.含附件

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected]"

objmail.subject    = "test6"

objmail.body        = "when i was young, i listened to the radio ..."

objmail.importance = 2

objmail.attachfile "c:/love.txt"

objmail.send

set objmail = nothing

'html郵件

'有主體.有重要性

'注: attachurl的使用可能有錯誤

dim fso, tf

dim strhtml

set fso    = server.createobject("scripting.filesystemobject")

set tf    = fso.opentextfile("c:/mail.htm", 1)

strhtml = tf.readall

write strhtml

set tf    = nothing

set fso    = nothing

set objmail = server.createobject("cdonts.newmail")

objmail.from        = "[email protected]"

objmail.to            = "[email protected]"

objmail.subject    = "test7"

objmail.body        = strhtml

objmail.bodyformat    = 0

objmail.mailformat    = 0

objmail.importance    = 2

objmail.attachurl "c:/common.css", "common.css"

objmail.attachurl "c:/logo.gif", "logo.gif"

objmail.send

set objmail = nothing

%>

乙個過程。另外cdonts在iis5下才可以使用的,你還必須配置你的**tp服務,在internet管理器裡面有。

<%

sub sendmail(fromwho,towho,subject,body)

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

'[email protected] 抄送

'[email protected]密送

'cdo.attachfile "" 附件

cdo.send

set cdo=nothing

end sub

sub sendattachmail(fromwho,towho,subject,body,attachfile)

dim cdo

set cdo=server.createobject("cdonts.newmail")

cdo.from=fromwho

cdo.to = towho

cdo.subject =subject

cdo.body =body

cdo.mailformat=0

cdo.bodyformat=0

cdo.importance=0

cdo.attachfile attachfile

cdo.send

set cdo=nothing

end sub

%>

傳送帶附件的html格式郵件例程

如何通過 asp 來傳送帶附件、格式為 html 的郵件?下面提供了乙個例程.

<%@ language=vbscript%>

<%

response.buffer = true

response.expires = 0

'建立物件例項

set mymail = server.createobject("cdonts.newmail")

'以下是將要傳送的內容

html = ""

html = html & ""

html = html & ""

html = html & ""

html = html & "this is a test mail in html

"html = html & "mail content here ...

注意:themail.attachfile 第乙個引數為伺服器實際路徑,第二個引數為郵件中顯示的檔名

IIS郵件元件 CDONTS NewMail

在asp中傳送email時往往需要乙個com元件支援,如果你沒有第三方的email元件,你可以使用iis本身提供cdonts email元件。這個元件使用時需要安裝和啟動 tp服務。這個元件的名稱為cdonts.dll,使用前需要使用regsvr32註冊這個元件。cdonts元件提供了一系列物件,包...

IIS郵件元件 CDONTS NewMail

在asp中傳送email時往往需要乙個com元件支援,如果你沒有第三方的email元件,你可以使用iis本身提供cdonts email元件。這個元件使用時需要安裝和啟動 tp服務。這個元件的名稱為cdonts.dll,使用前需要使用regsvr32註冊這個元件。cdonts元件提供了一系列物件,包...

phpdoctor 安裝,配置,髮用

window 下安裝phpdoctor 1 安裝php,設定環境變數path 把php 的安裝路徑加上,比如php 安裝在d php5 3配置phpdoctor,phpdoctor 最基本的配置 原始碼路徑,比如您的原始碼路徑d work phptest,如下設定 source path d wor...