JMAIL HELP

B

BDKiii

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 = "(e-mail address removed)"


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"




%>
 
A

Aaron Bertrand - MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top