Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <NotificationHandlerAssembly>MySharepointHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdabcdabcd</NotificationHandlerAssembly>
- <NotificationHandlerClassName>MySharepointHandler.MyNotifyHandler</NotificationHandlerClassName>
- public class MyNotifyHandler : IAlertNotifyHandler
- {
- public bool OnNotification(SPAlertHandlerParams ahp)
- {
- using (new SPMonitoredScope("MySharepointHandler.MyNotifyHandler OnNotification"))
- {
- using (SPSite site = new SPSite(ahp.siteUrl + ahp.webUrl))
- {
- using (SPWeb web = site.OpenWeb())
- {
- string to = ahp.headers["to"];
- if (to.IndexOf("@mydomain.com") < 0)
- {
- string NewBody = ahp.body;
- NewBody = NewBody.Replace(InternalURL, ExternalURL);
- SPUtility.SendEmail(web, ahp.headers, NewBody);
- }
- else
- {
- SPUtility.SendEmail(web, ahp.headers, ahp.body);
- }
- return true;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment