Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Nottingham - UK

    Wink Unanswered: Cdonts Email Test System

    Hi Folks - im wondering if its posssible to have a CDONTS email sent evey 30 mins for example sent as a test automatically just letting me know the email facility is happy and well?

    Im using MS WIndows 2003 Standard, IIS 6 etc.

    Thanks in advance


  2. #2
    Join Date
    Mar 2006
    south jersey, usa
    you can either write a asp script to send the email and force the client to refresh the page every 30 mins or write a vbscript to send the email and setup a schedules task to run the script every thirty minutes.

    here's a email script i use at work to notify me when a scheduled server reboot occurs

    <% Option Explicit %>
    dim conn, rs, routefile, mname, mfunct, mip, query
    routefile = "\\sus\tasks\restartsched\servers.mdb"
    sub openconn ' open a connection to access db'
      dim tries
      set conn = CreateObject("ADODB.Connection") 'prep connection'
      set rs = CreateObject("ADODB.Recordset") ' prep recordset'
      tries = 0 ' clear tries counter'
      do 'try to open connection to the db "DRIVER={Microsoft Access Driver (*.mdb)};" &_ 
                  "DBQ=" & RouteFile & ";DefaultDir=;UID=;PWD=;"
        tries = tries + 1
        if (err.number <> 0) then 'if errored, close this connection
        end if
      Loop While (Err.Number<>0) And tries < 10 'if errored, try again. MAX TRIES = 10
    end sub
    sub closeconn ' close the connection to the db
      set rs = nothing
      set conn = nothing
    end sub
    sub main
    response.write request.servervariables("REMOTE_ADDR") & "<br>"
    mip = trim(request.servervariables("REMOTE_ADDR"))
    query = "Select ipaddress, machinename, function from irschedl where ipaddress = '" &_
            mip & "'" query, conn
    if err.number<>0 then 
      response.write "An error has occurred while trying to execute a query - " & query & "<BR>" & Err.description
      if rs.eof then
        mname = "Machine Name Not Found In DB"
        response.write rs.fields("ipaddress") & " - " & mip & "<BR>"
        mname = rs.fields("machinename")
        mfunct = rs.fields("function")
      end if
           Dim MyEmail
           Set MyEmail = Server.CreateObject("CDONTS.NewMail")
           MyEmail.From = ""
           MyEmail.To = ";"
           'MyEmail.To = "cxxxxs@xxxx"
           MyEmail.Subject = mname & " Restarted"
           MyEmail.Body = mname & " was restarted successfully. The database for server names & ips is located at " &_
                          routefile & " This machine runs " & mfunct
           Set MyEmail = Nothing 
           response.write "email sent"
    end if
    end sub 'end main       
    <script type="text/javascript">
    <p><input type="button" onclick="window.close()" value="Close Window"></p>
    "They say Moses split the Red Sea
    I split the blunt and rolled the fat one, I'm deadly"
    -- Tupac 'Blasphemy'

Posting Permissions

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