umbraco/Umbraco-CMS — pull request #154 by Jeavon (2013-10-09 18:07:08+00:00)
Title: U4-3080 - Fix for Umbraco notifications without HttpContext

Fix to be able to trigger Umbraco notifications without having access to HttpContext. Currently if you use the v6 API you cannot trigger the notifications due to the lack of HttpContext causes a exception.
So this pull request introduces a new optional setting to umbracoSettings.config name hostDomain within the notifications section, if this setting is present it will be used for all notifications email links, if the setting is empty or not present it will use HttpContext as it did previously.
While not ideal as you have to create a legacy Document, you can now trigger the notifications if you set your host in hostDomain, e.g:

private void ContentService_Saved(IContentService sender, Umbraco.Core.Events.SaveEventArgs e)
{
foreach (var contentDoc in e.SavedEntities)
{
var legacyDoc = new Document(contentDoc.Id);
var legacyUser = new User(5);
umbraco.cms.businesslogic.workflow.Notification.GetNotifications(
legacyDoc,
legacyUser,
ActionSave.Instance);
}
}

A little more info about the issue here http://our.umbraco.org/forum/developers/api-questions/45290-v6-API-Content-Service-doesnt-trigger-Umbraco-notifications