Sendin E-mail in ASP CDONTS Not working
Results 1 to 7 of 7

Thread: Sendin E-mail in ASP CDONTS Not working

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    102

    Sendin E-mail in ASP CDONTS Not working

    I'm learing ASP and I'm using IIS 5.1 . I believe the version that comes with XP Professional.
    In my book it tells me to use CDONTS.NewMail but I get this error.

    Server object error 'ASP 0177 : 800401f3'

    Server.CreateObject Failed

    /mailscript.asp, line 2

    Invalid class string

    Here is what my script looks like

    Code:
    <%
    Set Mail=Server.CreateObject("CDONTS.NewMail")
    Mail.To="july69@yahoo.com"
    Mail.From="Test@test.com"
    Mail.Subject="Testing Script"
    Mail.Body="Message Body is here"
    Mail.Send
    Set Mail=nothing
    %>

    Now Microsoft support said I think they said that XP Pro doesn't have the
    CDONTS.dll that I should use a different one but I don't seem to have that .dll either
    so what should I do? Did anyone have the same problem and find a
    solution? Would it work if I found the .dll from somewhere on the internet?
    I do have the mail server running because I thought that might be the problem but it wasn't
    Good Grief

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    324

    CDonts.dll

    Here y'go - a copy of cdonts.dll from my NT4 box. If you have any problems I'll see if I can find the 2k version. Let us know how you get on. The dll should live in you system32 directory.
    \"I may not agree with what you say, but I will defend to the death your right to say it.\"
    Sir Winston Churchill.

  3. #3
    Junior Member
    Join Date
    Dec 2001
    Posts
    3
    July,
    You need to declare "mail" as a varible:

    <%
    Dim mail
    Set Mail=Server.CreateObject("CDONTS.NewMail")
    Mail.To="july69@yahoo.com"
    Mail.From="Test@test.com"
    Mail.Subject="Testing Script"
    Mail.Body="Message Body is here"
    Mail.Send
    Set Mail=nothing
    %>

    Boomer

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    324
    Boomer > Only if you've got Option Explicit set.
    \"I may not agree with what you say, but I will defend to the death your right to say it.\"
    Sir Winston Churchill.

  5. #5
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    Are you completely sure you have the feature installed?

    If you haven't got the SMTP server installed, CDONTS won't be available. The one is linked to the other.

    Sounds to me like you didn't install the SMTP service. If your version of windoze doesn't support the SMTP service, CDONTS will never work on it (but AFAIK, all versions of NT/ 2k do)

    Don't bother copying cdonts.dll from someone else's box, that will lead to trouble. It won't be the right version, and it won't work anyway unless you have the SMTP service.

  6. #6
    Banned
    Join Date
    Jul 2001
    Posts
    264
    slarty is correct....you need to make sure the SMTP server is installed and running. Also make sure you have cscript.exe and wscript.exe installed in the %systemroot%.

    Also ntsa...declaring your variables is a standard in good programming practice. Even if not required, he should still be "diming" his variables.

  7. #7
    Senior Member
    Join Date
    Apr 2002
    Posts
    324
    Quad > Yes - I would actually recommend using option explicit in ALL code, so that you HAVE to declare your varaibles (saves hours of debugging in the long run).
    \"I may not agree with what you say, but I will defend to the death your right to say it.\"
    Sir Winston Churchill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •