I have a problem Using CDO object to send Online E-mails...

Hi everyone,
Well I use this source code to send an E-mail :


        Dim subject , email
        Dim objCDO

         Body = "<table>"
        Body = Body & "<tr><td> Sending E-mail !!!</td></tr>"
         Set objCDO = Server.CreateObject("CDONTS.Newmail")

        objCDO.From = "Sender@myserver.com"
        objCDO.To = "Receiver@myserver.com"
        objCDO.Subject = " Hi  "
        objCDO.Body = Body
        objCDO.BodyFormat = 0
        objCDO.MailFormat = 0
             set objCDO = nothing
Mail Sent!!!

but I receive "HTTP 500 - internal server error"  ,  and I don't know what's the problem.
Please Help me in this Case, I need it so so much.
thanks for your Help,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It maybe because you are not creating the session, try the following:

      strBody = ""
      strBody = strBody & "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">"
      strBody = strBody & "<html><head><title>Subject</title></head><body><table>"
      strBody = strBody & "<tr><td> Sending E-mail !!!</td></tr>"
      strBody = strBody & "</table></body></html>"

      Dim objSession, objNewMail
      Set objSession = CreateObject ("CDONTS.Session")
      objSession.LogonSMTP "Sender", "Sender@myserver.com"

      Set objNewMail = CreateObject("CDONTS.NewMail")
      objNewMail.BodyFormat = 0
      objNewMail.MailFormat = 0

      objNewMail.Send "Sender@myserver.com", "Receiver@myserver.com", "Subject", strBody
      Set objNewMail = Nothing

      Set objSession = Nothing
He shouldn't need to create a session though. He should be able to setup a cdonts.NewMail and just send it.

Author: When you say you get an HTTP500 error, do you have the IISHELP virtual directory set up in your IIS instance of your site to see the real error message?

If you do not and have the access to set this up, do that. You'll get a much better idea of what the real error message is.

I have an inkling feeling that it might be a "Permission Denied" message hiding behind that HTTP500 error

Whoopes my mistake
Permissions idea may also apply to the drop directories etc, but normally you get a specific error but you could try article http://support.microsoft.com/?kbid=260985
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

shocking_ASPAuthor Commented:
Guys as rhoggren said I have  Permission Error ...
I don't know what shoud I do with it....please Help me...
and MAKR_WATSON27 the link didn't help me at all.thanks for your attention!
I'll be waiting for your answers.
shocking_ASPAuthor Commented:
Guys as rhoggren said I have  Permission Error ...
I don't know what shoud I do with it....please Help me...
and MAKR_WATSON27 the link didn't help me at all.thanks for your attention!
I'll be waiting for your answers.
Did you follow rhoggren comment and install the IIS Help files, if so did you get a clearer error message and if so can you post it up.

If its error 8002801d then check

If its error 80090020 then check

If its error 800a0046 then check
Ok cool, at least we know it's a permissions issue.

Here is what you will need to do:

Find where your IIS is installed (Default I believe is C:\INETPUB\

Look in that folder for "MAILROOT"

Look in Mailroot for two directories:


You will have to make sure that your IUSR_MACHINENAME account has (I think) modify access to those two directories. If you aren't overly concerned with security and have time to play around, set the IUSR_MACHINENAME account to have modify permissions on all the directories under MailRoot and then remove them one by one.

I don't have access to a system to look at right this moment so I can't say for sure which directories absolutely need that set of permissions, but Im sure of Drop and Pickup needing them.

Hope this helps!!!

shocking_ASPAuthor Commented:
Dear rhoggren,
You know I've got this Problem when I try it Onlineon my own website.
I thought It can't be because of the account or something like that...
and I don't think it can be because of my IIS !
Please Help me in this Case.

Are you saying that you do not have access to the server in a way that would allow you to change permissions?

I would think it would be "standard" for the ISP to set up those permissions for you in that case.. have you tried calling them and telling them about your permission denied error?

Are you getting a more detailed error message now? Can you copy/paste that here?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Well, the error message received in this problem is definitely a permissions issue. The solution I provided would solve the issue if the person had access to the IIS console.

I don't mind what happens with the question, whatever you guys decide is cool with me :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.