shiftless
01-05-2008, 12:01 AM
Hi I am trying to use CDO for sending an email via a form and am getting an error message. This is my first time trying this and I am not a programmer. Here's my relevant code:
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserver") = "127.0.0.1"
cdoConfig.fields.update
'Create and send your email here
mail = "officecatering@comcast.net"
reply = request.form("Email")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = reply
cdoMessage.To = mail
cdoMessage.Subject = "Order from the Officecatering.net web site"
cdoMessage.TextBody = sBody
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
' Now send confirmation email to user
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "donotreply@officecatering.net"
cdoMessage.Subject = "Your order from the Officecatering.net web site"
cdoMessage.To = reply
cdoMessage.TextBody = "This is a copy of your order from Officecatering.net:" & vbCrLf & _
"" & vbCrLf & _
sBody & _
"" & vbCrLf & _
"Thank You!"
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
I get this error:
Microsoft VBScript runtime error '800a01a8'
Object required: 'cdoMessage'
/cgi-bin/confirmation3.asp, line 64
Line 64 is this : Set cdoMessage.Configuration = cdoConfig
I tried adding this line near the top but it also gave me the same error message:
Set cdoMessage = Server.CreateObject("CDO.Message")
What am I doing wrong?
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserver") = "127.0.0.1"
cdoConfig.fields.update
'Create and send your email here
mail = "officecatering@comcast.net"
reply = request.form("Email")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = reply
cdoMessage.To = mail
cdoMessage.Subject = "Order from the Officecatering.net web site"
cdoMessage.TextBody = sBody
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
' Now send confirmation email to user
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "donotreply@officecatering.net"
cdoMessage.Subject = "Your order from the Officecatering.net web site"
cdoMessage.To = reply
cdoMessage.TextBody = "This is a copy of your order from Officecatering.net:" & vbCrLf & _
"" & vbCrLf & _
sBody & _
"" & vbCrLf & _
"Thank You!"
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
I get this error:
Microsoft VBScript runtime error '800a01a8'
Object required: 'cdoMessage'
/cgi-bin/confirmation3.asp, line 64
Line 64 is this : Set cdoMessage.Configuration = cdoConfig
I tried adding this line near the top but it also gave me the same error message:
Set cdoMessage = Server.CreateObject("CDO.Message")
What am I doing wrong?