Introduction

This article describes how to set up Office 365 SMTP hosted services to allow the Email Trigger (SMTP)Closed 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:

  1. Log into the Office 365 Admin Center.
  2. From the navigation pane, go to Admin > Exchange.

    Office 365 Admin Center

  3. Open the mail flow page then click Connectors.

    Office 365 Admin Center - Mail Flow - Connectors

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

    Office 365 Admin Center - Mail Flow Wizard

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

    Office 365 Admin Center - Mail Flow Wizard - New Connector

  10. Click Next.
  11. Enable Only when email messages are sent to these domains.
  12. 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.

    Office 365 Admin Center - Mail Flow Wizard - Domains

  13. Click Next.
  14. Click and enter the public IP address of the BPA Platform server.

    Office 365 Admin Center - Mail Flow Wizard - Public IP Address

  15. Click Next.
  16. 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.Office 365 Admin Center - Mail Flow Wizard - TLS
  17. Click Next then Next again.
  18. Click Validate to test the new connector — a valid email address must be supplied for the test.
  19. Once you are happy with the tests, click Save.

Office 365 Admin Center - Connectors List

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:

  1. 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.

  2. 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.
  3. 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 ManagementClosed 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