Forums

ASP

This topic is locked

Attach document to form and send via email

Posted 15 Aug 2001 13:38:31
1
has voted
15 Aug 2001 13:38:31 andy smith posted:
Hello,
Is the following possible and if so how do you do it.
I have a form which once submitted is sent by e-mail to an administrator. One of the fields in the form allows the user to broswe and attach a word document. How do I get the word document to be sent as an attachment as part of the e-mail? I have tried the AttachFile script bu this only works if the word document is on the server.
Any help would be very much appreciated.
Kind Regards
Andy

Will every body stop getting shot!

Replies

Replied 15 Aug 2001 13:57:41
15 Aug 2001 13:57:41 Joel Martinez replied:
you'd have to get that doc file onto the server, I suggest using the pureASP upload extension...

Joel Martinez

----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
Replied 15 Aug 2001 16:06:17
15 Aug 2001 16:06:17 andy smith replied:
Thanks Joel for your quick reply.
I have used the pureASP upload extension before (fantastic!). Would the following work...
If I uploaded the doc file using pureASP upload extension and then in the 'Go To URL dialogue box send it to an e-mail script like the following:
<%
Option Explicit

Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail"

objMail.From = " "
objMail.Subject = "A message TO you"
objMail.AttachFile("d:\images\pic.gif"
objMail.To = " "
objMail.Body = "This is the body of the Message"
objMail.Send

Response.write("Mail was Sent"

'You must always do this with CDONTS.
set objMail = nothing
%>

The only problem I think I'd have is not being able to hard code the following line:
objMail.AttachFile("d:\images\pic.gif"

As the file will be different for each user.

Am I totally off the mark, or can this work?

Kind Regards

Andy


Will every body stop getting shot!
Replied 15 Aug 2001 20:28:29
15 Aug 2001 20:28:29 Joel Martinez replied:
yes, that's exactly what you need to do... you only need to find a way to append the filename to the querystring of the URL that will send the email...
for example,

response.redirect("email.asp?file=" & request("nameoffile")

unfortunately, I don't know exactly how the code works for these extensions, so you'll have to do some research.
But I think you're on the right track <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Joel Martinez

----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
Replied 16 Aug 2001 11:17:07
16 Aug 2001 11:17:07 andy smith replied:
FANTASTIC, Cheers Joel for your help.

Regards
Andy

Will every body stop getting shot!

Reply to this topic