Click here to Skip to main content
Licence CPOL
First Posted 22 Jun 2004
Views 53,671
Bookmarked 17 times

Attaching files with a CDO mail

By | 22 Jun 2004 | Article
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

rampdci



India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHow do you attach files that the user submits through a form? Pinmemberdeprivedwriter6:19 26 Sep '08  
GeneralAttaching a PDF On-the-fly PinmemberTWZDegen10:35 31 Oct '06  
GeneralRe: Attaching a PDF On-the-fly PinmemberRothariger9:58 7 Feb '07  
QuestionAn error occurs evrytime Pinmemberlive n let live0:03 28 Apr '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 23 Jun 2004
Article Copyright 2004 by rampdci
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid