Forum Moderators: phranque
Thanks
<%@ LANGUAGE="VBSCRIPT" %>
<%
Dim strTo, strFromName, strFromAddress, strSubject, strRedirect, strFormResults
Dim key, strname, strvalue
Dim bEmail
strTo = Request.Form("recipientemail")
strSubject = Request.Form("subject")
strRedirect = Request.Form("Redirect")
strFromName = Request.Form("yourname")
strFromAddress = Request.Form("youremail")
For Each key in Request.Form
If Not (Lcase(key) = "submit") Then
strname = key
strvalue = Request.Form(key)
strFormResults = strFormResults & strname & addspaces(Len(strname),15) & " : " & strvalue & vbCRLF & vbCRLF
End If
Next
strFormResults = "Date Submitted : " & Now() & vBCRLF & _
"-------------------------------------------------" & vBCRLF & _
strFormResults
' send email
sendmail strTo, strFromAddress, strSubject, strFormResults
' Redirect to thankyou page
Response.Redirect (strRedirect)
Response.End
Function addSpaces(intLen, intTabStop)
Dim i
For i=1 to (intTabStop - intLen)
addSpaces = addSpaces & " "
Next
End Function
Sub sendmail (strToAddress, strFromAddress, strSubject, strBody)
'Response.Write "<BR>" & strToAddress
'Response.Write "<BR>" & strFromAddress
'Response.Write "<BR>" & strSubject
'Response.Write "<BR>" & strBody
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = strToAddress
objCDO.From = strFromAddress
objCDO.Subject = strSubject
objCDO.Body = strBody
objCDO.Send
'Cleanup
Set objCDO = Nothing
End Sub
%>
This would go in your form/html page:
<input type=hidden name="ccAddress" value="yourOtherEmail@domain.com">
Add the strCC to your asp file like below (order is not an issue)
strTo = Request.Form("recipientemail")
strCC = Request.Form("ccAddress")
strFromAddress = Request.Form("youremail")
Add the objCDO.CC again to your asp file beside the rest of the code shown below:
objCDO.To = strToAddress
objCDO.Cc = strCC
objCDO.From = strFromAddress
I am also not that sure of ASP but what I have shown you should work :)
You also have the option of keeping the CC address hidden from your actual html form by hard coding the CC address into your asp file like:
strCC = "yourOtherEmail@domain.com"
The second way allows you to remove the hidden form element and use the value set in the asp.
HTH,
-George
PS - let us know if it works for you
edit: Changed objCDO.CC to objCDO.Cc (note lowercase c in place now)