public void SendMail_ShouldSent()
        {
            var pwd = new SecureString();
            "ПАРОЛЬ ОТ УЧЕТКИ".ToCharArray().ToList().ForEach(x=>pwd.AppendChar(x));

            var mailer = new MailSender(new SmtpConfig { Domain = "infotecs-nt", Password = pwd, SmtpServer = "mail2.infotecs.ru", UserName = "******"});
            mailer.Send("Test", "Hello world", new AdUser { Email = "*****@*****.**" }, new AdUser { Email = "*****@*****.**" });
        }
        public void SendMail_ToMultipleUsers_ShouldSent()
        {
            var pwd = new SecureString();
            "rhfcyfzcnhsuf123".ToCharArray().ToList().ForEach(x => pwd.AppendChar(x));

            var mailer = new MailSender(new SmtpConfig { Domain = "infotecs-nt", Password = pwd, SmtpServer = "mail2.infotecs.ru", UserName = "******" });
            mailer.Send("Test", "Hello world", new AdUser { Email = "*****@*****.**" },
                new AdUser { Email = "*****@*****.**" },
                new AdUser { Email = "*****@*****.**" },
                new AdUser { Email = "*****@*****.**" },
                new AdUser { Email = "*****@*****.**" });
        }
        public ActionResult SendReviewRequest(MarkRequest request)
        {
            requestRepository.CreateMarkRequest(request);

            if (request.ExpirationDate == DateTime.MinValue)
            {
                request.ExpirationDate = GetDefaultExpirationDate();
            }

            SecureString pwd = new SecureString();
            WebConfigurationManager.AppSettings["SmtpPassword"].ToCharArray().ToList().ForEach(x => pwd.AppendChar(x));

            var sender = new MailSender(new SmtpConfig
            {
                Domain = WebConfigurationManager.AppSettings["SmtpDomain"],
                SmtpServer = WebConfigurationManager.AppSettings["SmtpServer"],
                Password = pwd,
                UserName = WebConfigurationManager.AppSettings["SmtpLogin"]
            });

            var connector = new AdConnector();

            var currentUser = connector.GetUserById(System.Environment.UserName);
            var fromUser = connector.GetUserById(request.From);
            var toUser = connector.GetUserById(request.To);

            string subject = string.Format("{2} просит оценить сотрудника {0} до {1}", toUser.FullName, request.ExpirationDate.ToShortDateString(), currentUser.FullName);
            string body = String.Format("Для оценки пройдите по ссылке: {0}", string.Format("{0}://{1}{2}/ReviewRequestForMe", Request.Url.Scheme, Request.Url.Authority, Url.Content("~")));

            sender.Send(subject, body, currentUser, toUser);

            return Json("", JsonRequestBehavior.AllowGet);
        }