Okay so what i want you to do is the following:
1: Create a new Email Template in Kentico (Kentico > Email Templates) , this will be your email to the administrator of a post. Set the code name for it to "NewMessageOnBoardToAdmin"
2: Create a new Class and place it in your App_Code folder called "CustomModuleLoader.cs" with the text below:
using CMS.Base;
using CMS.MessageBoards;
using CMS.Membership;
using CMS.EmailEngine;
using CMS.SiteProvider;
using CMS.EmailEngine;
[CustomModuleLoader]
public partial class CMSModuleLoader
{
/// <summary>
/// Attribute class that ensures the loading of custom handlers.
/// </summary>
private class CustomModuleLoaderAttribute : CMSLoaderAttribute
{
/// <summary>
/// The system executes the Init method of the CMSModuleLoader attributes when the application starts.
/// </summary>
public override void Init()
{
// Assigns custom handlers to events
BoardMessageInfo.TYPEINFO.Events.Insert.After += BoardMessageInsert_After;
}
void BoardMessageInsert_After(object sender, CMS.DataEngine.ObjectEventArgs e)
{
BoardMessageInfo MessageObject = (BoardMessageInfo)e.Object;
// Get the message board so we can get the author
BoardInfo BoardObject = BoardInfoProvider.GetBoardInfo(MessageObject.MessageBoardID);
// Get the Author user
UserInfo BoardAuthorObject = UserInfoProvider.GetUserInfo(BoardObject.BoardUserID);
// Build Email
EmailMessage EmailToBoardAdmin = new EmailMessage();
// Set the recipient to the board author
EmailToBoardAdmin.Recipients = BoardAuthorObject.Email;
// Send the email using the email template.
EmailSender.SendEmail(SiteContext.CurrentSiteName, EmailToBoardAdmin, "NewMessageOnBoardToAdmin", null, false);
}
}
}
For further reading, i would highly recommend you familiarize yourself with Kentico's Global Events.
https://docs.kentico.com/k82/custom-development/handling-global-events
Each Class's TYPEINFO has events for various tasks, this is an easy way to automate :)