Forum Moderators: phranque

Message Too Old, No Replies

Sending a Form to more than one person

Any ideas?

         

mikko

11:11 am on Jul 6, 2004 (gmt 0)

10+ Year Member



I have a form, that obviously emails me when someone enters data and hits submit. How can i get the form to email me and another person? i tried adding their address after mine, seperating with a ',' and also tried ';' but this did not work.
Any ideas on this would be great

Alternative Future

11:47 am on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mikko,

Have you looked at the CC or BCC on the form?

-George

mikko

12:04 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



George, here is the code i am using, it is written from an asp file, you can see below where the form sends the email - me@mydomain.co.uk, any ideas how i could BCC or CC someone else from the code?:
<form method="POST" action="_processCDONTS.asp">
<input name="subject" type=hidden value="Arrears Loans application form">
<input type=hidden name="redirect" value="http://www.mydomain.co.uk/thankyou.htm">
<input type=hidden name="yourname" value="Name of hte Form ">
<input type=hidden name="youremail" value="me@mydomain.co.uk">

Thanks

Alternative Future

12:14 pm on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mikko,

>>_processCDONTS.asp

Withing this file you should see some_var.TO & some_var.FROM you would have to add some_var.CC or some_var.BCC and then add that to the mail object.

How large is your asp file? Can you post some snippets from it?

-George

mikko

12:42 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



George here is the file, i tried to sticky mail it to you but for some reason email has problems.
Any suggestions welcome as i am not too hot with asp.

<%@ 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
%>

Alternative Future

12:51 pm on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mikko,

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)

mikko

1:45 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



George - THANK YOU!
I tried the 2nd option to change the asp file because i have about 50 forms on this site that use asp file, and it would take a bit of time updating 50 forms individually.

Thanks once again.
Colin