private void SendEmail(object sender, RoutedEventArgs e) { var toAddresses = To.Text.Split(',').ToList(); var copyToAddresses = Copy.Text.Split(',').ToList(); var blindCopyToAddresses = BlindCopy.Text.Split(',').ToList(); MessageBox.Show("Email byl odeslán.", "Informace", MessageBoxButton.OK, MessageBoxImage.Information); MainController.Instance.SendEmail(toAddresses, Subject.Text, Body.Text, copyToAddresses, blindCopyToAddresses); To.Clear(); Copy.Clear(); BlindCopy.Clear(); Subject.Clear(); Body.Clear(); }
public Communication CreateCommunication(CopyItem copyItem) { var communication = new Communication { Id = Id, Definition = Definition, AffiliateId = AffiliateId, From = From, To = To, Copy = Copy == null ? null : Copy.Cast <ICommunicationRecipient>().ToList(), BlindCopy = BlindCopy == null ? null : BlindCopy.Cast <ICommunicationRecipient>().ToList(), Return = Return, Subject = copyItem.Text, Views = new List <CommunicationView>() }; foreach (var viewItem in copyItem.ViewItems) { if (viewItem.ResourceItems.Count == 0) { communication.Views.Add(new CommunicationView(viewItem.Text, viewItem.MimeType)); } else { communication.Views.Add(new CommunicationView(viewItem.Text, viewItem.MimeType, GetCommunicationResources(viewItem.ResourceItems))); } } // Look for temporary files. var tempFiles = GetTempFileAttachments(); if (tempFiles != null) { communication.AddAttachments(tempFiles); } // Look for permanent files. var attachments = GetAttachments(); if (attachments != null) { communication.AddAttachments(attachments); } return(communication); }