Link to home
Start Free TrialLog in
Avatar of Pungwick
Pungwick

asked on

CDONT problem

Hi there

When trying to run a script that uses the CDONT email component i get the following error:

Server object, ASP 0178 (0x80070005)
The call to Server.CreateObject failed while checking permissions. Access is denied to this object.
/Booking/dont.asp, line 23

I hope someone can help

I am using IIS 5 on windows XP

thanks
Pungwick
Avatar of Pungwick
Pungwick

ASKER

I also try another chuck of cdonts code and get this:

Permission denied: 'CreateObject'
/Booking/CDONTSMail.asp, line 48


 Set myCDONTSMail = CreateObject("CDONTS.NewMail") <--Line  48

I hope someone can help
thanks
I don't know why 'Permission Denied', I can look into it,
but check first if you have cdonts.dll at all (should be in windows\system32)!

As far as I remember it is not installed winth Windows XP, only with Windows 2000. If so, you have to get it, put it into system32 and register with regsvr32.exe

Does it help you?
Hi there

I have got cdonts working:) but it only seems to work for some code not others which is weird. Do you have some cdonts code that you belive is very good and works, if so you could post it here. Also How do you get instant email recieval??? Do you have any super sonice cdonts code, hehe :)

hope you can help

Thanks
Pungwick
Windows XP does not using CDONTS.dll
WinXp using CDOSYS.dll
please check it..
Sorry irish_coffee I dont understand what you mean. I know that CDonts isnt standard on XP however if you install the cdonts.dll file you can use it

thanks
If you have cdonts.dll file installed, ensure it has Execute permission set for you ASP user account.
How do you set up executable permisions?
right-click file, properties, security tab, check 'Read and execute' for appropriate user
that is the cdont.dll file?

have you got any CDonts code you can post here? Some that is very very fast

thanks
yes, set 'read and execute' for cdonts.dll

I have some code, a procedure (Sub) for sending an HTML email using CDONTS:

sub SendEmail(recipee, subject, body, from, replyTo)
      set oCDO = Server.CreateObject("CDONTS.NewMail")
      oCDO.From = from
      oCDO.Value("Reply-To") = replyTo
      oCDO.to = recipee
      oCDO.Subject = subject
      oCDO.Body = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN""><html><head></head><body style=""font-family:verdana;font-size:9pt;background-color:#fffff0"">" & body & "</body></html>"
      oCDO.Importance = 2
      oCDO.MailFormat = 0
      oCDO.BodyFormat = 0
      oCDO.Send
      set oCDO = nothing
end Sub
How would  I use this code???

could you give me example oh how I could send an email using it???

thanks
I was thinking more of using a form with asp

thanks
Sorry, I don't have that kind of code. I was using CDONTS only for administrative notifications.
Were you able to set those Execute rights? Did it help?
I had set those rights prior to starting this thread
I had set those rights prior to starting this thread
Example of CDONTS - with a form.

Form has some basic validation for a few fields - on submitted the email is sent and a message is displayed saying the message was sent.

This page is functioning as works 'as is'.

Email_Form.asp  ===============================================================================================================
<%@ Language=VBScript %>
<%Option Explicit%>
<%
Dim objMail
Dim sForm(6), sEmail(1), sErrMsg, sBody
Dim iLp

sEmail(0) = "peter@internection.co.uk"
sEmail(1) = "proome@hotmail.com"

If Request.Form("B1") = "Submit" then
      sErrMsg = ""
      
      For iLp = 0 to 6
            sForm(iLp) = Trim(Request.Form("f_"&iLp))
      Next
      
      If sForm(1) = "" then
            sErrMsg = "ERROR: From - required."
      Else
            If sForm(2) = "" then
                  sErrMsg = "ERROR: Description - required."
            Else
                  If sForm(6) = "" then
                        sErrMsg = "ERROR: Message - required."
                  End If
            End If
      End If
      
      If sErrMsg = "" then
            sBody = ""
            sBody = sBody & "<!DOCTYPE HTML PUBLIC '-//IETF//DTD HTML//EN'>"
            sBody = sBody & "<html>"
            sBody = sBody & "<head>"
            sBody = sBody & "<title>Message...</title>"
            sBody = sBody & "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
            sBody = sBody & "</head>"
            sBody = sBody & "<body>"
            sBody = sBody & "<font face='Verdana' size='2' color='#000000'>"
            sBody = sBody & "You have received a message:<br><br>"
            sBody = sBody & "From: <b>" & sForm(1) & "</b><br><br>"
            sBody = sBody & "Description: <b>" & sForm(2) & "</b><br>"
            sBody = sBody & "Phone #: <b>" & sForm(3) & "</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ext #: <b>" & sForm(4) & "</b><br>"
            sBody = sBody & "Other #: <b>" & sForm(5) & "</b><br><br>"
            sBody = sBody & "The Message:<br>"
            sBody = sBody & "================================================<br>"
            sBody = sBody & "<b>" & sForm(6) & "</b>"
            sBody = sBody & "</font>"
            sBody = sBody & "</body>"
            sBody = sBody & "</html>"
                                    
            Set objMail = Server.CreateObject("CDONTS.NewMail")
            objMail.BodyFormat = 0
            objMail.MailFormat = 0
            objMail.To = sForm(0)
            objMail.From = sForm(1)
            objMail.Subject = "Message From " & sForm(0)
            objMail.Body = sBody
            objMail.Send
            
            For iLp = 0 to 6
                  sForm(iLp) = ""
            Next
            
            sErrMsg = "NOTICE: Message sent."
      End If
