Results 1 to 2 of 2

Thread: How do I test this?

  1. #1
    chumee
    Guest

    How do I test this?

    Hi ppl, its me again! This is the code i came up with for my program where I want to automatically send an email to users in a database on a given date:

    <html>
    <head><title>Who's birthday is it today?</title></head>
    <body>
    <%
    var1=now()
    var2=DatePart("m", var1) & "/"& DatePart("d", var1)
    'Date in m/d format

    Set MyConn=Server.CreateObject("ADODB.Connection")
    MyConn.Open "FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\birthday.dsn"
    Set Rs=MyConn.Execute("SELECT * FROM birthdayTable")

    while not Rs.EOF
    IF var2=Rs("Birthday") THEN
    'Dates in the table are also m/d format
    Response.write("<br>")
    name=Rs("Name")
    Response.write("&nbsp;&nbsp;"&name)
    mail=Rs("Email")
    Response.write("&nbsp;&nbsp;"&mail)
    Response.write("&nbsp;&nbsp;"&Rs("Birthday"))

    'Prints the name, email, birthday of the selected individual

    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = "Me"
    Mailer.FromAddress= someone@here.com
    Mailer.RemoteHost = "mail.emirates.net.ae"
    Mailer.AddRecipient name, mail
    Mailer.Subject = "Wishing you a happy birthday!"
    Mailer.BodyText = "Happy birthday to you!!!"

    If Mailer.SendMail Then
    Response.Write "Mail send success!"
    Else
    Response.Write "Mail send failure. Error was " & Mailer.Response
    End if

    END IF
    Rs.moveNext
    wend
    Rs.close
    MyConn.close
    %>
    </body>
    </html>

    But how do I test if it works from my local machine? Should I install ASPMailer? And I'm not sure of the remote host name I should use.

    Does anyone have any idea what I should do?
    chumee

  2. #2
    SG Enthusiast FunK's Avatar
    Join Date
    Aug 2000
    Posts
    2,721
    I would install the mailer or look into the default mailer for Winderz and write the code to match it....

    I take it that you are getting some kind of error? Post the error that you get when you try to run the script and have it mail out the message.

    Either that, or just load it on your remote server and see if it works from there. Use your own e-mail address in place of one in the database (remove database code for testing) and see if it send you the message. If so, then include the database portion.

    You could also include the year in the date. That way you could subtract the year the person was born from the current year and send Happy Slappy 21st birthday!!!!

    Then again, that would not be fun.......

    FunK
    Simply run adaware, spybot, ZoneAlarm, HijackThis, AVG, update windows daily, have a router, don't open e-mail, turn off action scripting, don't use P2P networks, don't violate EULAs, and wear a condom to get Windows secured.

    People say Linux is alot of work!

Bookmarks

Posting Permissions

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