Beispiel #1
0
        /// <summary>
        /// Выполнить задачу
        /// </summary>
        /// <returns></returns>
        public SentState DoTask()
        {
            SentState resultState = MailSenderService.SendMails();

            IsActual = false;
            return(resultState);
        }
Beispiel #2
0
        /// <summary>
        /// Отправка почты внешнему списку адресатов
        /// </summary>
        /// <param name="recipients">список адресатов</param>
        /// <returns></returns>
        public SentState SendMails(IQueryable <Recipient> recipients)
        {
            SentState tmpState = new SentState("Не указаны получатели", false);

            if (recipients.Count() > 0)
            {
                foreach (var item in recipients)
                {
                    tmpState = SendMail(item.email, item.name);
                    if (!tmpState.IsOk)
                    {
                        throw new InvalidOperationException(tmpState.Message);
                    }
                }
            }
            return(tmpState);
        }