Пример #1
0
 private static MailMessage Create(Email email)
 {
     var recipients = email.Recipients.Collect();
     return new MailMessage(email.From,
                            recipients,
                            email.Subject,
                            email.Body)
         {
             IsBodyHtml = true
         };
 }
Пример #2
0
        public void SendAsync(Email email)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(typeof (SmtpSender).FullName);
            }
            _completed.Reset();

            MailMessage message = Create(email);
            _smtpClient.SendAsync(message, email);
        }
Пример #3
0
 public void SendAsync(Email email)
 {
     ThreadPool.QueueUserWorkItem(SendInternal, email);
 }
Пример #4
0
        private Email Create(object model)
        {
            Type modelType = model.GetType();
            MailView view = _templateEngine.Render(model);
            string[] recipients = _mailingListBroker.GetRecepients(modelType).ToArray(); //TODO: избавиться от лишнего выделения массива

            var email = new Email(_fromAddress,
                recipients,
                view);

            return email;
        }