Send mail at certain times

Back to topics list To post a new topic, please log in or register
avatar
11
fx_matt 2015.10.18 13:55
 

Does anyone know how I could send email alerts at certain times?

I am looking to do this every hour, the Sendmail function is easy enough but I'm stuck on a Time loop? 

 Thank you in advance 

avatar
735
honest_knave 2015.10.18 14:02 #
 

Lots of ways. Here is one:

int OnInit()
  {
   EventSetTimer(1);
   return(INIT_SUCCEEDED);
  }

.....

void OnTimer()
  {
   static int LastHour=-1;
   int ThisHour=TimeHour(TimeLocal());
   if(ThisHour!=LastHour)
     {
      SendMail("My Subject","My Message");
      LastHour=ThisHour;
     }
  }

 

 

avatar
12985
WHRoeder 2015.10.18 14:03 #
 
Check the current time vs the last sent time; no loop required.
avatar
11
fx_matt 2015.10.18 14:21 #
 
Great thanks
Back to topics list  

To add comments, please log in or register