private static bool InternalSendMail(EmailFunctions EmailFunction, List <string> To, string EmailSubject, string EmailContent, List <Attachment> Attachments, out string ErrorMessage)
        {
            try
            {
                MailMessage _Message = new MailMessage();
                _Message.Subject         = EmailSubject;
                _Message.SubjectEncoding = System.Text.Encoding.Unicode;
                _Message.Body            = EmailContent;
                _Message.BodyEncoding    = System.Text.Encoding.UTF8;
                _Message.IsBodyHtml      = true;
                _Message.Priority        = MailPriority.High;
                _Message.From            = new MailAddress(SystemConfigurations.GetSMTPProperty(EmailFunction, SMTPProperties.From));
                To.ForEach(m => { _Message.Bcc.Add(m); });
                Attachments.ForEach(attachment => { _Message.Attachments.Add(attachment); });
                SmtpClient Client = GetSmtpClient(EmailFunction);

                Client.Send(_Message);
                ErrorMessage = string.Empty;
                return(true);
            }
            catch (Exception exc)
            {
                ErrorMessage = exc.Message;
                return(false);
            }
        }
 private static SmtpClient GetSmtpClient(EmailFunctions EmailFunction)
 {
     return(new SmtpClient()
     {
         Host = SystemConfigurations.GetSMTPProperty(EmailFunction, SMTPProperties.Host),
         Port = int.Parse(SystemConfigurations.GetSMTPProperty(EmailFunction, SMTPProperties.Port)),
         EnableSsl = bool.Parse(SystemConfigurations.GetSMTPProperty(EmailFunction, SMTPProperties.EnableSSL)),
         UseDefaultCredentials = false,
         Credentials = new NetworkCredential(SystemConfigurations.GetSMTPProperty(EmailFunction, SMTPProperties.Username), SystemConfigurations.GetSMTPProperty(EmailFunction, SMTPProperties.Password)),
     });
 }