65.9K
CodeProject 正在变化。 阅读更多。
Home

使用 CDO 邮件附加文件

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.31/5 (6投票s)

2004年6月23日

CPOL
viewsIcon

82552

为搜索 CDO 邮件附件的人提供的代码。

引言

大家好,这里是为搜索 CDO 邮件附件的人提供的代码。 在这种情况下,我使用了基于请求页面中选定项目数量的文件附件。 如果对文件下载进行了相关检查,则相关文件将被添加到附件中并作为邮件发送。

'++++++++++= CDO Mail ++++++++++++++++

set objMessage = createobject("cdo.message")
set objConfig = createobject("cdo.configuration")

' Setting the SMTP Server
Set Flds = objConfig.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 
  "smtpserver"
Flds.update


Set objMessage.Configuration = objConfig
objMessage.To = strRecipientString
objMessage.From = strFromString
objMessage.Subject = strSubject
objMessage.TextBody = strMessageBody

'--------- Attach the files -----------

For i=1 to counter
FreeTools = Request.Form("dowloadfile")(i)
objMessage.AddAttachment(Server.MapPath(download))

Next

objMessage.fields.update
objMessage.Send


set objMessage = nothing
set objConfig = nothing

希望大家可以用它来编程。

编程愉快!!!

© . All rights reserved.