Using CoolSpools to send email from IBM i via Office 365

If your IBM i server can connect to the internet, then CoolSpools should be able to deliver email messages directly to the recipient’s mail server, but many organisations prefer to relay email messages via a corporate mail system (e.g. Domino, Exchange), which is also possible with CoolSpools.

“Can I use CoolSpools to send messages via Office 365?”

The short answer is yes, but since the majority of the configuration requirements are outside of CoolSpools, the better question might be “How can I set up Office 365 to allow relaying of email messages from an external system?”

This guide will walk you through the steps, but for any Office 365 configuration changes we would recommend referring to current Microsoft documentation and following the latest instructions.

Step 1

Download and install CoolSpools from the CoolSpools website, if you have not already done so.
https://coolspools.com/coolspools-downloads/

You will automatically receive a 30-day trial licence key on installation, so there is no cost involved in evaluating the software. CoolSpools requires an OS version of IBM i 6.1 or above, and is installed and runs wholly on your IBM i server, so there is no requirement for any other hardware.

Step 2

In order to configure CoolSpools to connect to Office 365 you will need some details from your Office 365 domain.

You can identify the MX endpoint hostname by following the steps below, although you may wish to check the latest Microsoft documentation:

  • Open the Microsoft 365 admin center. If prompted, log in using an account with admin privileges.
  • https://admin.microsoft.com/AdminPortal/Home#/homepage
  • In the left hand menu expand Settings and click on Domains
  • A list of domains will be presented (there will often only be one entry in the list). Click on the name of the default domain to see the details, then select DNS records.
  • Make a note of the domain address recorded in the MX record. It will be formatted something like yourdomain-com.mail.protection.outlook.com

Step 3

Identify or create an Exchange user and password to be used when connecting from the IBM I server to the mail server. The user takes the form of an email address, and the password is that associated with that email address. Some sites prefer to create a specific user dedicated to this task, but you can use any valid user. Don’t worry, CoolSpools will not be restricted to sending messages using this email address as the sender.

Step 4

Update the CoolSpools SMTP configuration with the MX endpoint hostname and user/password identified in the previous steps. This can be configured to use an open or an encrypted SMTP connection.

To use an open SMTP connection on port 25 use the following CoolSpools configuration:

CFGSMTPSVR MAILSERVER(‘yourdomain-com.mail.protection.outlook.com’ 25) SVRAUTH(*LOGIN) SVRLOGIN(‘[email protected]’ password)

To use an encrypted SMTP connection on port 587 use the following CoolSpools configuration:

CFGSMTPSVR MAILSERVER(‘yourdomain-com.mail.protection.outlook.com’ 587) SVRAUTH(*TLSLOGIN) SVRLOGIN(‘[email protected]’ password)

Step 5

If you have chosen to use encrypted port 587 then a security certificate needs to be applied to the CoolSpools SMTP service. This should be done within the IBM i Digital Certificate Manager (DCM).

We would recommend referring to the latest IBM instructions for working with DCM, but the steps involved are as follows:

  • Open the *SYSTEM certificate store
  • Import or generate a certificate if one does not already exist
  • Open applications and assign the security certificate to application ARIADNE_SMTP_SERVER

Step 6

Your Office 365 system needs to be configured to permit email traffic from your IBM i server. This can be achieved by adding a Connector. At the time of writing this can be done with the following steps, but we would recommend referring to the latest Microsoft documentation.

  • Open the Exchange admin center. If prompted, log in using an account with admin privileges.
  • https://admin.exchange.microsoft.com/#/
  • In the left hand menu expand Mail flow and click on Connectors
  • Take the option to add a new connector, selecting email from Your organisations’s email server and to Office 365, then click Next
  • Enter a meaningful name and description indicating that this connector permits SMTP traffic from your IBM i server and select the option to turn the connector on once saved, then click Next
  • Select the option to authenticate by IP address, and enter the IP address of your IBM i server – press the plus symbol to add the IP address before clicking Next
  • Finally review the connector settings, and if they are correct confirm by clicking Create Connector
  • Note: When entering the IP address of your IBM i server, this is the address as seen by Office 365, which may be different to the internal IP address within your network depending upon your firewall settings

Step 7

Start your CoolSpools SMTP service, or stop and restart if it is already active, using the commands below.

ENDSMTPSVR

STRSMTPSVR

You can investigate the cause of any SMTP delivery failures by running the command below, and entering option 8 next to the failing message in the list. This will display a detailed log of the SMTP transaction with the mail server.

WRKSMTPMSG OPTION(*ALL)