The last week I had the problem, that some emails were sent to the customer, the field “Date Sent” (senton)-Field is was filled with a date, but the status was still in “pending send”.
Based on the fact, that the field “date send” was filled, I checked the mailserver, if the mail was really sent. My mailserver showed, that the mail was sent. My next step was, to enable the tracing on the backend server. After some minutes, I got the following message in the log:
The mail was sent to the customer:
[2020-11-13 12:45:39.896] Process:CrmAsyncService |Organization:b29fe8c7-612e-e811-90fe-005056a247dc |Thread: 62 |Category: EmailConnector |User: 00000000-0000-0000-0000-000000000000 |Level: Info |ReqId: 00000000-0000-0000-0000-000000000000 |ActivityId: 2c1f0049-89cc-e811-911b-005056a26140 | OutgoingActivityProviderBase`1.HandleTraceForOutgoingActivityProvider ilOffset = 0x38
>Outgoing activity 4ba4e468-a125-eb11-913f-005056a241e7 is sent.
An exception was thrown after the sending:
[2020-11-13 12:45:39.896] Process:CrmAsyncService |Organization:b29fe8c7-612e-e811-90fe-005056a247dc |Thread: 88 |Category: EmailConnector |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 00000000-0000-0000-0000-000000000000 |ActivityId: edc9b020-a456-e811-9104-005056a26140 | EmailConnectorTraceHandler.EmailConnectorTraceFormat ilOffset = 0x13E
>Exception occurred while preparing of outgoing mail item 4ba4e468-a125-eb11-913f-005056a241e7 . Exception: Unhandled Exception: System.ArgumentNullException: Value cannot be null.
>Parameter name: value
> at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateParam(Object param, String paramName)
> at Microsoft.Exchange.WebServices.Data.ExtendedProperty.set_Value(Object value)
> at Microsoft.Crm.Asynchronous.EmailConnector.EmailMessageConverter.SetCorrelationFields(Entity email, EmailMessage emailMessage)
> at Microsoft.Crm.Asynchronous.EmailConnector.EmailMessageConverter.GetEmailMessage(Entity email, ExchangeService exchangeService)
> at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeServiceOutgoingEmailProvider.Send()
Based on the exception message, I checked google, but was not able to find any result. My first thought was, that a plugin might have blocked something, as the senton-field was set, but the status was not changed. But there were no plugins that might have an impact on this.
Checking the entity, I recognized, that the auditing was enabled on the mail-entity. Therefore I disabled the auditing and the error was gone.