BLL.ActiveImagingTask.SendTaskErrorEmail C# (CSharp) Method

SendTaskErrorEmail() public static method

public static SendTaskErrorEmail ( Models task, string error ) : void
task Models
error string
return void
        public static void SendTaskErrorEmail(Models.ActiveImagingTask task, string error)
        {
            //Mail not enabled
            if (Settings.SmtpEnabled == "0") return;
            task.Computer = BLL.Computer.GetComputer(task.ComputerId);
            foreach (var user in BLL.User.SearchUsers("").Where(x => x.NotifyError == 1 && !string.IsNullOrEmpty(x.Email)))
            {
                if (task.UserId == user.Id)
                {
                    var mail = new Helpers.Mail
                    {
                        MailTo = user.Email,
                        Body = task.Computer.Name + " Image Task Has Failed. " + error,
                        Subject = "Task Failed"
                    };
                    mail.Send();
                }
            }
        }