Troubleshooting CRM E-Mail Issues in Microsoft CRM 4.0
Hi all,
After my post about the CRM Router Logging, I wanted to give you some examples about how to use CRM Platform trace and Router Logging to troubleshoot and fix pretty much all CRM E-Mail Issues.
- To see how enabling platform trace, please check this article or use CrmDiagTool4:
- To see how to enable Router Logging, please check this article:
(NOTE: you may need to copy the content of this article and paste it in WORD or Outlook to see the carriage return correctly, the Platform traces might be hard to read here like this.)
Here are some concrete examples of analysis.
Symptom : Incoming E-Mails for CRM Users do not appear in CRM Application. (Incoming E-mails are not tracked in CRM)
EXAMPLE #1 :
I’ve sent an Email from External network to one of my CRM User. The email subject is “unknown mail”. You just need now to track this subject in the different log files.
CRM E-Mail Router LogFile:
05/05/2008 10:54:52 : #20669 - Checking for e-mail messages to process in mailbox Administrator@Titan.co.uk.
05/05/2008 10:54:52 : #49073 - Validating the e-mail message with subject "unknown mail" from "externaluser" <externaluser@Titan.co.uk> to "Administrator" <Administrator@Titan.co.uk> for delivery to Administrator@Titan.co.uk.
05/05/2008 10:54:52 : #1866 - Checking the e-mail message with subject "unknown mail" in mailbox Administrator@Titan.co.uk for delivery to https://l2003vpc:5555/TrevorsBangers.
05/05/2008 10:54:52 : #60263 - The e-mail message with subject "unknown mail" in mailbox Administrator@Titan.co.uk for delivery to https://l2003vpc:5555/TrevorsBangers was rejected .
05/05/2008 10:54:52 : #20669 - Checking for e-mail messages to process in mailbox Administrator@Titan.co.uk.
05/05/2008 10:54:52 : #53362 - There are no more e-mail messages to process in mailbox Administrator@Titan.co.uk.
05/05/2008 10:54:52 : #19780 - Closing mailbox Administrator@Titan.co.uk.
CRM Platform trace:
SOAP Xml:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema">
<soap:Header>
<CrmAuthenticationToken xmlns="https://schemas.microsoft.com/crm/2007/WebServices">
<AuthenticationType xmlns="https://schemas.microsoft.com/crm/2007/CoreTypes">0</AuthenticationType>
<OrganizationName xmlns="https://schemas.microsoft.com/crm/2007/CoreTypes">TrevorsBangers</OrganizationName>
<CallerId xmlns="https://schemas.microsoft.com/crm/2007/CoreTypes">00000000-0000-0000-0000-000000000000</CallerId>
</CrmAuthenticationToken>
</soap:Header>
<soap:Body>
<Execute xmlns="https://schemas.microsoft.com/crm/2007/WebServices">
<Request xsi:type="CheckIncomingEmailRequest">
<MessageId><C7A125AC9281B74DA34740FDFC303F929E81@l2003vpc.Titan.co.uk></MessageId>
<Subject>unknown mail</Subject>
<From>"externaluser" <externaluser@Titan.co.uk></From>
<To>"Administrator" <Administrator@Titan.co.uk></To>
<Cc />
<Bcc />
</Request>
</Execute>
</soap:Body>
</soap:Envelope>
>Email delivery found a user or queue recipient who accepts e-mails based on correlation to an existing record (subject: unknown mail).
[2008-05-05 10:54:52.5] Process: w3wp |Organization:fddac4a2-c99e-422e-a859-5437eecc8cd4 |Thread: 7 |Category: Platform |User: 07e7e59a-caf9-4d20-874c-d33df1488fed |Level: Verbose | TrackingManager.GetTrackingData
at TrackingManager.GetTrackingData(String subject, String[] emailAddresses, TrackingOptions trackingOptions)
at EmailService.CheckIncoming(String messageId, String subject, String from, String to, String cc, String bcc, ExecutionContext context, Int32& reasonCode)
at RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
>Email tracking did not find a match or full matching was not requested (subject: unknown mail).
>Email delivery found no recipient user or queue who accepts this e-mail and the e-mail will be rejected (subject: unknown mail).
Here you see the E-Mail has been rejected (will not be tracked in CRM).
The CRM platform trace shows us the cause of this error, the latest thing we’ve checked here before raising the error is the Tracking Token of the E-Mail (TrackingManager.GetTrackingData() ).
It seems like the tracking token is the problem here.
Now let’s have a look at the User’s Personal Options in CRM.
Here is how it’s set (default settings):
The option is set to only accept E-Mail which are already part of an existing CRM conversation. In my test I only sent from external a simple regular mail (no-CRM), this is why It has been rejected.
We shall set any of the two other option to address the issue.
EXAMPLE #2 :
I’ve sent an Email from External network to one of my CRM User. The email subject is “unknown sender”. You just need now to track this subject in the different log files.
The Router log is the same as in EXAMPLE #1, all we need is the platform trace.
CRM Platform trace:
>Email delivery found a user or queue recipient who accepts e-mails based on whether the sender is an account / contact / etc. (subject: Unknown Sender).
>select contact0.ContactId as 'contactid', contact0.StateCode as 'statecode', contact0.EMailAddress1 as 'emailaddress1', contact0.EMailAddress2 as 'emailaddress2', contact0.EMailAddress3 as 'emailaddress3' from Contact as contact0 where ((contact0.DeletionStateCode in (0)) and ((((contact0.EMailAddress1 in ('externaluser@Titan.co.uk')) or (contact0.EMailAddress2 in ('externaluser@Titan.co.uk')) or (contact0.EMailAddress3 in ('externaluser@Titan.co.uk'))))))
[2008-05-05 11:08:56.4] Process: w3wp |Organization:fddac4a2-c99e-422e-a859-5437eecc8cd4 |Thread: 1 |Category: Platform.Sql |User: 07e7e59a-caf9-4d20-874c-d33df1488fed |Level: Info | CrmDbConnection.InternalExecuteReader
at CrmDbConnection.InternalExecuteReader(IDbCommand command)
at CrmDbConnection.ExecuteReader(IDbCommand command, Boolean impersonate)
at CrmDbConnection.ExecuteReader(IDbCommand command)
at BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context)
at BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, ExecutionContext context)
at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)
at AddressManager.ResolveToRecordType(AddressEntry[] addressEntries, ResolutionOptions resolutionOptions)
at AddressManager.ResolveToContacts(AddressEntry[] addressEntries)
at AddressManager.ResolveToExternalEntities(AddressEntry[] addressEntries)
at EmailService.CheckIncoming(String messageId, String subject, String from, String to, String cc, String bcc, ExecutionContext context, Int32& reasonCode)
>select account0.AccountId as 'accountid', account0.StateCode as 'statecode', account0.EMailAddress1 as 'emailaddress1', account0.EMailAddress2 as 'emailaddress2', account0.EMailAddress3 as 'emailaddress3' from Account as account0 where ((account0.DeletionStateCode in (0)) and ((((account0.EMailAddress1 in ('externaluser@Titan.co.uk')) or (account0.EMailAddress2 in ('externaluser@Titan.co.uk')) or (account0.EMailAddress3 in ('externaluser@Titan.co.uk'))))))
[2008-05-05 11:08:56.4] Process: w3wp |Organization:fddac4a2-c99e-422e-a859-5437eecc8cd4 |Thread: 1 |Category: Platform.Sql |User: 07e7e59a-caf9-4d20-874c-d33df1488fed |Level: Info | CrmDbConnection.InternalExecuteReader
at CrmDbConnection.InternalExecuteReader(IDbCommand command)
at CrmDbConnection.ExecuteReader(IDbCommand command, Boolean impersonate)
at CrmDbConnection.ExecuteReader(IDbCommand command)
at BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context)
at BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, ExecutionContext context)
at BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)
at AddressManager.ResolveToRecordType(AddressEntry[] addressEntries, ResolutionOptions resolutionOptions)
at AddressManager.ResolveToAccounts(AddressEntry[] addressEntries)
at AddressManager.ResolveToExternalEntities(AddressEntry[] addressEntries)
at EmailService.CheckIncoming(String messageId, String subject, String from, String to, String cc, String bcc, ExecutionContext context, Int32& reasonCode)
etc..
>Email delivery found no recipient user or queue who accepts this e-mail and the e-mail will be rejected (subject: Unknown Sender).
We see here before raising the error we are trying to see if the E-Mail address of the sender ('externaluser@Titan.co.uk') Is registered to be used by an existing Account, Contact or Lead in CRM.
Then we reject the E-Mail.
If we have a look at the user E-Mail options (see EX#1) we see the option is set to Track only “E-mail messages from CRM Leads, Contacts and Accounts”.
This is not the case here as Externaluser is unknown, so we reject the E-Mail.
Symptom : Incoming E-Mails do not appear in CRM Queue (E-Mails are moved to undeliverable folder of the Queue Inbox).
EXAMPLE #1 :
I’ve sent an Email from External network to one of my CRM Queue. The email subject is “IncomingMailToQueueEx3”. You just need now to track this subject in the different log files.
CRM E-Mail Router LogFile:
05/05/2008 11:53:38 : #20669 - Checking for e-mail messages to process in mailbox crmqueue@Titan.co.uk.
05/05/2008 11:53:38 : #49073 - Validating the e-mail message with subject "IncomingMailToQueueEx3" from "externaluser" <externaluser@Titan.co.uk> to "crmqueue" <crmqueue@Titan.co.uk> for delivery to crmqueue@Titan.co.uk.
05/05/2008 11:53:38 : #1866 - Checking the e-mail message with subject "IncomingMailToQueueEx3" in mailbox crmqueue@Titan.co.uk for delivery to https://l2003vpc:5555/TrevorsBangers.
05/05/2008 11:53:38 : #9466 - Accepting the e-mail message with subject "IncomingMailToQueueEx3" in mailbox crmqueue@Titan.co.uk for delivery to https://l2003vpc:5555/TrevorsBangers.
05/05/2008 11:53:38 : #46519 - Delivering the e-mail message with subject "IncomingMailToQueueEx3" in mailbox crmqueue@Titan.co.uk for delivery to https://l2003vpc:5555/TrevorsBangers.
05/05/2008 11:53:39 : #9628 - An error occurred while delivering the e-mail message with subject "IncomingMailToQueueEx3" in mailbox crmqueue@Titan.co.uk for delivery to https://l2003vpc:5555/TrevorsBangers. System.Web.Services.Protocols.SoapException: Server was unable to process request.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.Sdk.Proxy.CrmService.Execute(Request Request)
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.DeliverMessageInternal(EmailMessage emailMessage)
at Microsoft.Crm.Tools.Email.Providers.ExchangePollingMailboxProvider.DeliverMessageInternal(EmailMessage emailMessage)
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.DeliverMessage(EmailMessage emailMessage)
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.Run()\r\n
0x80040b05
At least one system user or queue in the organization must be a recipient
Platform
At least one system user or queue in the organization must be a recipient
at Microsoft.Crm.ObjectModel.EmailService.Deliver(Boolean userPromote, Guid emailId, String messageId, String subject, String from, String to, String cc, String bcc, DateTime receivedOn, String submittedBy, String importance, String body, BusinessEntityCollection attachments, Guid campaignResponseId, ExecutionContext context)
at Microsoft.Crm.ObjectModel.EmailService.DeliverIncoming(String messageId, String subject, String from, String to, String cc, String bcc, DateTime receivedOn, String submittedBy, String importance, String body, BusinessEntityCollection attachments, ExecutionContext context)
InnerException Type:Microsoft.Crm.CrmException
05/05/2008 11:53:39 : #30463 - Moving the e-mail message with subject "IncomingMailToQueueEx3" in mailbox crmqueue@Titan.co.uk to the undeliverable folder because it has been marked as undeliverable.
CRM Platform trace:
>select queue0.QueueId as 'queueid', queue0.EMailAddress as 'emailaddress', queue0.PrimaryUserId as 'primaryuserid', queue0.IncomingEmailFilteringMethod as 'incomingemailfilteringmethod', queue0.PrimaryUserIdDsc as 'primaryuseriddsc', queue0.PrimaryUserIdYomiName as 'primaryuseridyominame', queue0.PrimaryUserIdName as 'primaryuseridname' from Queue as queue0 where ((queue0.DeletionStateCode in (0)) and ((((queue0.EMailAddress in ('crmqueue@Titan.co.uk'))))))
[2008-05-05 11:53:38.8] Process: w3wp |Organization:fddac4a2-c99e-422e-a859-5437eecc8cd4 |Thread: 7 |Category: Exception |User: 07e7e59a-caf9-4d20-874c-d33df1488fed |Level: Error | CrmException..ctor
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException, Boolean enableTrace)
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)
at CrmException..ctor(String message, Int32 errorCode)
at CrmSecurityException..ctor(String message, Int32 errorCode)
at SecurityLibrary.TryCheckPrivilege(Guid user, Guid privilege, ExecutionContext context)
at SecurityLibrary.CheckPrivilege(Guid user, Guid privilege, ExecutionContext context)
at AddressManager.GetOwnerCandidate(AddressEntry addressEntry, BusinessEntity businessEntity)
at AddressManager.ResolveToRecordType(AddressEntry[] addressEntries, ResolutionOptions resolutionOptions)
at AddressManager.ResolveToQueues(AddressEntry[] addressEntries)
at AddressManager.ResolveToInternalEntities(AddressEntry[] addressEntries)
at EmailService.CheckIncoming(String messageId, String subject, String from, String to, String cc, String bcc, ExecutionContext context, Int32& reasonCode)
>Crm Exception: Message: SecLib::CheckPrivilege failed. Returned hr = -2147209463, User: 20d00467-34c4-dc11-84c0-0003ff1854c9, ErrorCode: -2147209463
The UserId mentioned here appears to be the Owner of the Queue (if you look it up in the SystemUserBase).
The Error code here is: -2147209463 = HR 0x80042F09
Error 80042F09 means “The user has not been granted any licenses or the user has not been assigned any roles. ”
We had a look in the Queue properties and indeed the Owner didn’t have any role, we need to add a role to the Queue owner to address this.
Here you are, I may add more examples in the future I you are interested.
Hope this helps
Benjamin
Comments
- Anonymous
January 08, 2009
This post will give you some steps and links to additional information on troubleshooting the different - Anonymous
January 08, 2009
This post will give you some steps and links to additional information on troubleshooting the different