Пример #1
0
 private void Email(double value, IAdapter adapter)
 {
     if ((DateTime.Now - timestamp).TotalSeconds < interval) return;
     try
     {
         SmtpClient client = new SmtpClient(server, port);
         client.EnableSsl = ssl;
         if (username != "")
             client.Credentials = new System.Net.NetworkCredential(username, password);
         MailMessage msg = new MailMessage(from, to, subject.Replace("{value}", value.ToString()), body.Replace("{value}", value.ToString()));
         client.Send(msg);
         timestamp = DateTime.Now;
     }
     catch (Exception e)
     {
         adapter.Debug(this, e);
     }
 }