Click to See Complete Forum and Search --> : html forum submit to email


Lord Zarm
July 17th, 2002, 10:37 AM
I need to send the results of some selected answers to email... how can I do this?

goddess_spanky
July 18th, 2002, 01:41 PM
There are two ways that I know of:

1. Send the form data using a simple "mailto:username@domain.com" in the FORM tag (<FORM NAME="FeedbackForm" METHOD="POST" ACTION="mailto:username@domain.com"> THe major problem with this is that the user must have a email client installed on their desktop (like outlook). Plus, the formatting isn't very pretty.

2. If you have the ability to use ASP in your web site, you can use CDO for NTS (Common Data Objects for NT Server). Something like this:

<FORM NAME="FeedbackForm" METHOD="POST" ACTION="SendMail.asp">

then in the file SendMail.asp :

<%@ LANGUAGE="VBScript"%>
<%
dim strSendTo, strSender, strBody, strSubj

strSendTo = Request.Form("SendTo")
strSender = Request.Form("Sender")
strBody = Request.Form("EmailBody")
strSubj = Request.Form("Subject")

if strSendTo = "" then
strSendTo = "default@domain.com"
end if

if strSender = "" then
strSender = "annonymous@noreturnemail.com")
end if

Set objMail = Server.CreateObject("CDONTS.NewMail")

with objMail
.To = strSendTo
.From = strSender
.Body = strBody
.Subject = strSubj
.Send
end with

Set objMail = Nothing

%>

if you do a search through this forum for 'send mail' you will probably get better answers than this. ;)