[thelist] ASP form question

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Tue Feb 11 16:01:02 CST 2003


>I was wondering if anyone could help me with this one. I have a form that I
>need to have emailed to a different person according to the name chosen
from
>a drop down list. I can find no resources to help me without. Would an
>if..else statement work? Anyone?

I'm assuming the form itself is just an HTML file?

Maybe use something like this pseudo-code:

### BEGIN CODE ###
If Len ( Request ( "person" ) ) > 0 then
	MailForm Request ( "person" )
End If

Sub MailForm ( sPerson )
'about:	mails the form to the person specified
'accepts:	sPerson. String. Required. The name/id/whatever of the
person to e-mail the form to.
'returns:	Nothing.

	Const FORM_PATH = "VirtualPathToYourForm"

	'in this routine, do whatever logic you need to do to determine the
e-mail address to send to
	... Assuming you've already determined the e-mail address ...
	dim sEmail : sEmail = whateverTheAddressIs

	dim FSO : Set FSO = Server.CreateObject (
"Scripting.FileSystemObject" )
	dim sForm : sForm = FSO.OpenTextFile ( Server.MapPath ( FORM_PATH )
).ReadAll ()

	'the actual syntax for the below will vary based on your mail
component API
	dim Mail : Set Mail = Server.CreateObject (
"WhateverYourMailComponentIs" )
	Mail.Subject	= "Here is your form"
	Mail.Body		= sForm
	Mail.MimeType	= "text/html"
	Mail.FromAddress	= FROM_ADDRESS
	Mail.ToAddress	= sEmail
	Mail.Send

End Sub
### END CODE ###

HTH,
-dave



More information about the thelist mailing list