Sitecore Email Campaign Manager 2.1 appears to get stuck on sending emails whenever New Relic Application Performance Monitoring (APM) with Real User Monitoring (RUM) is Enabled, if New Relic is disabled the Email Campaign Manager sends as usual. The following conditions are apparent when New Relic RUM is Enabled.
- No errors reported in the Sitecore Logs
- Request just stops processing and that thread id never shows up in the log again
- IIS Log shows return codes of 200 so no failures there either
- When performing an IIS reset sometimes the email is received but in a delayed fashion, such as 30 minutes after an IIS Reset
- Below are the logs with Sitecore ECM debug set to True:
2016-11-28 12:00:57 ManagedPoolThread #4 INFO Job started: Sending message (86B4501BEE95446BAD97171F3316226E) 2016-11-28 12:00:57 ManagedPoolThread #4 INFO EmailCampaign: 'SendAnEmail': 1 recipient is added to the queue. 2016-11-28 12:00:57 ManagedPoolThread #4 INFO EmailCampaign: Dispatch Message (SendAnEmail): Started 2016-11-28 12:00:57 2600 INFO EmailCampaign: BodyLink -> GetTargetItemUrl: 00:00:00.0150126 2016-11-28 12:00:57 2600 INFO EmailCampaign: Get body link: 00:00:00.0180269 2016-11-28 12:00:58 2600 INFO EmailCampaign: Download string content(url): 00:00:00.6559992 2016-11-28 12:00:59 2600 INFO EmailCampaign: ReplaceTokens -> Find/Add $title$ token: 00:00:00.6088072 2016-11-28 12:00:59 2600 INFO EmailCampaign: Replace tokens: 00:00:00 2016-11-28 12:00:59 2600 INFO EmailCampaign: Remove 'form' tag: 00:00:00.0157781 2016-11-28 12:00:59 2600 INFO EmailCampaign: Remove VIEWSTATE: 00:00:00 2016-11-28 12:00:59 2600 INFO EmailCampaign: Insert style sheets: 00:00:00 2016-11-28 12:00:59 2600 INFO EmailCampaign: Modify 'href' links: 00:00:00.0491805
This RUM block is improperly injected into the Email Templates within Sitecore as each page based email is assembled using Sitecore Presentation Details, when viewing the rendered source of the email the New Relic RUM Script is present is the source code.
To remove New Relic RUM from being injected into these emails while leaving Auto Instrumentation enabled the New Relic Agent API NuGet Package and the following C# snipped added to either the MVC View Layout or Web Forms Page_Load event to stop New Relic from injecting the Browser Monitoring.
This post on based on my StackOverflow Question titled Sitecore ECM 2.1 on Sitecore 7.2 Not Sending Emails when New Relic APM is Enabled.