New to CDO: Sending client attachments with ASP using CDO
Posted on 2004-08-20
We are a small office with a network running a Cobalt Qube 3 server (LINUX).
This box has Chilisoft ASP, and a couple of components: Chil!Mail, Chili!Upload.
My .asp apps work great now. Using CDONTS.
We are now in the process of upgrading our complete network. My apps will need to move over to our new server: Windows 2003 Standard O/S.
I have read many posts, and know that I have to save the file to the server before attaching to the email.
I am therefore new to CDO.
If I have a standard HTML form with an Input box for the client to select a file, how do I save this to our server and then attach to my email. ?
I have the following code which works for sending the email....I just need to add code to SAVE to file and then ATTACH
response.write "Email sent....Check your in-box !"
strTo = "ME@ME.COM"
strFrom = "YOU@YOU.COM"
strSubject = "TEST EMAIL"
strBody = "The content of email"
strIP = "XX.XX.XX.XX" ' Put your ip here
Set objCDOMail = Server.CreateObject("CDO.Message")
' Set the properties of the object
objCDOMail.From = StrFrom
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.TextBody = strBody
objCDOMail.Configuration.Fields("cdo/configuration/smtpserver") = strIP
objCDOMail.Configuration.Fields("cdo/configuration/sendusing") = 2
' Some of the more useful ones I've included samples of here:
' objCDOMail.Cc = "mailto:firstname.lastname@example.org;email@example.com"
' objCDOMail.Bcc = "Khirt@cinci.rr.com"
' objCDOMail.Importance = 1
' objCDOMail.AttachFile "d:\websites\als\about.html", "filename.txt"
' Send the message!
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method + it clears it out of the Server's Memory.
Set objCDOMail = Nothing
Appreciate your soonest help