Getting the CDO object to work in ASP

They have: 47 posts

Joined: Jan 2000

Due to some bad settings of the SMTP server on my web host's server, the CDO object does not send email. I am positive that the problem is with the SMTP settings, and not with my source code, because everything works perfectly off of my localhost. If anybody has some experience with this, I would really appreciate some feedback.

Thanks,
Eugene

They have: 89 posts

Joined: Sep 1999

I use ASP to send email with the CDO object all the time. Hopefully I can help you out

The first thing I will suggest to is make sure that the Collaborative Data Object is installed on the server. It shipped out with NT Option Pack 4. In order to ensure that is installed goto Start/ Control Panel/ Add/Remove Programs/ NT Option Pack 4 and check to make sure that the SMTP Piece has been installed. It does not automatically install so if you have not chosen this option, it will not be there. Install it and then try your code again.

If you have already done this, then perhaps show me the errors you are getting or your code.

good luck

They have: 47 posts

Joined: Jan 2000

The thing is that I don't get any errors, not on my localhost at home, not on my web server which is remotely hosted. When I use this script on my localhost it sends email, and when I use it on my web server, it does NOT send email (even though I don't get any error messages).

I am sure the CDO is installed on the web server, because I would get an error message if it was not.

If you want I can show you the code that I am using:

set objMail = createobject("CDONTS.Newmail")
objMail.From = "[email protected]"
objMail.To = "[email protected]"
objMail.Subject = "subject"
objMail.Body = "body"
objMail.Send

set objMail = nothing

Any thoughts?

They have: 89 posts

Joined: Sep 1999

I am cutting and pasting some code directly from an .asp page that I use to send mail.

<% Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")

objCDO.To = "[email protected]"
objCDO.From = "[email protected]"

Dim txtSubject
txtSubject = "TEST! TEST!" & VbCrLf & _
Now()

objCDO.Subject = "TEST!"
objCDO.Body = txtSubject
objCDO.Send

Set objCDO = Nothing
%>

The only difference is the Server.CreateObject that I have versus your createobject. Cut and paste mine and replace your information and test it again.

Another possibility that I am sure you have considered, but I have to ask anyways....Are you in charge of your remote server..or is it hosted for you?

If it is hosted by someone else..have you verified that they are running IIS or another program that process .asp files? Who knows, maybe they are paranoid and disabled .asp processing. Anyways, just a thought.

They have: 47 posts

Joined: Jan 2000

I don't think the problem was with my script since it worked off of my localhost. I already contacted my hosting provider, and thus within the next couple of YEARS this should be fixed.

Thanks RC for your help.
Eugene

They have: 47 posts

Joined: Jan 2000

Apparently my web hosting provider does not allow customers to you CDO. They block all email sent with it. But they do allow to use ASPMailer, instead.

Thanks anyway.
Eugene

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.