Having to Chabge from CDONTS to CDO can anyone help

K

kevin

Hi
I have just changed hosting companys and my mail forms I find this is
because new provider does not support CDONT anymore. Below is my
original sent asp using CDONT and below that is my attemt to recode
using CDO but it does not work.

Can anyone plesee enter the missing lines

The error

CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/sent.asp, line 110
------------------------------------------------------------------------------------------------------------------------------------------------
Old code taking variables from a form
Dim MyBody
Dim MyCDONTSMail

Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "(e-mail address removed)"
MyCDONTSMail.To= "(e-mail address removed)"
MyCDONTSMail.Subject="Message via plasmacab.co.uk website"
MyBody = MyBody & "Name: " & request ("Name")& vbCrLf
MyBody = MyBody & "Address: " & request ("Address")& vbCrLf
MyBody = MyBody & "Postcode: " & request ("Postcode")& vbCrLf
MyBody = MyBody & "Email Address: " & request ("Email")& vbCrLf
MyBody = MyBody & "Telephone: " & request ("Telephone")& vbCrLf
MyBody = MyBody & "Enquiry: " & request ("Enquiry")& vbCrLf & vbCrLf
MyBody = MyBody & "Message Time: " & now()
MyCDONTSMail.Body= MyBody

MyCDONTSMail.Send
set MyCDONTSMail=nothing
-----------------------------------------------------------------------------------------------------------------------------------------------
Code I have tried to change
<%
Dim MyBody
Dim MyMail

MyBody = MyBody & "Name: " & request ("Name")& vbCrLf
MyBody = MyBody & "Address: " & request ("Address")& vbCrLf
MyBody = MyBody & "Postcode: " & request ("Postcode")& vbCrLf
MyBody = MyBody & "Email Address: " & request ("Email")& vbCrLf
MyBody = MyBody & "Telephone: " & request ("Telephone")& vbCrLf
MyBody = MyBody & "Enquiry: " & request ("Enquiry")& vbCrLf &
vbCrLf
MyBody = MyBody & "Message Time: " & now()

Set MyMail=CreateObject("CDO.Message")
MyMail.Subject="Message via plasmacab.co.uk website"
MyMail.From="(e-mail address removed)"
MyMail.To="(e-mail address removed)"

MyMail.TextBody = MyBody
MyMail.Send
set MyMail=nothing

%>
</HTML>

Thanks
Kevin
 
A

Anthony Jones

Hi
I have just changed hosting companys and my mail forms I find this is
because new provider does not support CDONT anymore. Below is my
original sent asp using CDONT and below that is my attemt to recode
using CDO but it does not work.

Can anyone plesee enter the missing lines

The error

CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/sent.asp, line 110
-------------------------------------------------------------------------- ----------------------------------------------------------------------
Old code taking variables from a form
Dim MyBody
Dim MyCDONTSMail

Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "(e-mail address removed)"
MyCDONTSMail.To= "(e-mail address removed)"
MyCDONTSMail.Subject="Message via plasmacab.co.uk website"
MyBody = MyBody & "Name: " & request ("Name")& vbCrLf
MyBody = MyBody & "Address: " & request ("Address")& vbCrLf
MyBody = MyBody & "Postcode: " & request ("Postcode")& vbCrLf
MyBody = MyBody & "Email Address: " & request ("Email")& vbCrLf
MyBody = MyBody & "Telephone: " & request ("Telephone")& vbCrLf
MyBody = MyBody & "Enquiry: " & request ("Enquiry")& vbCrLf & vbCrLf
MyBody = MyBody & "Message Time: " & now()
MyCDONTSMail.Body= MyBody

MyCDONTSMail.Send
set MyCDONTSMail=nothing
-------------------------------------------------------------------------- ---------------------------------------------------------------------
Code I have tried to change
<%
Dim MyBody
Dim MyMail

MyBody = MyBody & "Name: " & request ("Name")& vbCrLf
MyBody = MyBody & "Address: " & request ("Address")& vbCrLf
MyBody = MyBody & "Postcode: " & request ("Postcode")& vbCrLf
MyBody = MyBody & "Email Address: " & request ("Email")& vbCrLf
MyBody = MyBody & "Telephone: " & request ("Telephone")& vbCrLf
MyBody = MyBody & "Enquiry: " & request ("Enquiry")& vbCrLf &
vbCrLf
MyBody = MyBody & "Message Time: " & now()

Set MyMail=CreateObject("CDO.Message")
MyMail.Subject="Message via plasmacab.co.uk website"
MyMail.From="(e-mail address removed)"
MyMail.To="(e-mail address removed)"

MyMail.TextBody = MyBody
MyMail.Send
set MyMail=nothing

%>
</HTML>

Code looks fine (Although I would use Server.CreateObject not just
CreateObject but I don't think would be the problem).

Sounds like the Server Extensions Mail Options haven't been configured for
the site.

Alternative you can set the configuration fields yourself:-

Dim oConfig : Set oConfig = CreateObject("CDO.Configuration")

With oConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "127.0.0.1" ' Change this to the actual server name or address
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With

Set MyMail.Configuration = oConfig
 
K

kevin

Code looks fine (Although I would use Server.CreateObject not just
CreateObject but I don't think would be the problem).

Sounds like the Server Extensions Mail Options haven't been configured for
the site.

Alternative you can set the configuration fields yourself:-

Dim oConfig : Set oConfig = CreateObject("CDO.Configuration")

With oConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "127.0.0.1" ' Change this to the actual server name or address
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With

Set MyMail.Configuration = oConfig

I have changed the code as suggested but now get an error message
object required line 104
here is my amended script
<%
Dim oConfig : Set oConfig = CreateObject("CDO.Configuration")
Dim MyBody
Dim MyMail

With oConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailhost.zen.co.uk"
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpserverport") = 25
.Update
End With


Set MyMail.Configuration = oConfig


MyBody = MyBody & "Name: " & request ("Name")& vbCrLf
MyBody = MyBody & "Address: " & request ("Address")& vbCrLf
MyBody = MyBody & "Postcode: " & request ("Postcode")& vbCrLf
MyBody = MyBody & "Email Address: " & request ("Email")& vbCrLf
MyBody = MyBody & "Telephone: " & request ("Telephone")& vbCrLf
MyBody = MyBody & "Enquiry: " & request ("Enquiry")& vbCrLf & vbCrLf
MyBody = MyBody & "Message Time: " & now()

Set MyMail=CreateObject("CDO.Message")
MyMail.Subject="Message via plasmacab.co.uk website"
MyMail.From="(e-mail address removed)"
MyMail.To="(e-mail address removed)"

MyMail.TextBody = MyBody
MyMail.Send
set MyMail=nothing

%>
</HTML>
Thanks
 
A

Anthony Jones

I have changed the code as suggested but now get an error message
object required line 104
here is my amended script
<%
Dim oConfig : Set oConfig = CreateObject("CDO.Configuration")
Dim MyBody
Dim MyMail

With oConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailhost.zen.co.uk"
.Item("http://schemas.microsoft.com/cdo/configuration/
smtpserverport") = 25
.Update
End With


Set MyMail.Configuration = oConfig

You haven`t created MyMail yet!!

I didn`t intend you to insert the code verbatim.
 
K

kevin

You haven`t created MyMail yet!!

I didn`t intend you to insert the code verbatim.

Then I don't know how to create mail I thought the variables were
being brought in from the form contact.asp a form with contact
details that then loads sent.asp
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top