Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recipien drop down list

Status
Not open for further replies.

3112005

Technical User
Nov 28, 2005
58
US
I searched this forum and didn't find this topic covered, so I hope I'm not duplicated a thread.

I need to make my form submit to an email based on who they selection in a drop down.

I've got the dropdown list made in the form using....
<select name="recipient" size="1">
<option value="bill@example.com" selected>Bill</option>
<option value="sally@example.com">Sally</option>
<option value="john@example.com">John</option>
<option value="sue@example.com">Sue</option>
<option value="andy@example.com">Andy</option>
</select>

but I'm not sure what to modify in my send.asp page that actually passes the information.

Thanks,
Jackie
 
request.form("recipient") should give you the selected value...

-DNG
 
I decided to do it a little different where I hide the address in the code.

I've got it to send an email, but it keeps sending to the first email in the drop down no matter which address I select.

--- CODE ----

Form.asp

<select name="recipient" size="1">
<option value="1" selected>Sally Sample</option>
<option value="2">Sally Sample2</option>
<option value="3">Sally Sample3</option>
</select>

-------------------------

Send.asp

<%@ Language=VBScript %>
<%
Dim objMail
Dim crlf
Dim strBody

crlf = Chr(10) & Chr(13)
Set objMail = CreateObject("CDONTS.NewMail")
objMail.From = "VisitRequest"



Names = Array("","example@hotmail.com","example@hotmail.com","example@hotmail.com")

name = Names( CLng( Request("recipient") ) )

IF name = "" Then
Response.Write "EMail to nobody?"
Response.End
End If
objmail.to = name



objMail.To= "greenwood@westar.com"
objMail.Subject= Request.Form("Westar Visit Request Form")
strBody = "Name: " & Request.Form("name") & crlf
strBody = strBody & "Contract Number: " & Request.Form("contractnum") & crlf
strBody = strBody & "Government POC " & Request.Form("govpoc") & crlf
strBody = strBody & "Government POC Fax: " & Request.Form("govpocfax") & crlf
strBody = strBody & "Government POC Phone: " & Request.Form("govpocphone") & crlf
strBody = strBody & "Company Name: " & Request.Form("coname") & crlf
strBody = strBody & "Address: " & Request.Form("address") & crlf
strBody = strBody & "City: " & Request.Form("city") & crlf
strBody = strBody & "State: " & Request.Form("state") & crlf
strBody = strBody & "Zip: " & Request.Form("zip") & crlf
strBody = strBody & "Fax: " & Request.Form("fax") & crlf
strBody = strBody & "Phone: " & Request.Form("phone") & crlf
strBody = strBody & "Technical POC: " & Request.Form("techpoc") & crlf
strBody = strBody & "Technical POC Phone Number: " & Request.Form("techphone") & crlf
strBody = strBody & "Purpose of Visit: " & Request.Form("purpose") & crlf
strBody = strBody & "Duration of Visit: " & Request.Form("duration") & crlf
strBody = strBody & "Additional Comments: " & Request.Form("comments") & crlf


objMail.Body= strBody
objMail.Send
Set objMail = Nothing
Response.Write "Message sent. Redirecting to confirmation page."
Response.Redirect "%>
 
Oops I had and extra ObjMailto string. Took that out and it works now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top