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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autoresponder

Status
Not open for further replies.
May 12, 2002
51
US
Does anyone know of a good ASP script that will do this...

Someone fills out a form with their name, e-mail, etc. IT will put all of that into an Access database, e-mail me, and reply back to them automatically?

Thanks!

Help. Thanks!
-JusTin
 
Maybe something like this..

***********Add the info to the DB:************
'Create the connection string....
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; " & "DBQ=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "MyDB.mdb"
objConn.Open

'Declare recordset object...
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")

'Open the database! (NOTE: for the DB to updateable, you
'MUST set the lock type to "adLockOptimistic"!)

objRS.Open "tblUsers", objConn, , adLockOptimistic

'Perform add action...
objRS.AddNew
objRS("PostDate") = Date()
objRS("PostTime") = Time()
objRS("Name") = strName
objRS("Email") = strEmail
objRS.Update

'Close objects...
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing

********mail section:*************
'Now send the mail...

Dim objMail
Set objMail = CreateObject("CDONTS.NewMail")

objMail.From = "me@me.com"
objMail.Subject = "Your subscription"
objMail.To = "you@you.com"
objMail.Body = "Hello!"
objMail.Send

Response.Write("Mail was Sent")

'close the object!
Set objMail = nothing

[/code]

NOTE: your server must be running an SMTP service, or the "NewMail-object" won't be created!

good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top