public static Task <bool> sendToUser(User u, string subject, string body, string sender, string AttachmentPath = null, bool testflag = false)
        {
            bool success = false;

            Thread t = new Thread(() =>
            {
                try
                {
                    EmailNotifications.sendEmail(u, subject, body, sender, AttachmentPath);
                    success = true;
                }
                catch (Exception e)
                {
                    Console.WriteLine($"ERROR: Email could not send: {e}");
                    success = false;
                }
            });

            t.Priority = ThreadPriority.Lowest;
            t.Start();

            // If it is a unit test, we want to wait for the thread to finish running before returning a value
            if (testflag)
            {
                t.Join();
            }

            return(Task.FromResult(success));
        }
        public static Task <bool> sendToAllAdmins(string subject, string body, string sender = "*****@*****.**", bool testflag = false)
        {
            bool success = false;

            Thread t = new Thread(() =>
            {
                List <User> admins = new List <User>();
                if (testflag)
                {
                    // If you want physical proof that this tests, change the below fields to your own credentials
                    // I've already proven it works, so I took mine out. I don't like getting constant test emails.
                    // Or I guess you could create an account for good ol' Test User, but that's unnecessary in my opinion.
                    admins.Add(new User("Test", "User", "*****@*****.**", NotificationTypeEnum.ALL));
                }
                else
                {
                    admins = DatabaseOperations.GetAllAdminUsers();
                }

                foreach (User u in admins)
                {
                    if (u._Notification_Type == NotificationTypeEnum.ALL || u._Notification_Type == NotificationTypeEnum.EMAIL)
                    {
                        try
                        {
                            // All-admin notifications will always be sent from SYSTEM by default.
                            EmailNotifications.sendEmail(u, subject, body, sender);
                            success = true;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine($"ERROR: Email could not send: {e}");
                            success = false;
                        }
                    }
                }
            });

            t.Priority = ThreadPriority.Lowest;
            t.Start();

            // If it is a unit test, we want to wait for the thread to finish running before returning a value
            if (testflag)
            {
                t.Join();
            }

            return(Task.FromResult(success));
        }