0

I have this thread:

public static Thread BGtimer = new Thread(() =>
        {
            TimeoOutAction action = new TimeoOutAction();
            string CurrentTime = "";
            while (true)
            {
                CurrentTime = DateTime.Now.ToString("HH:mm:ss");
                if (CurrentTime == "10:10:00") {
                    action.SendTimeOutResult("");  
                }                
            }
        });
public class TimeoOutAction
    {

        
        public void SendTimeOutResult(string type)
        {
            WebMail.Send("email", "", "", null, null, null, false, null, null, null, null, null, null);

        }
    }

When I run this code it give this error at WebMail.Send()

object reference not set to an instance of an object.

The same WebMail.Send() method works when its not being called from a thread on other parts but here it gives the error, any help would be appreciated.

0 Answers0