private void btnSend_Click(object sender, EventArgs e) { if (IsSending == false) { // Validate user input try { InputValidation(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } IsSending = !IsSending; Utility.ThreadHelper.ThreadHelper.DelProcess ProcessDelegate = new SMTP.Utility.ThreadHelper.ThreadHelper.DelProcess(this.SendMailProcess); Utility.ThreadHelper.ThreadHelper.StandardParameters sParams = new SMTP.Utility.ThreadHelper.ThreadHelper.StandardParameters(); threadSendMail = new SMTP.Utility.ThreadHelper.ThreadHelper(ProcessDelegate); threadSendMail.Run(sParams); //threadSendMail = new Thread(new ThreadStart(SendMail)); //threadSendMail.Start(); } else { this.CancelSending(); } }