Results 1 to 6 of 6

Thread: ASP & cdo nts

  1. #1

    Thread Starter
    Hyperactive Member DaveR's Avatar
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    268

    Red face ASP & cdo nts

    I'm trying to send an email from my asp page.
    Using Interdev / iis 4 / VB

    The code i'm using is as follows
    ********************************
    Sub Button3_onclick()

    Set objSendMail = CreateObject("CDONTS.NewMail")
    With objSendMail
    .From = "[email protected]"
    .To = "[email protected]"
    .Subject = "Testing ASP cdonts"
    .Body = "This is a test of sending email from ASP."
    .Send
    End with
    Set objSendMail = Nothing
    End Sub

    **********************8

    I have referenced the CDO for NTS 1.2 library in the project.
    No errors are generated , its just nothing is happening , no emails , nothing.

    Any ideas let me know?


    DaveR

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Make sure the Button3_onclick() sub gets called (on the server side, not by clicking buttons on the client side).
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Hyperactive Member DaveR's Avatar
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    268
    i'm a newbie to asp ,
    can you explain how to call the sub from the server side.
    DaveR

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    There aren't events in ASP like there are in VB. (There's a handful bases on server events). ASP processes code from the top of your code to the bottom. So to call a sub, just have it in the <%

    Ex:
    Code:
    <%
    Option Explicit
    
    Response.Write "<html><body>" & vbcrlf
    
    'write a word three times
    WriteThreeTimes("Word")
    
    Response.Write "</body></html>" & vbcrlf
    
    Sub WriteThreeTimes(word)
        Response.Write word & vbcrlf word & vbcrlf word & vbcrlf
    End Sub
    
    %>
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5

    Thread Starter
    Hyperactive Member DaveR's Avatar
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    268
    what i'm doing now is as follows

    sub button_click()
    Page2.navigateURL("mail.asp")
    end sub

    ---then the code for mail.asp is

    <%@language=vbscript%>
    <%
    Set objSendMail = server.CreateObject("CDONTS.NewMail")
    With objSendMail
    .From = "[email protected]"
    .To = "[email protected]"
    .Subject = "Testing ASP cdonts"
    .Body = "This is a test of sending email from ASP."
    .Send
    End with
    Set objSendMail = Nothing

    response.write "Your email has been sent."
    %>

    *****************************88
    in theory this should work , as the mail routine is being called from the server side.

    Unfortunately for me it still aint doing anything.

    any ideas??




    DaveR

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    That looks okay to me. You not getting any errors, right? Are you just not getting the mail? Check the configuration of the SMTP service on your server, then make sure it can relay the mail.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

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



Click Here to Expand Forum to Full Width