I was trying to send the email in kentico 8 using the following code but it is throwing the following error. error CS1061: 'CMS.MacroEngine.MacroResolver' does not contain a definition for 'SpecialMacros'
EmailMessage msg = new CMS.EmailEngine.EmailMessage(); EmailTemplateInfo eti = EmailTemplateProvider.GetEmailTemplate("EmailTemplateCodeName", CMSContext.CurrentSiteID);
MacroResolver mcr = new MacroResolver(); mcr.SpecialMacros = new String[,] { { "#macro#", "text" } }; //here you can specify text for multiple macros specified in template msg.EmailFormat = EmailFormatEnum.Both; msg.From = eti.TemplateFrom; //make sure this is specified in the template settings msg.Recipients = "name@domain.com"; msg.Subject = eti.TemplateSubject; EmailSender.SendEmailWithTemplateText(CMSContext.CurrentSiteName, msg, eti, mcr, true);
You don't have that property any more. Instead you do it like this:
var resolver = MacroResolver.GetInstance(); resolver.SetNamedSourceData(macros);
where macros is your string array.
macros
Please, sign in to be able to submit a new answer.