Introduction
This article describes how to set up Office 365 SMTP hosted services to allow the Email Trigger (SMTP)
The Email Trigger (SMTP) tool triggers a task to run based on the contents of incoming or outgoing mail sent via an SMTP mail server. tool to monitor inbound emails. To do this, an outbound connector must be setup in the SMTP services, which identifies a specific address space and routes the email to BPA Platform.
Prerequisites
The following is required to complete the outbound connector setup:
| ► | Create an external IP address for the computer hosting the BPA Platform. Typically, this computer also hosts the IIS SMTP Virtual Server |
| ► | Set up a DNS MX record that identifies the required domain name. |
| ■ | This is mapped to the external IP address setup previously. |
| ► | Register a sub-domain to filter email destined for BPA Platform away from those destined for Office 365 mailboxes. |
Routing Inbound Emails to BPA Platform
The following procedure must be carried out by your System Administrator or a user that has administrator privileges:
- Log into the Office 365 Admin Center.
- From the navigation pane, go to Admin > Exchange.

- Open the mail flow page then click Connectors.

- Click
to launch the mail flow wizard. - From the From drop-down, choose Office 365.
- From the To drop-down, choose Your organization's email server.

- Click Next.
- Enter a meaningful Name and Description for your connector.
- Enable the two options at the bottom of the wizard.

- Click Next.
- Enable Only when email messages are sent to these domains.
- Click
and enter your registered sub-domain name. This identifies the address space specific to BPA Platform so only email destined to BPA Platform goes through this connector.
- Click Next.
- Click
and enter the public IP address of the BPA Platform server.
- Click Next.
- We recommend setting up opportunistic TLS initially to ensure TLS does not impact your outbound email flow — an encrypted connection is always attempted first but if this can't be established, the connection falls back to unencrypted communication.

- Click Next then Next again.
- Click Validate to test the new connector — a valid email address must be supplied for the test.
- Once you are happy with the tests, click Save.
Setting Up the IIS Virtual SMTP Server
The following procedure must be carried out by your System Administrator or a user that has administrator privileges for the computer:
- If IIS 6.0 does not exist on your computer, install it now.
On the computer, launch the Roles and Features Wizard and go to Web Server (IIS) > Management Tools > IIS 6 Management Compatibility.
- Set up the Virtual Server as detailed in this article: http://msdn.microsoft.com/en-us/library/8b83ac7t(v=vs.100).aspx. Note that Codeless Platforms accepts no responsibility for the content of external sites.
- Ensure the DNS record identifies this computer by its registered external IP address.
Installing the Email Trigger (SMTP) Agent
The Email Trigger (SMTP) Agent works with the Email Trigger (SMTP) tool to process incoming SMTP messages. It can run on the same or separate computer to the server. It launches tasks when messages arrive that match filter rules previously configured within a Email Trigger (SMTP) step for a task.
It interfaces with Microsoft Virtual SMTP Server which is part of the Microsoft Internet Information Services. When a message is received by the Virtual SMTP Server, a copy of the message is passed to the Agent which in turn decides if there are any tasks to run.
Install the Email Trigger (SMTP) Agent as detailed in the Installing the Email Trigger (SMTP) Agent article.
Testing the Full Installation
Create a task that monitors for emails to the connector's sub-domain. Then test by sending an email to that domain with and without the expected trigger phrases — see How to Add an Email Trigger (SMTP) Task Step.
Housekeeping
For cases where emails processed by the SMTP Virtual Server are not forwarded onto their intended recipient (see (Optional) Changing How Emails are Checked and Stored), you may find the Virtual Server's drop folder being filled with emails.
In such cases, use a task with a File Management
Use the File Management tool to carry out a number of automated actions on single or multiple files — move, copy, rename, and delete — either locally or across the network. Uploads to and downloads from an FTP server are also supported. task step that clears out this folder — either deletes them completely or moves them to a different network location — see How to Add a File Management Task Step.
Article originally published 03 December 2015 — Article updated 23 June 2017