End If

%>
<html>

<head>
<title>Email</title>
</head>
<body>
<form method="POST" action="Email_Form.asp">
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400">
      <tr>
            <td colspan="3" height="30" align="center"><b>MESSAGE CENTRE</b></td>
      </tr>
      <%If sErrMsg <> "" then%>
            <tr>
                  <td colspan="3" height="25"><%=sErrMsg%></td>
            </tr>
      <%End If%>
      <tr>
            <td width="100" height="25" align="right">Message To:&nbsp;</td>
            <td colspan="2">
                  <select size="1" name="f_0">
                        <%For iLp = 0 to UBound(sEmail)
                              If sForm(0) = sEmail(iLp) then%>
                                    <option value="<%=sEmail(iLp)%>" selected><%=sEmail(iLp)%></option>
                              <%Else%>
                                    <option value="<%=sEmail(iLp)%>"><%=sEmail(iLp)%></option>
                              <%End If
                        Next%>
                  </select>
            </td>
      </tr>
      <tr>
            <td height="25" align="right">From:&nbsp;</td>
            <td colspan="2">
                  <input type="text" name="f_1" size="29" value="<%=sForm(1)%>">
            </td>
      </tr>
      <tr>
            <td height="25" align="right">Description:&nbsp;</td>
            <td colspan="2">
                  <input type="text" name="f_2" size="33" value="<%=sForm(2)%>">
            </td>
      </tr>
      <tr>
            <td height="25" align="right">Phone #:&nbsp;</td>
            <td><input type="text" name="f_3" size="18" value="<%=sForm(3)%>"></td>
            <td width="100">
                  Ext:&nbsp;<input type="text" name="f_4" size="6" value="<%=sForm(4)%>">
            </td>
      </tr>
      <tr>
            <td height="25" align="right">Other #:&nbsp;</td>
            <td colspan="2">
                  <input type="text" name="f_5" size="18" value="<%=sForm(5)%>">
            </td>
      </tr>
      <tr>
            <td colspan="3" height="25" align="center">Message:</td>
      </tr>
      <tr>
            <td colspan="3">
                  <textarea rows="6" name="f_6" style="WIDTH: 400; HEIGHT: 100"><%=sForm(6)%></textarea>
            </td>
      </tr>
      <tr>
            <td colspan="3" height="25" align="center">
                  <input type="submit" value="Submit" name="B1">
            </td>
      </tr>
</table>
</form>
</body>
</html>
==========================================================================================================================
Thanks for the code, but how come it isnt instant ? I still havent recieved the email.

Also how can i change the option value so instead of having an option a query string value ie someone's email address is used instead

Hope you can help thanks
Pungwick
You're running it from your machine is that right? Do you have the default SMTP server installed (its a windows component), it then need to be running. If its already there - do you have an either of the following folders on your machine:

C:\Inetpub\mailroot\Queue
C:\Inetpub\mailroot\Pickup

Look in here - if the emails are there then there is something not quite right with your SMTP services (providing they are running) - if there is a problem and they're not going I don't know what to suggest. Maybe you SMPT servers only scheduled to send mail every 15 mins - it could be a host of things.

Query: you need to change that according to your db....
<%'Do you connection
Set rsList = Server.CreateObject("ADODB.REcordSet")
sQuery = "SELECT EmailAddress FROM People"
rsList.Open sQuery, objCon

Put this bit in the form...
<select name="">
    <%Do while not rsList.EOF%>
          <option value="<%=rsList("EmailAddress")%>"><%=rsList("EmailAddress")%></option>
         <%rsList.MoveNext
      <%Loop%>
</select>

Hope that sorts you out :)
Hi there

The words SMTP server  seem to pop up again:) so in order to use CDonts must I have this set up??? If so would you be able to give me some advise on how I can so.

C:\Inetpub\mailroot\Queue - This folder exists and hols the email I sent using you code
C:\Inetpub\mailroot\Pickup - Exist also but is empty.

Hope you cn help
Thanks
I have opened up :

C:\Inetpub\mailroot\Badmail

and have a whole list of bad mail that has failed to get sent. Hope you can help thanks
I don't know what to suggest - i have other people look after things like mail and the like - i'm just a poor little programmer :)
hehehe :)

Seeing as tho you are that would you be kind enough to particpiate in another thread i started, yur programming knowledge will be of great assistance to me :)

thanks

https://www.experts-exchange.com/questions/20960141/ASP-Function.html

ASKER CERTIFIED SOLUTION
Avatar of Lord_McFly
Lord_McFly

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
Hi,

Just a last thing, when I try to send an email all the messages get queued. When i restart my machine the messages get send? I have disabled my anti virus but still have the same issue. I hope you can help , thanks.

Also have you had the chance to have a look at the code for the other thread :) The ponits for this question are yours :)

thanks
Pungwick
I didn't know which question it was so I went and put the 'Do you need... in all questions up until the 19th hoping that I would get some closed and identify any that I was still actively involved in, you've responsed - so I can get back on track now :)

As for the email not going - when do you disable your anti-virus software after you've started the machine or is it diabled permenently? It might be that the ports get blocked once you machine has booted up and after you disable anti-virus software.

Does you anti-virus sftware have integrated Firewall software as well - check that port 25 is not blocked (port emails are sent out on)
Any luck in sorting out the 'emails not sending' problem?

Cheers

McFly