Connect an on-premises Exchange server

Step-by-step guide to connecting an on-premises Microsoft Exchange server to Automatic Email Processor

This guide shows how to set up a mailbox hosted on your own Exchange server (on your local network or in a data center, “on-premises”) in Automatic Email Processor. It applies to Exchange Server 2016, 2019 and Exchange Server SE; older versions follow the same pattern.

The Microsoft 365 account type is not the right choice here: it connects through the Graph interface of the Microsoft cloud and therefore works exclusively with Microsoft 365 / Exchange Online mailboxes. For an on-premises Exchange server, use the IMAP account type instead - Exchange fully supports IMAP (folders, moving messages, read status, real-time detection via IDLE). However, the corresponding services are disabled by default on the server and need to be switched on once.

At a Glance

  • Difficulty: Advanced (administrator access to the Exchange server required)
  • Time required: approx. 15 minutes
  • Prerequisites: Exchange Management Shell on the server, credentials of the mailbox
  • Result: Exchange mailbox as an IMAP account that can be selected as a data source in any profile

Video tutorial: Connect an on-premises Exchange server (with narration and optional subtitles)

Note: Steps 1 to 3 take place on the Exchange server and require administrator rights - forward this guide to your IT administration if necessary. From step 4 onward, you continue on the computer running Automatic Email Processor.


Step 1: Enable the IMAP services on the Exchange server

In a default Exchange installation, the IMAP services are disabled. On the Exchange server, open a PowerShell as administrator and enable both services - the client access service and the backend service:

Set-Service MSExchangeIMAP4 -StartupType Automatic
Set-Service MSExchangeIMAP4BE -StartupType Automatic
Start-Service MSExchangeIMAP4
Start-Service MSExchangeIMAP4BE

Alternatively, use the Windows Services console (services.msc): set the services Microsoft Exchange IMAP4 and Microsoft Exchange IMAP4 Backend to startup type “Automatic” and start both.

Important: Both services really have to run. If only the client access service is running, the server accepts connections, but the login fails.


Step 2: Enable a certificate for IMAP

Exchange encrypts IMAP connections with a server certificate. For the connection to succeed, a certificate has to be assigned to the IMAP service whose name matches the server name used by the clients (e.g. mail.example.com).

Open the Exchange Management Shell and list the available certificates:

Get-ExchangeCertificate

Pick the certificate whose name (CN or SAN entry) matches the desired server name and enable it for IMAP. Then restart the IMAP services:

Enable-ExchangeCertificate -Thumbprint <thumbprint> -Services IMAP
Restart-Service MSExchangeIMAP4
Restart-Service MSExchangeIMAP4BE

If several matching certificates exist, additionally specify explicitly which one the IMAP service should use:

Set-ImapSettings -X509CertificateName mail.example.com

Trust: On the computer running Automatic Email Processor, the certificate must be trusted. With a certificate from a public or internal certification authority, this is usually the case automatically. With a self-signed certificate, import its root certificate on the AEP computer into the “Trusted Root Certification Authorities” store. For security reasons, the program does not accept untrusted certificates - there is deliberately no option to ignore certificate errors.


Step 3: Check reachability

For IMAP, Exchange uses port 993 (SSL/TLS) and port 143 (StartTLS) by default; Get-ImapSettings shows the current values. Make sure that any firewall between the AEP computer and the Exchange server lets port 993 through.

Tip: From the AEP computer, reachability can be tested without additional tools - in a PowerShell: Test-NetConnection mail.example.com -Port 993. If it reports TcpTestSucceeded : True, the path is clear.


Step 4: Set up the account in Automatic Email Processor

In Automatic Email Processor, open the main menu, select Options… and switch to the Email accounts category. Click Add… and fill in the account editor:

  1. Display name: a descriptive name, e.g. “Accounting (Exchange)”.
  2. Account type: IMAP.
  3. Incoming mail server (IMAP): the server name from step 2 (e.g. mail.example.com - exactly the name the certificate was issued for), port 993, security SSL.
  4. Username: usually the email address of the mailbox. If the login fails with it, try the Windows logon name in the form DOMAIN\user or as a UPN (user@example.local).
  5. Password: the Windows password of the mailbox user.
  6. Outgoing mail server (SMTP): the same server, port 587, security StartTLS, same credentials. Exchange accepts authenticated submissions through the client receive connector that exists by default on port 587.

The individual editor fields are described with screenshots in the guide How to set up an IMAP account - from entering the server data onward, the procedure is identical.


Step 5: Send and receive a test message

At the bottom of the account editor, click Send/receive test message…. The program sends a test email through the Exchange server to its own address and then retrieves it via IMAP - this checks the SMTP and IMAP connection in a single pass.

  • Success: Close the editor with OK. The account is now available as a data source in all profiles.
  • Certificate error: The certificate is not yet assigned to the IMAP service or not trusted on the AEP computer - see step 2 and the table below.
  • Login error: Try the username in the form DOMAIN\user or as a UPN (see step 4).

Alternative: POP3 instead of IMAP

Exchange also supports POP3, which can be enabled following the same pattern: switch on the services Microsoft Exchange POP3 and Microsoft Exchange POP3 Backend (MSExchangePOP3 / MSExchangePOP3BE), assign the certificate with Enable-ExchangeCertificate -Thumbprint <thumbprint> -Services POP, default port 995 (SSL/TLS).

Compared to IMAP, however, POP3 has noticeable limitations: it only sees the inbox, cannot move messages into subfolders on the server, and offers no real-time detection of new email. Therefore, use POP3 only if IMAP is not an option in your environment.


Common issues

Issue Solution
Certificate error during the connection test (“The secure connection was blocked”) The certificate is not assigned to the IMAP service (step 2) or not trusted on the AEP computer (import the root certificate). Also, the server name entered must exactly match the name in the certificate.
Connection is refused or times out Are both IMAP services running (including the backend service)? Does the firewall let port 993 through from the AEP computer to the server?
“Login failed” despite the correct password Try the username in the form DOMAIN\user or as a UPN (user@example.local). Check whether the account is locked or the password has expired.
Sending fails, receiving works For SMTP, use port 587 with StartTLS and authentication - not port 25. The default receive connector “Client Frontend” must be active on the server.
Certificate error although the certificate is correctly assigned and trusted An antivirus program or a firewall with TLS inspection replaces the server certificate in transit with its own. Set up an exception for the Exchange server or the program there.
No more connection after a server restart The startup type of the IMAP services is still set to “Manual” - change it to “Automatic” (step 1).

Further topics

Try Automatic Email Processor free for 30 days ...     Download