Link to home
Start Free TrialLog in
Avatar of shocking_ASP
shocking_ASP

asked on

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 :

<%@LANGUAGE="VBSCRIPT" %>
<%

        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
       
         objCDO.Send
             
             set objCDO = nothing
             
%>
<html>
<body>
Mail Sent!!!
</body>
</Html>



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,
regards,
Sam
Avatar of Makr_Watson27
Makr_Watson27

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

R-
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
Avatar of shocking_ASP

ASKER

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.
regards,
Sam
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.
regards,
Sam
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
http://support.microsoft.com/default.aspx?scid=kb;en-us;259176

If its error 80090020 then check
http://support.microsoft.com/default.aspx?scid=kb;en-us;318478

If its error 800a0046 then check
http://support.microsoft.com/default.aspx?scid=kb;en-us;286301
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:

Drop
Pickup

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!!!

R-
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.
thanks....
regards,
Sam
ASKER CERTIFIED SOLUTION
Avatar of rhoggren
rhoggren

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start 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 :)