Sitecore has no out-of-the-box provision to notify content authors when publishing gets completed or fails. Notifying users becomes very important when a longer publishing gets completed and, even more importantly, when it fails in order to remind them to publish it again.
In this recipe, you will learn how we can send e-mails to the publisher user on publishing completion using the publish:complete
event. After this, you will be able to send e-mails after publishing fails or expires.
We will first create an event handler class that will extract all publishing parameters and send an e-mail with publishing details:
In the
SitecoreCookbook
project, create a newSendEmail
class in thePublishing
folder.Create the
OnPublishComplete()
method as follows:public void OnPublishComplete(object sender, EventArgs args) { SitecoreEventArgs pubArgs = (SitecoreEventArgs)args; var optionsList = Event.ExtractParameter(pubArgs, 0) as...