Пример #1
0
        public void Notify(IEnumerable <Person> peopleWithBirthdayToday, IEnumerable <Person> peopleWithBirthdayInFuture)
        {
            var message = PrepareMessage(peopleWithBirthdayToday, peopleWithBirthdayInFuture);

            using (var client = new SmtpClient())
            {
                // accept all SSL certificates (in case the server supports STARTTLS)
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                client.Connect(Smtp, Port, true);
                client.Authenticate(From, LoginHandler.ReadPassword());

                if (Enabled)
                {
                    client.Send(message);
                }
                client.Disconnect(true);
            }
        }