Email router configuration XML file explained

Hi. Many of you have wondered what the various settings in the email router configuration file ( a.k.a Microsoft.Crm.EmailAgent.xml) are. Some of them are pretty straight forward and some are not. In this blog I will try to describe them in detail.

Microsoft.Crm.Tools.EmailAgent.xml

This file contains the configuration settings for running email router. The file store two types configuration settings. System configuration settings and Provider configuration settings.

a) System settings: These settings are general settings for the core email router operation.

S#

Tag Name

Description

1

MaxThreads

This defines the internal thread pool size for running the email providers.

2

MaxThreadExecution

This defines the maximum time a thread can execute for.

3

SchedulingPeriod

Time interval used to scheduling different providers.

4

ConfigRefreshPeriod

Time interval after which the configuration values gets read from the file to the internal memory structure.

5

ConfigUpdatePeriod

Timer interval after which the email router will attempt to synchronize the crm user and queues email settings between CRM server and the configuration file.

6

LogLevel

Log level. 1 – Normal, 2 – Advance, 3 – Details.

Note: all time intervals in the configuration file are specified in milliseconds.

Example:

<SystemConfiguration>

<MaxThreads>50</MaxThreads>

<MaxThreadExecution>600000</MaxThreadExecution>

<SchedulingPeriod>1000</SchedulingPeriod>

<ConfigRefreshPeriod>5000</ConfigRefreshPeriod>

<ConfigUpdatePeriod>300000</ConfigUpdatePeriod>

<LogLevel>1</LogLevel>

</SystemConfiguration>

b) Provider settings: These settings are for the individual providers that provide a particular service. There are two types of provider. Outbound providers and inbound providers. These provider have some common settings and other provider specific settings.

Common settings:

S#

Tag Name

Description

1

ProviderConfiguration

This is the top node defining a single email provider.

2

deploymentId

This is an internal CRM deployment id used in the email configuration wizard. For all ECW generated provider nodes its Guid. If a non GUID value is detected, router assumes this to a manual entry by the user and retains it in successive refresh of the config file.

3

ProviderAssembly

The assembly that contains the providers.

4

ProviderClass

The class that defines the provider behavior.

5

CrmServerUrl

The CRM server URL to which the provider will sync email to/from.

6

CrmAuthMode

Auth mode used to authenticate against the CRM server.

WindowsAuthentication, Passport and ClearText are allowed values.

7

CrmUser

CRM user account used to connect to CRM.

8

CrmPassword

CRM user password used when connecting to CRM.

9

EmailServer

Email server name.

10

EmailAuthMode

Authentication mode used to against the email sever.

11

LogLevel

Log level for the provider.

12

Target

This indicates the email target to interact with. For the outgoing email provider it’s the email server name and for incoming provider it’s the mailbox name.

13

Direction

This indicates if the provider is incoming or outgoing.

14

CacheCapacity

Internal cache capacity size.

15

ConnectionTimeout

Connection timeout for the action against the email server.

16

PollingPeriod

Time interval after which the provider should be rescheduled.

17

MaxMessageCount

Maximum messages to download in one polling period.

18

EmailPort

Email port to use when interacting with the email server.

a. Outbound providers: These provide a conduit though which email sent in CRM flow to the outside word. The only default outbound provider provided with the OOB email router service is the SmtpPollingSendEmailProvider. The SMTP outbound provider downloads emails in the pending send status for the users and queues specified and send them out via the local or specified SMTP stack.

S#

Tag Name

Description

1

UserId

CRM id of the user whose outgoing emails should be processed.

2

QueueId

CRM id of the queue whose outgoing emails should be processed.

3

EmailUseSsl

Should ssl be used when sending emails.

4

DeliveryMethod

Delivery method for sending email.

5

PendingStatusDelay

Pending status delay describes the period after the email sent action, the email should be picked up by the email router for sent.

6

SendingStatusDelay

Sendind status delay describes the period after which the email in crm, if stuck in sending status should be reprocessed.

7

CodePage

Codepage to be used when sending email.

8

MaximumDeliveryAttempts

Maximum attempts the email router will try to send the email out. If the threshold is reached the status if the email in CRM will be set to Failed.

9

BatchSize

Describes how many users and queues to batch together when making one BackgroundSend api call. The backgroudSend API call is made to download pending emails from CRM.

10

RequestBatchSize

Maximum number of emails to download in one request to BackgroundSend API.

Example:

<ProviderConfiguration deploymentId=”fd880e79-6f1b-4e40-aa05-628b845653fb”>

<ProviderAssembly>Microsoft.Crm.Tools.EmailProviders.dll</ProviderAssembly>

<ProviderClass>Microsoft.Crm.Tools.Email.Providers.SmtpPollingSendEmailProvider</ProviderClass>

