Hi
I am trying to send emails using asp but I keep getting the following error message. Here is the code that i am using to do it.
Code used and adapted from Beginning ASP 3.0
<!--#include file="connectionString.asp" --> 'Server side include used to hold the database connection details. Page 481 in Beginning ASP 3.0 book
<!-- METADATA TYPE="typelib" 'This makes the ADO constants available without having to define them as constants. This information has been taken from page
519 of Beginning ASP 3.0
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
Dim IncFaultID
Dim objRS 'Declare variable to create the recordset object
set objRS = Server.CreateObject("ADODB.Recordset"
'Create the recordset object
objRS.Open "Faults", strConnect, adOpenKeySet, adLockOptimistic 'Connect to the database and open the staff table
objRS.MoveLast
IncFaultID = objRS.Fields("FaultID"
+ 1 'Incrementing the faultID by one each time a fault is being added to the database.
objRS.AddNew ' Add new recordset to the database
objRS.Fields("FaultID"
= IncFaultID ' Write details to the database
objRS.Fields("DateLogged"
= Date
objRS.Fields("TimeLogged"
= Time
objRS.Fields("StaffNo"
= Session("StaffNo"
objRS.Fields("TypeOfFault"
= Request.Form("FaultType"
objRS.Fields("RoomNo"
= Request.Form("Location"
objRS.fields("FaultDescription"
= Request.Form("Details"
objRS.Fields("Status"
= "UnAssigned"
objRS.Update
objRS.Close
Set objRS = Nothing
Dim cdoConfig
Dim cdoMessage
Dim theSchema
theSchema = " Set cdoConfig = Server.CreateObject("CDO.Configuration"
cdoConfig.Fields.Item(theSchema & "sendusing"
= 2
cdoConfig.Fields.Item(theSchema & "smtpserver"
= "mail.btopenworld.com"
cdoConfig.Fields.Update
Set cdoMessage = Server.CreateObject("CDO.Message"
cdoMessage.Configuration = cdoConfig
cdoMessage.From = Session("EmailAddress"
cdoMessage.To = "Sunil_mepani@hotmail.com"
cdoMessage.Subject = Request.Form("FaultType"
cdoMessage.TextBody = Request.Form("Details"
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.Redirect "FaultConfirmation.asp"
If anyone knows what I am doing wrong could they please tell me.
Thanks in advance
I am trying to send emails using asp but I keep getting the following error message. Here is the code that i am using to do it.
Code used and adapted from Beginning ASP 3.0
<!--#include file="connectionString.asp" --> 'Server side include used to hold the database connection details. Page 481 in Beginning ASP 3.0 book
<!-- METADATA TYPE="typelib" 'This makes the ADO constants available without having to define them as constants. This information has been taken from page
519 of Beginning ASP 3.0
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
Dim IncFaultID
Dim objRS 'Declare variable to create the recordset object
set objRS = Server.CreateObject("ADODB.Recordset"
objRS.Open "Faults", strConnect, adOpenKeySet, adLockOptimistic 'Connect to the database and open the staff table
objRS.MoveLast
IncFaultID = objRS.Fields("FaultID"
objRS.AddNew ' Add new recordset to the database
objRS.Fields("FaultID"
objRS.Fields("DateLogged"
objRS.Fields("TimeLogged"
objRS.Fields("StaffNo"
objRS.Fields("TypeOfFault"
objRS.Fields("RoomNo"
objRS.fields("FaultDescription"
objRS.Fields("Status"
objRS.Update
objRS.Close
Set objRS = Nothing
Dim cdoConfig
Dim cdoMessage
Dim theSchema
theSchema = " Set cdoConfig = Server.CreateObject("CDO.Configuration"
cdoConfig.Fields.Item(theSchema & "sendusing"
cdoConfig.Fields.Item(theSchema & "smtpserver"
cdoConfig.Fields.Update
Set cdoMessage = Server.CreateObject("CDO.Message"
cdoMessage.Configuration = cdoConfig
cdoMessage.From = Session("EmailAddress"
cdoMessage.To = "Sunil_mepani@hotmail.com"
cdoMessage.Subject = Request.Form("FaultType"
cdoMessage.TextBody = Request.Form("Details"
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.Redirect "FaultConfirmation.asp"
If anyone knows what I am doing wrong could they please tell me.
Thanks in advance