Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 09:52 AM
BDKiii
Guest
 
Posts: n/a
Default 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 = "Ladera@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"




%>
  #2  
Old July 19th, 2005, 09:52 AM
Aaron Bertrand - MVP
Guest
 
Posts: n/a
Default Re: JMAIL HELP

> Im trying to take a form - and send it to two places...[color=blue]
> I'd like the form data to go to a database as well as email
> the form results...[/color]

Sure, what is the problem you're having?
[color=blue]
> 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[/color]

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/


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles