Click to See Complete Forum and Search --> : Need a 'simple' script to to send a file as an attachment.


jammer20002
10-10-2004, 08:26 PM
I need a 'simple' script to to send a file as an attachment.
I want the user to fill in their details, click on a browse button, choose a file and then click submit.
I want this to send an email with the chosen file as an attachment from the user.

I've seen loooads of scripts to upload files to the web server.
But I don't need it to do this - all I need is for the file to be sent with the email.
(OR is it necessary for the file to be uploaded before it can be sent as an attachment?)

I've tried searching and searching...
I've managed to get a few scripts to work and get files uploaded to the server.
But... I can't find anything that will send an email.
(Well... at least... I mean to say I've found a few scripts... but they seem to be overly complex AND they don't work on my hosting... most often because they refer to paths that don't exist on my hosting.)
(I've got the latest ASP and ASP.net for my hostimg.)

Any help/pointers would be really appreciated.

Thanks.


Jam

javaNoobie
10-10-2004, 09:09 PM
http://msdn.microsoft.com/library/en-us/cdo/html/_denali_newmail_object_cdonts_library_.asp?frame=true

jammer20002
10-16-2004, 07:26 PM
I'm still confused. :(
I've searched and searched and can't find ANY good examples using CDONTS.

from the link given above, they give the following code:

Set objNewMail = CreateObject("CDONTS.NewMail")
Call objNewMail.AttachFile("\\server\schedule\sched.xls", "SCHED.XLS")
objNewMail.Send "Automated Schedule Generator", "user1@example.com", _
"Schedule", "Here's the new schedule", 0
Set objNewMail = Nothing

I'm confused about how to do the attachfile.
Does the above example suggest that the path of the file is given from the server?
If so, then I assume it's necessary to upload the file to the server first?
This is not what I want to do.
I simply want to have a file attached to the email ebing sent in the form to mail script. :(

Any help would be appreciated.

Thanks.

stevem2004
10-18-2004, 06:32 AM
Try this http://www.powerasp.com/content/hintstips/asp-email.asp