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!

Adding a Cc field to a form 1

Status
Not open for further replies.

3112005

Technical User
Nov 28, 2005
58
US
I already have a working form that sends and email based on drop down selection. Now I need to add a field that the user types an email in and it Cc's the form to that manually typed email.

I found a site that seemed to explain it but I can't get it to work.

Here is the drop down selection in the form:
---CODE---
<select name="recipient" size="1">
<option value="0" selected></option>
<option value="1">Tim Hynes - St. Louis</option>
<option value="2">Tina Funkhouser - Huntsville</option>
<option value="3">Robin Elliott - Huntsville</option>
<option value="4">Diane Bergman - Manassas</option>
<option value="5">Karen O'Connor - NCR</option>
<option value="6">Charlie Douglas - SimAuthor</option>
</select>
---ENDCODE---

Here is the send.asp form:
---CODE---
<%@ Language=VBScript %>
<%
Dim objMail
Dim crlf
Dim strBody

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


Names = Array("","hynes@westar.com","funkhouser@westar.com","elliott@westar.com","bergman@westar.com","oconnor@westar.com","cdouglas@simauthor.com")

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

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



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
strBody = strBody & "Cc to: " & Request.Form("cc") & crlf
strBody = strBody & "Cc to: " & Request.Form("cc2") & crlf


objMail.Body= strBody
objMail.Send
Set objMail = Nothing
Response.Write "Message sent. Redirecting to confirmation page."
Response.Redirect "%>
---ENDCODE---
 
Put this just before objMail.From = "WestarVisitRequest":

objMail.Cc = "friend3@address3.com;friend4@address4.com"
 
How does it know what email was typed in the form?
 
On your HTML form on another page you would have a line:

<input type="submit" value="text" name="cc">

When you click the submit button the page that sends the email knows where to look because we have named the form element 'cc'

eg Request.Form("cc")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top