public void TestInvalidEmail()
        {
            //---------------Set up test pack-------------------
            string[] recipients = { "to" };
            EmailSender sender = new EmailSender(recipients, "from", "subject", "content", "attach");

            //---------------Execute Test ----------------------
            try
            {
                sender.Send();
                Assert.Fail("Expected to throw an Exception");
            }
                //---------------Test Result -----------------------
            catch (Exception)
            {
            }
        }
            private void SendErrorMessage(IDictionary dictionary, string emailContent)
            {
                string smtpServer = (string)dictionary["smtp_server"];
                string emailTo = (string)dictionary["email_to"];
                string[] emailAddresses = emailTo.Split(new char[]{';'});

                string emailFrom = (string)dictionary["email_from"];

                //string emailContent = ExceptionUtilities.GetExceptionString(_exception, 0, true);

                EmailSender emailSender = new EmailSender(emailAddresses, emailFrom, _exception.Source, emailContent, "");
                ////Todo : check Send Authenticated for security purposes?
                
                emailSender.SmtpServerHost = smtpServer;
                string port = (string)dictionary["smtp_port"];
                if (!String.IsNullOrEmpty(port))
                {
                    emailSender.SmtpServerPort = Convert.ToInt32(port);
                }
                bool enableSSL = Convert.ToBoolean(dictionary["smtp_enable_ssl"]); 
                emailSender.EnableSSL = enableSSL;
                emailSender.Send();
            }
            private void EmailErrorClickHandler(object sender, EventArgs e)
            {
                try
                {
                        
                    string emailTo = GlobalRegistry.Settings.GetString("EMAIL_TO");
                    string[] emailAddresses = emailTo.Split(new char[] { ';' });
                    string emailFrom = GlobalRegistry.Settings.GetString("EMAIL_FROM");

                    string emailContent = ExceptionUtilities.GetExceptionString(_exception, 0, true);

                    EmailSender emailSender = new EmailSender(emailAddresses, emailFrom, _exception.Source, emailContent, "");
                    //Todo : check Send Authenticated for security purposes?
                    emailSender.SmtpServerHost = GlobalRegistry.Settings.GetString("SMTP_SERVER");
                    string port = GlobalRegistry.Settings.GetString("SMTP_SERVER_PORT");
                    if (!String.IsNullOrEmpty(port))
                    {
                        emailSender.SmtpServerPort = Convert.ToInt32(port);
                    }
                    bool enableSSL = GlobalRegistry.Settings.GetBoolean("SMTP_ENABLE_SSL");
                    emailSender.EnableSSL = enableSSL;
                    //string authUsername = GlobalRegistry.Settings.GetString("SMTP_AUTH_USERNAME");
                    //string authPassword = GlobalRegistry.Settings.GetString("SMTP_AUTH_PASSWORD");
                    //if (!String.IsNullOrEmpty(authPassword))
                    //{
                    //    authPassword = Encryption.Decrypt(authPassword);
                    //}
                    //if (!String.IsNullOrEmpty(authUsername))
                    //{
                    //    emailSender.SendAuthenticated(authUsername, authPassword);
                    //}
                    //else
                    //{
                    emailSender.Send();
                    //}
                }
                catch(Exception ex)
                {
                    MessageBox.Show("The error message was not sent due to the following error : " + Environment.NewLine + ex.Message);
                }
            }