469,328 Members | 1,265 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

JMAIL HELP

Im trying to take a form - and send it to two places...
I'd like the form data to go to a database as well as email
the form results...

Below is the form handler that I currently use... Is it possible to
do this with what I have?

I really need help here!

thanks....

<%@LANGUAGE = VBSCRIPT%>
<%

' Get the form data
senderEmail = Request.Form("requiredemail")
subject = "Ladera - Contact Us Form"
recipient = "La****@candw.lc"
body = body & "Name: " & Request.Form("requiredname") & vbCrLf
body = body & "Address: " & Request.Form("Address") & vbCrLf
body = body & "City: " & Request.Form("City") & vbCrLf
body = body & "State: " & Request.Form("State") & vbCrLf
body = body & "Zip: " & Request.Form("Zip") & vbCrLf
body = body & "Country: " & Request.Form("Country") & vbCrLf
body = body & "Phone #: " & Request.Form("requiredphone") & vbCrLf
body = body & "Email: " & Request.Form("requiredemail") & vbCrLf
body = body & "Fax #: " & Request.Form("Fax") & vbCrLf
body = body & "Comments: " & Request.Form("Comments") & vbCrLf

Dim lobjMail

Set lobjMail = Server.CreateObject ("JMail.SMTPMail")

' This is my local SMTP server
' lobjMail.ServerAddress = "216.21.17.82"
lobjMail.Sender = senderEmail
lobjMail.AddRecipient recipient
'lobjMail.AddRecipient recipient1 commented out
lobjMail.Body = body
lobjMail.Subject = subject

lobjMail.Execute
SendEmail = True

Set lobjMail = Nothing

Response.Redirect "index.asp"


%>
Jul 19 '05 #1
1 2255
> Im trying to take a form - and send it to two places...
I'd like the form data to go to a database as well as email
the form results...
Sure, what is the problem you're having?
body = body & "Name: " & Request.Form("requiredname") & vbCrLf
body = body & "Address: " & Request.Form("Address") & vbCrLf
body = body & "City: " & Request.Form("City") & vbCrLf
body = body & "State: " & Request.Form("State") & vbCrLf
body = body & "Zip: " & Request.Form("Zip") & vbCrLf
body = body & "Country: " & Request.Form("Country") & vbCrLf
body = body & "Phone #: " & Request.Form("requiredphone") & vbCrLf
body = body & "Email: " & Request.Form("requiredemail") & vbCrLf
body = body & "Fax #: " & Request.Form("Fax") & vbCrLf
body = body & "Comments: " & Request.Form("Comments") & vbCrLf


Okay, so you build up the body here, why can't you also build out a SQL
statement?

sql = "INSERT INTO tableName(columnName, ...) VALUES('" &
replace(request.form("requiredname"), "'", "''") & "', ...")
set conn = CreateObject("ADODB.Connection")
conn.open connectionString ' see http://www.aspfaq.com/2126
conn.execute sql, , 129

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Lasse Edsvik | last post: by
reply views Thread by BDKiii | last post: by
2 posts views Thread by rourou | last post: by
8 posts views Thread by Mangler | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.