Kentico CMS provides many features and modules that utilize e-mail messages as part of their functionality . For using that we first need to configure SMTP servers for that . Below given are simple steps to configure and use email system of Kentico CMS :
2. Now go the KenticoSiteManager -> Administration -> System -> Email Tab and check whether the SMTP settings that you have given are there or not . If it is there just enter other details for Email testing and click the “Send” button at the bottom .
If all settings will be fine it will send an email on the specified email-id .
Now we will see how can we use this setting in our code :
Suppose you want to send an email to admin of the website after collecting a note from a user . (Below given is C# code for that function)
CMS.EmailEngine.EmailMessage em = new CMS.EmailEngine.EmailMessage();
em.EmailFormat = CMS.EmailEngine.EmailFormatEnum.Html;
// This is getting email of admin from the user settings
CMS.SiteProvider.UserInfo ui = CMS.SiteProvider.UserInfoProvider.GetUserInfo("administrator");
em.From = TextBoxIDUserEmail.Value;
em.Recipients = ui.Email;
em.Subject = "Note";
string name = TextBoxIDUserName.Value;
em.Body = TextBoxIDUserNote.Value;
//This sends the email