p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Re: Pass information to an Access database AND send email with a Submit button


Message #1 by "Shawn Beasley" <datadriven80@h...> on Wed, 26 Jun 2002 17:50:51
Thanks Ken,

I will give this a "shot".

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Shawn Beasley" <datadriven80@h...>
Subject: [asp_databases] Pass information to an Access database AND send
email with a Submit button


: I have created an online form where the user completes a series of
: questions. Once they have completed the questions, the user selects a
: submit button that takes the user to a response page that displayes the
: information they entered (it also sends data to an Access 2000 database).
: I was wondering if it is possible (after or before the information is
: passed to the database) to also send an email to a recipient without
: passing the data to another page?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Put the code to send the email straight after the code to insert the data
into the database...

Cheers
Ken

Message #2 by "Ken Schaefer" <ken@a...> on Wed, 26 Jun 2002 16:15:02 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Shawn Beasley" <datadriven80@h...>
Subject: [asp_databases] Pass information to an Access database AND send
email with a Submit button


: I have created an online form where the user completes a series of
: questions. Once they have completed the questions, the user selects a
: submit button that takes the user to a response page that displayes the
: information they entered (it also sends data to an Access 2000 database).
: I was wondering if it is possible (after or before the information is
: passed to the database) to also send an email to a recipient without
: passing the data to another page?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Put the code to send the email straight after the code to insert the data
into the database...

Cheers
Ken

Message #3 by "Shawn Beasley" <datadriven80@h...> on Tue, 25 Jun 2002 15:32:03
Hello,

I have created an online form where the user completes a series of 
questions. Once they have completed the questions, the user selects a 
submit button that takes the user to a response page that displayes the 
information they entered (it also sends data to an Access 2000 database). 
I was wondering if it is possible (after or before the information is 
passed to the database) to also send an email to a recipient without 
passing the data to another page? If this is possible, i am having a 
problem getting my code to work properly. The pertinent code is as follows 
(occurs after my SQL insert statement):


<%@ LANGUAGE="VBSCRIPT" %>

<!-- #include file="Adovbs.inc" -->
strToEmail = Request.Form("EmailTarget")
strSubject = Request.Form("EmailSubject")

<%

boolDebug = false

strScriptName = Request.ServerVariables("SCRIPT_NAME")
strLogFileName = "SCLog.txt"

strTo = strToEmail
'strFrom = strFromEmailForSend
'strCC = ""
strSubject = strSubject
strBody = "The following IDX issue has been received " & Chr(13)
strBody = strBody & Chr(13) & Chr(13) 
strBody = strBody & "Reported By: " & Name & Chr(13)
strBody = strBody & "Department: " & Department & Chr(13)
strBody = strBody & "Phone: " & phone & Chr(13)
strBody = strBody & "Date: " & rdate & Chr(13)
strBody = strBody & "Time: " & rtime & Chr(13)
strBody = strBody & "Priority: " & Priority & Chr(13)
strBody = strBody & "App/Module: " & module & Chr(13)
strBody = strBody & "Environment: " & environment & Chr(13)
strBody = strBody & "Term/Tend: " & idx & Chr(13)
strBody = strBody & "Brief Description: " & brief & Chr(13)
strBody = strBody & "Detailed Description: " & detail & Chr(13)

End If
%>


<%
'****************************************************************
'****	This sends email using the CDONTS object.
'****	it requires a server with SMTP running
'****	with an internet email connection.
'****************************************************************
set oMail = Server.CreateObject("CDONTS.Newmail")
oMail.To = strTo
oMail.CC = strCC
oMail.From = strFrom
oMail.Subject = strSubject
oMail.Body = strBody
oMail.Send
set oMail = Nothing
'*****Response.Write "Email sent<br>"
%>


<%
If boolDebug then
	Response.WRite "The err.number is " & err.number & "<br>"
	Response.Write "The email to send is " & strFromEmailForSend  
& "<br>"
	Response.Write "The email for the message is " & strFromEmail 
& "<br>"
End If
%>


Thanks for all of your help and attention to this matter.

  Return to Index