daniel.wylie-nvinteractive.co
-
6/23/2013 6:46:23 PM
Send emails from templates
Hey,
Am trying to get Kentico to send an email and it's throwing errors - where do I get the missing DLL?
Here's the code var emailMessage = new EmailMessage { Recipients = "removedforthissample", From = "removedforthissample", Subject = "Test" };
EmailTemplateInfo emailTemplateInfo = EmailTemplateProvider.GetEmailTemplate("test", CMSContext.CurrentSiteID);
MacroResolver macroResolver = new MacroResolver { SpecialMacros = new[,] { { "#macro#", "text" } } };
emailMessage.EmailFormat = EmailFormatEnum.Both; EmailSender.SendEmailWithTemplateText(CMSContext.CurrentSiteName, emailMessage, emailTemplateInfo, macroResolver, true);
And here's the error
Message: Could not load file or assembly 'CMS.EmailProvider' or one of its dependencies. The system cannot find the file specified. Stack Trace: at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at CMS.EmailEngine.EmailSender.get_ProviderAssembly() at CMS.EmailEngine.EmailSender.get_ProviderObject() at CMS.EmailEngine.EmailSender.SendQueuedEmail(EmailInfo ei, Int32 userId)
Cheers, Daniel
|