Skip to content

Microsoft Exchange Adapter

Overview

The Microsoft Exchange adapter will allow Neuron to retrieve email messages from an Exchange mailbox and publish the messages to the ESB.  When an email is published to the ESB, the entire email message is serialized as the Neuron ESB Message.  See below for more information for accessing the email.

Requirements

This adapter requires a Microsoft Exchange Server.

Adapter Modes

The adapter supports the following mode of operation.

ModeDescription
PublishThe adapter polls a Microsoft Exchange mailbox and publishes emails to Neuron.

Design-Time Properties

Property NameDescription
General Properties 
Exchange VersionThe version of Microsoft Exchange to communicate with.  This adapter supports:Exchange 2010Exchange 2010 SP1Exchange 2010 SP2Exchange 2007 SP2
TimeoutSets the timeout that is used when sending Microsoft Exchange requests and when receiving Exchange responses.  This value is specified in seconds and must be greater than 0.  The default value is 100 seconds.
Use Web CredentialsIf True, the Web credentials will be used for retrieving emails from Microsoft Exchange Online.
Mailbox AccountThe Microsoft Exchange account address of the Microsoft Exchange Mailbox to retrieve emails from.  Required.
PasswordThe password for the Online Microsoft Exchange account.  Only available when Use Web Credentials is set to True.
Auto DiscoveryDetermines whether or not Microsoft Exchange Auto Discovery will be used to retrieve the correct host name and URL.
Exchange ServerThis is the server address of the Microsoft Exchange Server, not including ‘https://’.  The server name should be a fully qualified DNS name.  Required when Auto Discovery is set to False.
Publish Mode Properties 
Publish TopicThe Neuron topic that messages will be published to. Required for Publish mode.
Polling IntervalSets the interval between polling executions. This value is specified in seconds.
Exchange FolderThe name of the root folder to read email messages from, or the full path to the folder (i.e. ‘inbox\collateral\marketing’).  Required.
Batch SizeSets the maximum number of email messages to attempt to retrieve on each polling call.  Batch size must be greater than 0.
Delete ModeDetermines how messages are deleted once they are retrieved.  The supported modes are:Move To Deleted Items – The email message will be moved to the mailbox’s Deleted Items folderHard Delete – The email message will be permanently deletedSoft Delete – The email message will be moved to the Exchange Server dumpster, where it can be recovered per the Exchange Server’s retention policy
Error ReportingDetermines how all errors are reported in the Event Log and Neuron Log files. Errors can be reported as Errors, Warnings or Informational messages.
Error on PollingDetermines if polling of data source continues when an error is encountered and whether or not consecutive errors are reported.  The supported modes are:Stop Polling on Error – the adapter endpoint is disabled when an error is encountered.Suppress Consecutive Errors – When an error is encountered, only the first instance of this error is written to the event log.  Consecutive errors are ignored.Report All Errors – When an error is encountered, all instances of that error are written to the event log.
Audit Message on FailureRegister failed message and exception with Neuron Audit Database.  The database must be configured in Neuron for failed messages to be audited.

When specifying the publish topic, ensure that the configured party for the adapter endpoint has a publish subscription to the topic.

Run-Time Properties

Inbound Properties

The following message properties will be created if the Include metadata property is checked on the adapter endpoint:

Property NameDescription
General Properties 
msexch.VersionThe version of Microsoft Exchange the adapter is set to
msexch.TimeoutNumber of seconds for each Microsoft Exchange call
msexch.MailboxMicrosoft Exchange Account
msexch.AutoDiscoverTrue if Auto Discover is used to determine Microsoft Exchange connection information
msexch.ServerName of Microsoft Exchange Server to connect to
msexch.UrlReturned by auto discovery. The absolute Url of the Microsoft Exchange Server proxy
msexch.PortPort of Microsoft Exchange Server to connect to
msexch.TimeZoneTime Zone that Microsoft Exchange Server to connect to is in
msexch.FolderPathThe path that represents the Microsoft Exchange folder to receive from
msexch.FolderIdThe ID of the Microsoft Exchange folder
msexch.BodyTypeText or HTML
msexch.SubjectSubject line of the email
msexch.FromSender email address
msexch.HasAttachmentsTrue if file attachments are present
msexch.ToTO email addresses. Each separated by ‘;’
msexch.CCCC email addresses. Each separated by ‘;’
msexch.DateTimeCreatedDate time that email was originally created
msexch.DateTimeReceivedDate Time that email was received
msexch.DateTimeSentDate time that email was sent
msexch.AttachmentCountNumber of file attachments within the email
msexch.TimeZoneOffsetTime Zone UTC Offset that Microsoft Exchange Server to connect to is in
msexch.CharacterSetMIME character set of the email message
msexch.ContentTypeMIME content type
msexch.BatchSizeThe number of emails to process with each poll request

To access the properties at run-time, create a new Process, include a Code step, and use code similar to this:

string subject = context.Data.GetProperty("msexch", "Subject");

Publish Mode

The Exchange adapter polls a Microsoft Exchange mailbox and publishes any retrieved emails to the ESB.  Each email is published to the ESB as a Neuron message.  The entire email is serialized into the ESB Message body.

Message Format

When a message is received from the mail server, it is serialized as a string of bytes as the message data.  To access the mail message contents, the message data must be deserialized into the Neuron.Esb.Mail.MailMessage API.  This is done in a Process using a Code step:

Neuron.Esb.Mail.EmailMessage email = Neuron.Esb.Mail.EmailMessage.Deserialize(context.Data.InternalBytes);

Once you deserialize the mail message, you can access the body and any attachments.  The following code sample sets the Neuron message body equal to the email body and saves all the attachments to C:\FileOut:

context.Data.Body = email.Body;

foreach(Neuron.Esb.Mail.Attachment a inemail.Attachments)
{
            System.IO.File.WriteAllBytes(@"C:\FileOut\" + a.Name, a.Content);
}

You could also use the For-Each step in a Process to loop through the collection of attachments and publish each attachment to the ESB separately.  See the Exchange and POP3 Adapters sample for an example of how to do this.

After settiontent of the eng the Neuron message body equal to the email body, the format of the Neuron message depends on the cmail.  It could be XML, text, HTML or binary.

The Neuron.Esb.Mail.EmailMessage API has the following properties:

Property NameDescription
AccountThe account the email was sent to
AttachmentsA collection of attachments that were received with the email
BccA collection of Bcc email addresses.  This field is only populated when retrieving messages from the Sent messages folder of your own account
BodyThe body of the email
CcA collection of CC email addresses.
DateTimeCreatedDate-time the email was originally created
DateTimeReceivedDate-time the email was received
DateTimeSentDate-time the email was sent
FromSender email address
IsEncryptedFlag indicating if the contents of the email are encrypted
IsSignedFlag indicating if the email message is signed
MimeContentIf the email contains mime content, it will be placed in this property
SubjectThe subject of the email message
ToA collection of To email addresses.
Was this article helpful?
Dislike 0
Previous: File Adapter
Next: E-Mail Adapter