trunkie
11-22-2004, 09:56 AM
I'm building a site in which I have several forms that send an email to a fixed address. I have a response.write that tels the user their info has been processed but I'd also like a copy of the email to be sent to them. How can I grab the users email address and cc the email to them?
The asp is posted below:
<%
Dim strTo, strSubject, strBody
Dim objCDOMail
strTo ="email@host.com"
strSubject = "Website Contact"
strBody = strBody & "<html><body bgcolor= white><font face='Arial' size='2'><b>Website Contact</b></font> </p><table width='550' border='0' "
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Name</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("name")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Phone number</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("phone_number")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Email</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("email")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Company</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("company")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Company Address</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("company_address")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Postcode</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("postcode")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Comment</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("comments")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "</font></td></tr></table></body></html>"
If strTo = "" Then
%>
<%
Else
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.From = "feedback@host.com"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Send
Set objCDOMail = Nothing
Many thanks
The asp is posted below:
<%
Dim strTo, strSubject, strBody
Dim objCDOMail
strTo ="email@host.com"
strSubject = "Website Contact"
strBody = strBody & "<html><body bgcolor= white><font face='Arial' size='2'><b>Website Contact</b></font> </p><table width='550' border='0' "
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Name</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("name")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Phone number</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("phone_number")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Email</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("email")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Company</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("company")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Company Address</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("company_address")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Postcode</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("postcode")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "<tr><td width='120'><font face='Arial' size='2'>Comment</font></td><td width='280'><font size='2' face='Arial'>"
strBody = strBody & request.form ("comments")
strBody = strBody & "</font></td></tr>"
strBody = strBody & "</font></td></tr></table></body></html>"
If strTo = "" Then
%>
<%
Else
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.From = "feedback@host.com"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Send
Set objCDOMail = Nothing
Many thanks