public EmailHeaderModel(EmailHeader EmailHeader) { _emailHeader = EmailHeader; }
/// <summary> /// Create a new EmailHeader object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="isEnabled">Initial value of the IsEnabled property.</param> /// <param name="imageName">Initial value of the ImageName property.</param> public static EmailHeader CreateEmailHeader(global::System.Guid id, global::System.String name, global::System.Boolean isEnabled, global::System.String imageName) { EmailHeader emailHeader = new EmailHeader(); emailHeader.ID = id; emailHeader.Name = name; emailHeader.IsEnabled = isEnabled; emailHeader.ImageName = imageName; return emailHeader; }
private static void ApplyMainTemplate(String correspondenceMessage, String mainTemplate, MailMessage message, EmailHeader emailHeader) { String messageBody = mainTemplate; messageBody = messageBody //.Replace("{#EmailHeader}", Properties.Settings.Default.CRMEmailHeader) .Replace("{#EmailHeader}", emailHeader != null && emailHeader.Content != null ? emailHeader.Content : string.Empty) .Replace("{#EmailFooter}", Properties.Settings.Default.CRMEmailFooter) .Replace("{#TemplateColor}", HexColorCodeFromRGB(Properties.Settings.Default.CRMEmailTemplateColor)) //.Replace("{#TemplateColor}", Properties.Settings.Default.CRMEmailTemplateColor != String.Empty ? Properties.Settings.Default.CRMEmailTemplateColor : "#550055") .Replace("{#Date}", String.Format("{0:dddd dd MMMM}", DateTime.Now)) .Replace("{#InternalTemplate}", correspondenceMessage) .Replace("{#HeaderImage}", "cid:headerImage") .Replace("{#FooterImage}", "cid:footerImage"); var appPath = (string)ApplicationSettings.Read("ImagesPath"); if (string.IsNullOrWhiteSpace(appPath)) return; //var fullPathHeaderImage = string.Concat(appPath, Properties.Settings.Default.CRMEmailHeaderImage); var fullPathHeaderImage = string.Concat(appPath, emailHeader != null && emailHeader.ImageName != null ? emailHeader.ImageName : string.Empty); var fullPathFooterImage = string.Concat(appPath, Properties.Settings.Default.CRMEmailFooterImage); AlternateView htmlView = AlternateView.CreateAlternateViewFromString(messageBody, Encoding.UTF8, "text/html"); if (File.Exists(fullPathHeaderImage)) { LinkedResource headerImage = new LinkedResource(fullPathHeaderImage, MediaTypeNames.Image.Jpeg); headerImage.ContentId = "headerImage"; htmlView.LinkedResources.Add(headerImage); } if (File.Exists(fullPathFooterImage)) { LinkedResource footerImage = new LinkedResource(fullPathFooterImage, MediaTypeNames.Image.Jpeg); footerImage.ContentId = "footerImage"; htmlView.LinkedResources.Add(footerImage); } message.AlternateViews.Add(htmlView); }
/// <summary> /// Deprecated Method for adding a new object to the EmailHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEmailHeaders(EmailHeader emailHeader) { base.AddObject("EmailHeaders", emailHeader); }