//Check for SMTP Service Using System.ServiceProcess ServiceController[] services = ServiceController.GetServices(); bool bServiceInstalled= false; ServiceController smtpServ = null; // Loop through all the services and find the SMTP Service. foreach(ServiceController service in services) { if (service.ServiceName.ToLower() == "smtpsvc") { bServiceInstalled = true; smtpServ = service; break; } } if (!bServiceInstalled) { MessageBox.Show ("SMTP Service is not installed on this " + "machine.", "SMTPService",MessageBoxButtons.OK); } else { //Start if it is not running if (smtpServ != null) { if (smtpServ.Status != ServiceControllerStatus.Running) { MessageBox.Show("SMTP Service not running..." + "Starting Service..."); try smtpServ.Start(); catch(Exception ex) MessageBox.Show(ex.Message,"SMTP Service", MessageBoxButtons.OK); } } }