Click to See Complete Forum and Search --> : CDONTS.NewMail


bloke
06-25-2003, 10:59 AM
Hello folks

I'm looking at some inherited code and can't quite figure out why this doesn't work. It apparently used to, but doesn't any more! Here goes:

' *** mail routine start
Dim mailBody
Dim MyMail 'The CDO object

' Create NewMail object
Set MyMail = Server.CreateObject("CDONTS.NewMail")
' Set the properties of the object
MyMail.From = "someone@blokeinthekitchen.com"
MyMail.To = "someoneelse@blokeinthekitchen.com"
MyMail.Subject = "blah blah"
'build body text
mailBody = somevariable
mailbody = mailbody & anothervariable
MyMail.Body = mailBody
' Send the message
MyMail.Send()
Set MyMail = Nothing
' *** mail routine end


It doesn't fall over, it just doesn't appear to do anything. Anything obvious amiss?

Cheers

TBor
06-25-2003, 02:12 PM
Sorry Bloke - on first look, I can't see anything wrong with that. I'm using essentially the same code as you there, except I'm declaring the Body explicitly (MyMail.Body="Hello, this is the Body") and I don't have any parentheses when calling MyMail.Send

What type of server platform are you using?

TBor

bloke
06-26-2003, 02:54 AM
The server is NT4....boo hoo!

We do have a windows 2000 server and I've tried this:

<%
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
MyMail.From = "address1@blokeinthekitchen.com"
MyMail.To = "address2@blokeinthekitchen.com"
MyMail.Subject = "test"
MyMail.TextBody = "Hello bloke"
MyMail.Send()
Set MyMail = Nothing
%>


with the same results (ie nothing!)

bloke
06-26-2003, 07:39 AM
Hmm. Does it need to be that complicated though? (and yes, that is complicated for such as I!!)

Cheers

TBor
06-26-2003, 08:50 AM
Bloke, I'm running the same code as you are right now on IIS5 on a Win2000 server, and not having any problems. Can't explain what's making yours not work, but I'm not really an expert.

Dave, are there any IIS/server settings that need to be configured to send mail in this way?

TBor

bloke
06-26-2003, 08:56 AM
Cheers Tbor

The original code that seemed to stop working is on winNT and I tracked back to the machine and found that someone had stopped the SMTP service. I've restarted it but still no joy.

Maybe AspEmail is the answer!!

Cheers

bloke
06-27-2003, 03:29 AM
Thanks Dave, you're a star.

I need to get our server admin to set up AspEmail before I go ahead here however I will be going down this route for my own site over the weekend.

Cheers

bloke
06-30-2003, 07:05 AM
Just a quick note for anyone experiencing the same problem, I finally tracked the problem down to the smtp service. It was looking for the wrong mail server!

Save yourself lots of time (and hair) - check the smtp service first before you start dissecting your code.

Tar