-
Hi
I am wrighting a program that needs to send an email once a day. My problem is that it needs to happen only when an internet connection is present. I know how to test and see if the connection is there and I know how to send the email My problem is how to get the program which will be running all the time to send an only oce a day when connected. The computer may not connect everyday nor will it be the same times everyday.
Any help would be appreciated.
PAul
-
how about having a code in the timer that checks to see if an internet connection is present ... if it is then make ur program send the email ... then have it write the date to a text file ... that way you can check to see if an email was sent for that day or not ...
-
If your program is running all the time, then you might as well set a variable with the date you sent the email. When you check for a connection, say, every hour, also compare the current date with the one in the variable, If you have a connection, and the dates do NOT compare, send an e-mail. Actually, you'd only compare dates, when you have a connection. No need to compare dates if you don't have a connection. :)
Or, write the last sent date to the registry:
Code:
'To save
SaveSetting App.Title, "Email", "LastSent", Now
'To retrieve
LastSent = CDate(GetSetting(App.Title, "Email", "LastSent", DateAdd("d", -2, Now))
'If there is no setting to retrieve, you'll probably want to sent
'the email, since no LastSent date was saved.
'Therefore we set the default date to today - 2 days
[Edited by r0ach on 11-22-2000 at 03:02 AM]