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!

Insert form into database & Email it

Dreamweaver & Flash

Insert form into database & Email it

by  schase  Posted    (Edited  )
Ever want to know how to take a form that was just inserted into the database, and email the user with information? Well heres how with code for both Jmail & Cdonts. You can really find this all over Tek-Tips and elsewhere, but I've seen it a bunch posted right here - so here you go.

[color navy]
Insert the form into the database - redirect to page 2.
on page two create a recordset, order by ID descending.

then put the code right below the recordset. (pick which one works for you). Obviously you have to alter the below code to work for your items.

Good luck! ~Schase


Jmail Version
<%
Dim strRecipient
Dim strCallsign
Dim strPassword
Dim strSquad
Dim strYahoo
Dim strICQ

strRecipient = Recordset1.Fields.Item("Email").Value
strCallsign = Recordset1.Fields.Item("callsign").Value
strPassword = Recordset1.Fields.Item("password").Value
strSquad = Recordset1.Fields.Item("squad").Value
strYahoo = Recordset1.Fields.Item("yahoo").Value
strICQ = Recordset1.Fields.Item("ICQ").Value
%>
<%
Set JMail = Server.CreateObject("JMail.SMTPMail")

JMail.ServerAddress = "smtp.yourdomain.com"
JMail.ContentType = "text/html"
JMail.Sender = "Webmaster@yourdomain.com"
JMail.Subject = "De Domain Registration"
JMail.AddRecipient strRecipient
JMail.AddRecipient "webmaster@YourDomain.com"
JMail.Body = "<font face='arial' size ='3'>" &_
"IP Address - " & Request.Servervariables("REMOTE_ADDR") &_
"<BR>" &_
"Hello!" & strCallsign &_
"<br>" &_
"Email confirmation from De Site" &_
"<br>" &_
"Here are your registration details:" &_
"<br>" &_
"Callsign:" & strCallsign &_
"<br>" &_
"Password:" & strPassword &_
"<br>" &_
"Squad:" & strSquad &_
"<br>" &_
"Yahoo:" & strYahoo &_
"<br>" &_
"ICQ:" & strICQ &_
"<p>" &_
"Go to <a href='http://www.yourdomain.com'>De' Domain</a> to log in and get started..." &_
"<p>" &_
"We highly recommend changing your password through the edit my account link. At least to a password you will remember" &_
"<P>" &_
"<BR>" &_
"Please note - you will need to register in the messageboard area to post" &_
"<BR>" &_
"<BR>" &_
"Cheers," &_
"<br>" &_
"US!" &_
"<br>" &_
"</font>"
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Priority = 1
JMail.Execute
Set Jmail = nothing
response.redirect("myotherpage.asp")
%>

CDONTS Version
<%
Dim strRecipient
Dim strCallsign
Dim strPassword
Dim strSquad
Dim strYahoo
Dim strICQ

strRecipient = Recordset1.Fields.Item("Email").Value
strCallsign = Recordset1.Fields.Item("callsign").Value
strPassword = Recordset1.Fields.Item("password").Value
strSquad = Recordset1.Fields.Item("squad").Value
strYahoo = Recordset1.Fields.Item("yahoo").Value
strICQ = Recordset1.Fields.Item("ICQ").Value
%>
<%
Set MyMail = Server.CreateObject("CDONTS.NewMail")
MyMail.From = "Webmaster@yourdomain.com"
MyMail.Subject = "De' Registration"
MyMail.to = strRecipient
MyMail.CC = "webmaster@yourdetour.com"
MyMail.MailFormat = 0
MyMail.BodyFormat = 0
MyMail.Body = "<font face='arial' size ='3'>" &_
"IP Address - " & Request.Servervariables("REMOTE_ADDR") &_
"<BR>" &_
"Hello!" & strCallsign &_
"<br>" &_
"Email confirmation from here!" &_
"<br>" &_
"Here are your registration details:" &_
"<br>" &_
"Callsign:" & strCallsign &_
"<br>" &_
"Password:" & strPassword &_
"<br>" &_
"Squad:" & strSquad &_
"<br>" &_
"Yahoo:" & strYahoo &_
"<br>" &_
"ICQ:" & strICQ &_
"<p>" &_
"Go to <a href='http://www.yourdomain.com'>Tour De' GVFForce</a> to log in and get started..." &_
"<p>" &_
"We highly recommend changing your password through the edit my account link. At least to a password you will remember" &_
"<P>" &_
"<BR>" &_
"Please note - you will need to register in the messageboard area to post" &_
"<BR>" &_
"<BR>" &_
"Cheers," &_
"<br>" &_
"US!" &_
"<br>" &_
"</font>"
MyMail.importance = 1
MyMail.Send
Set MyMail = nothing
response.redirect("myotherpage.asp")
%>
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top