API Questions on Kentico API.
Version 5.x > API > Send emails from templates View modes: 
User avatar
Member
Member
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

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/23/2013 11:13:12 PM
   
RE:Send emails from templates
You might try running an update on your website using the KIM. If you're not at a place to run an update then install a new version of the site to get the DLL.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 6/24/2013 1:13:45 AM
   
RE:Send emails from templates
Hi,

Can you check the Bin folder in your installation? If you can confirm that there is no CMS.EmailProvider.dll file then please try installing the Kentico of your version again and after installation copy and paste the file to your original installation.

Let us know if you encounter any problems.

Kind regards,
Richard Sustek