<CrmServerUrl>http://[ServerName]/[OrganizationName]</CrmServerUrl>

<CrmAuthMode>WindowsAuthentication</CrmAuthMode>

<CrmUser>[DomainName] \administrator</CrmUser>

<CrmPassword>{2A48C4DB-F2BF-48DF-A8EF-20F531EA9BAA}:jEPrLEnKMdMI+jgjIAabJg==@0HlCR312abwYDupnkrAi8A==</CrmPassword>

<EmailServer>[EmailServerName] </EmailServer>

<EmailAuthMode>WindowsAuthentication</EmailAuthMode>

<UserId>9e80ac64-c82d-dd11-8246-0013720ec2db</UserId>

<UserId>17d87ab0-c62d-dd11-8726-0013720ec2db</UserId>

<Target>[EmailServerName] </Target>

<Direction>Outbound</Direction>

<LogLevel>1</LogLevel>

<CacheCapacity>1024</CacheCapacity>

<ConnectionTimeout>300000</ConnectionTimeout>

<PollingPeriod>60000</PollingPeriod>

<MaxMessageCount>1000</MaxMessageCount>

<EmailPort>25</EmailPort>

<EmailUseSsl>false</EmailUseSsl>

<DeliveryMethod>Network</DeliveryMethod>

<PendingStatusDelay>30000</PendingStatusDelay>

<SendingStatusDelay>60000</SendingStatusDelay>

<CodePage>Utf-8</CodePage>

<MaximumDeliveryAttempts>10</MaximumDeliveryAttempts>

<BatchSize>5</BatchSize>

<RequestBatchSize>5</RequestBatchSize>

</ProviderConfiguration>

b) Incoming provider: These provide a conduit though which the email from the outside world flow into CRM. The crm 4.0 email router provides 2 different OOB inbound providers. These are based on the protocol used to connect to the mailbox.

a. Exchange

b. POP3

There is also a third inbound mail box provider that allows processing of email from a forward or sink mail box style mail box.

S#

Tag Name

Description

1

EmailUser

User name of the user whose mailbox is to be monitored.

2

EmailPassword

Password to be used to login to the users mailbox.

3

EmailAddress

Email address of the user whose mailbox is to be monitored.

4

IsForwardMailbox

Indicates if the mail box being monitored is a forward mailbox. When mail box is a sink mailbox then email router processes the email found in the attachment of the email rather than the email itself. The user mail boxes all forward their emails to this mailbox as attachments.

5

DeleteEmails

This indicates if the email should be deleted from the mailbox after processing. A good option if it’s an unmonitored mail box.

6

MessageExpiry

Threshold time after which a message in the mail box is considered old to be neglected in processing.

7

MoveEmails

Flag to indicate if the undeliverable email should be moved to a separate folder.

Example:

<ProviderConfiguration deploymentId=”fd880e79-6f1b-4e40-aa05-628b845653fb”>

<ProviderAssembly>Microsoft.Crm.Tools.EmailProviders.dll</ProviderAssembly> <ProviderClass>Microsoft.Crm.Tools.Email.Providers.ExchangePollingMailboxProvider</ProviderClass>

<CrmServerUrl>http://[ServerName]/[OrganizationName]</CrmServerUrl >

<CrmAuthMode>WindowsAuthentication</CrmAuthMode>

<CrmUser>[DomainName]\Administrator </CrmUser>

<CrmPassword>{2A48C4DB-F2BF-48DF-A8EF-20F531EA9BAA}:jEPrLEnKMdMI+jgjIAabJg==@0HlCR312abwYDupnkrAi8A==</CrmPassword>

<EmailServer>http://[EmailServerName]</EmailServer>

<EmailAuthMode>WindowsAuthentication</EmailAuthMode>

<EmailUser>[DomainName]\administrator</EmailUser>

<EmailPassword>{2A48C4DB-F2BF-48DF-A8EF-20F531EA9BAA}:edkflQCsqYuDjLgtvCezJg==@x3JEvQyWBlCakbJGzbgv6w==</EmailPassword>

<EmailAddress>Administrator@extest.microsoft.com</EmailAddress>

<Target>First name Last name</Target>

<Direction>Inbound</Direction>

<LogLevel>1</LogLevel>

<CacheCapacity>1024</CacheCapacity>

<IsForwardMailbox>false</IsForwardMailbox>

<DeleteEmails>false</DeleteEmails>

<ConnectionTimeout>300000</ConnectionTimeout>

<PollingPeriod>60000</PollingPeriod>

<MaxMessageCount>1000</MaxMessageCount>

<MessageExpiry>86400000</MessageExpiry>

<EmailPort>80</EmailPort>

<MoveEmails>true</MoveEmails>

</ProviderConfiguration>