Microsoft Exchange Adapter
- Home
- Neuron ESB
- Development
- Developing Neuron Applications
- Connecting to External Systems
- Adapters
- Neuron Adapters
- 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.
Mode | Description |
Publish | The adapter polls a Microsoft Exchange mailbox and publishes emails to Neuron. |
Design-Time Properties
Property Name | Description |
General Properties | |
Exchange Version | The version of Microsoft Exchange to communicate with. This adapter supports:Exchange 2010Exchange 2010 SP1Exchange 2010 SP2Exchange 2007 SP2 |
Timeout | Sets 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 Credentials | If True, the Web credentials will be used for retrieving emails from Microsoft Exchange Online. |
Mailbox Account | The Microsoft Exchange account address of the Microsoft Exchange Mailbox to retrieve emails from. Required. |
Password | The password for the Online Microsoft Exchange account. Only available when Use Web Credentials is set to True. |
Auto Discovery | Determines whether or not Microsoft Exchange Auto Discovery will be used to retrieve the correct host name and URL. |
Exchange Server | This 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 Topic | The Neuron topic that messages will be published to. Required for Publish mode. |
Polling Interval | Sets the interval between polling executions. This value is specified in seconds. |
Exchange Folder | The name of the root folder to read email messages from, or the full path to the folder (i.e. ‘inbox\collateral\marketing’). Required. |
Batch Size | Sets the maximum number of email messages to attempt to retrieve on each polling call. Batch size must be greater than 0. |
Delete Mode | Determines 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 Reporting | Determines 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 Polling | Determines 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 Failure | Register 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 Name | Description |
General Properties | |
msexch.Version | The version of Microsoft Exchange the adapter is set to |
msexch.Timeout | Number of seconds for each Microsoft Exchange call |
msexch.Mailbox | Microsoft Exchange Account |
msexch.AutoDiscover | True if Auto Discover is used to determine Microsoft Exchange connection information |
msexch.Server | Name of Microsoft Exchange Server to connect to |
msexch.Url | Returned by auto discovery. The absolute Url of the Microsoft Exchange Server proxy |
msexch.Port | Port of Microsoft Exchange Server to connect to |
msexch.TimeZone | Time Zone that Microsoft Exchange Server to connect to is in |
msexch.FolderPath | The path that represents the Microsoft Exchange folder to receive from |
msexch.FolderId | The ID of the Microsoft Exchange folder |
msexch.BodyType | Text or HTML |
msexch.Subject | Subject line of the email |
msexch.From | Sender email address |
msexch.HasAttachments | True if file attachments are present |
msexch.To | TO email addresses. Each separated by ‘;’ |
msexch.CC | CC email addresses. Each separated by ‘;’ |
msexch.DateTimeCreated | Date time that email was originally created |
msexch.DateTimeReceived | Date Time that email was received |
msexch.DateTimeSent | Date time that email was sent |
msexch.AttachmentCount | Number of file attachments within the email |
msexch.TimeZoneOffset | Time Zone UTC Offset that Microsoft Exchange Server to connect to is in |
msexch.CharacterSet | MIME character set of the email message |
msexch.ContentType | MIME content type |
msexch.BatchSize | The 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 Name | Description |
Account | The account the email was sent to |
Attachments | A collection of attachments that were received with the email |
Bcc | A collection of Bcc email addresses. This field is only populated when retrieving messages from the Sent messages folder of your own account |
Body | The body of the email |
Cc | A collection of CC email addresses. |
DateTimeCreated | Date-time the email was originally created |
DateTimeReceived | Date-time the email was received |
DateTimeSent | Date-time the email was sent |
From | Sender email address |
IsEncrypted | Flag indicating if the contents of the email are encrypted |
IsSigned | Flag indicating if the email message is signed |
MimeContent | If the email contains mime content, it will be placed in this property |
Subject | The subject of the email message |
To | A collection of To email addresses. |