August 13th, 2003, 10:33 AM
May contain nuts.
Join Date: Aug 2002
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
As rdoekes has already mentioned, the file you are trying to attach must be on the server. The easiest way to achieve this is to use a file-uploading component. I've been using one from Soft Artisans for the last 5 years, called SAFileup - but there are plenty to choose from.
Once you have done that, here's some sample code taken from 4guysfromrolla.com
Link to SA Fileup
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "firstname.lastname@example.org"
objMail.Subject = "A message TO you"
objMail.To = "email@example.com"
objMail.Body = "This is the body of the Message"
Response.write("Mail was Sent")
'You should always do this with CDONTS.
set objMail = nothing
Something else to note: If you are using IIS v.5+ (Windows 2000 onwards), you should be using CDOSYS for all your mailing, as CDONTS has been phased out and no longer ships with IIS.