How to send an email at certain intervals?

Hello,

I’m trying to write a simple Expert Advisor or Script that will send an overview of my current account status via an e-mail message.

However I want to run this EA or Script on a specific time. The only way I know is using the " OnTick() "function but that will be a nightmare because my mailbox will be flooded in no time. Is there a simple way to define a time frame? for example every 10 minutes there will be a status e-mail send.

Kind Regards,

//+------------------------------------------------------------------+
//|                                                       SendStatus |
//|                                  Copyright 2017, Ricardo de Jong |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+

void OnStart()
  {
   SendStatus();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SendStatus() //The name of the function for sending account information
  {
// SendMail function

   double AccountBalance=AccountInfoDouble(ACCOUNT_BALANCE);
   double AccountEquity=AccountInfoDouble(ACCOUNT_EQUITY);
   double AccountProfit=AccountInfoDouble(ACCOUNT_PROFIT);

   string sp="|"; // Using this as a spacer

   string header=(AccountBalance+sp+AccountEquity+sp+AccountProfit); // Using only the e-mail header information, no use for subtext.

   SendMail(header,"");
  }
//+------------------------------------------------------------------+

Run SendStatus() from the OnTimer() event, which you can set up for every 10 minutes using EventSetTimer().

It works, thank you!!