Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Attaching files with a CDO mail

0.00/5 (No votes)
22 Jun 2004 1  
Code for who search for CDO mailing attachments.

Introduction

Hello guys, here is the code for who search for a CDO mailing attachment. In this case, I have used the file attachment based on the number of selected items in the Request page. If the relevant check is done for the file download, then the related files will be added in the attachment and sent as mail.

'++++++++++= 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

Hope you guys can program with it.

Happy programming!!!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here