public void SendMail() { var emails = db.Emails.ToList(); foreach (var email in emails) { //code for sending mail here... if (!EmailSenderContext.CanSend()) { break; } } }
public void StopMail() { EmailSenderContext.ChangeSendState(false); }