private void testEmail() { this.Invoke(new Action <bool>(progressIsMoving), true); sendMail mail = new sendMail(); try { mail.sendNow("Battery Notification Email Test", "Test email from Battery Notification"); logging.writeLog("Sent test email"); } catch (Exception ex) { MessageBox.Show("Error sending email.\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); logging.writeLog("Error sending email.\n" + ex.Message); } this.Invoke(new Action <bool>(progressIsMoving), false); }