Faking IMAP for Exchange Email

For years I have had problems getting IMAP access to exchange servers. Many organizations don’t enable IMAP on their Exchange servers, and others don’t do it right. I recently came across a solution that works with the Microsoft WebMail interface to provide an IMAP and/or POP3 access to the mail servers. This allows the use of IMAP mail clients like Thunderbird or Microsoft Live Mail.

This article describes the solution as I have implemented it. It uses the open-source DavMail Gateway written in Java. It accesses a WebMail server and provides access via standard protocols like IMAP, SMTP, and CalDav. This program can be configured for personal use on a desktop, or group use on a server. When configuring a server, it is recommended that you provide SSL keys so that secure protocols can be used.


Use your favorite browser to visit the DavMail site. The main page has a download link.  Select the appropriate download for your system. There are downloads for Windows, Mac OS, Linux, and Others. You can also download standalone and Webapp server versions. I found the installation went smoothly on Windows. As of 2020, this application is actively maintained.

If you don’t already have Java installed you will need to install it. Install the Davmail Gateway software using the native installer. You can then begin your setup.   The sidebar on the DavMail site has specific documentation for various operating systems and clients.

Desktop Gateway Configuration

By default, the DavMail Gateway is configured to listen on ports 1000 greater than the default. This is required so that the gateway can run under an unprivileged user id on Max OS and Linux. On Windows, you can use the standard ports if you wish.

  • Specify the address of the Exchange OWA (Mail Server).
  • Disable services you don’t intend to use.  Likely POP3, and possibly LDAP.  Don’t disable both IMAP and POP3.  Unless you have multiple users you likely want either IMAP or POP3, not both.
  • Adjust ports if required.   On Linux or Mac OS use ports over 1024.  I moved the SMTP (Submission) port to 1587 and added 1000 to the others.
  • Review the settings on other configuration tabs.
  • Leave the network bind-address blank to bind to all addresses, or set it to for more secure use from the system it is installed on.
  • Save your configuration.
  • Start the program if it isn’t already running.  If the program is already running as a different user, you will need to stop that copy.
  • On Windows 7, I used MSConfig on my Admin account to disable the DavMail startup during login. Then I added Davmail to the Startup folder under All Programs for my user id.   This ensures it only runs on my account and is always run when I log in.

If you change the configuration of a running server, you may need to shut it down and restart it. This is less likely if you shut down your clients before changing settings. On the previous version, I had issues with binding ports if I didn’t stop the running server before saving my changes.

The latest release seems to have resolved the problem, although it did seem to lose my old configuration.  Record your settings before updating.

Client Configuration

Your DavMail Gateway will allow you to read your email using IMAP (recommended) or POP (not suggested). Use the protocol you configured. Configure a new server and use manual configuration to configure it:

  • Specify the email address you will be using.
  • Specify no security (encryption).  If you are connecting to a server, you should enable encryption.  This will require the configuration of an SSL certificate on the Gateway.
  • Specify password transmitted insecurely for both IMAP and SMTP settings.
  • Specify localhost for both IMAP and SMTP settings. If you are connected to a server specify its FQDN (Fully Qualified Domain Name). This is the long format; host.example.com, not host.
  • Specify the ports configured in the DavMail Gateway.
  • Specify your WebMail id (example/John.Doe) and password when you need to log in.

The first time you connect, your client should detect your folders and download some of your emails. How much of your email is downloaded is controlled by your client’s settings. Message threads are also handled by your client.


I manage my contacts and lists locally. Microsoft Live Email doesn’t appear to offer any suitable synchronization options. There is documentation on using LDAP to access your contacts, but I haven’t got it working in Thunderbird. The server also supports CardDav, but there are no up to date add-ons for Thunderbird. Access for CardDav is the same as for CalDav which is specified below.


The DavMail Gateway provides access to your calendar using CalDav. It works well with the Lightning plugin to Thunderbird. To add your calendar for Thunderbird:

  • Select New -> Calendar from the File Menu.
  • Select On the Network and click Next.
  • Select the CalDav format.
  • Enter the specification for your calendar in the form http://localhost:1080/users/John.Doe@example.com/calendar, using your host, port,  and email address. Then click Next.
  • Enter a name for your calendar, select a color for the calendar, and click Next.
  • Your calendar has been created, click Finish.


  • Calendar updates can take a few seconds.
  • Calendar entries do not appear when disconnected from the server. This can be expected as the calendar is stored on the server. I will try the experimental caching option.
  • The DavMail Gateway reports occasional login timeouts. This may be related to the dropouts I experience using the WebMail interface to read my email.
  • The DavMail Gateway behaves well when I am disconnected from the corporate network and can’t reach the Exchange server.
  • As noted above, I haven’t tested access to contacts.


  1. I’m not able to get past the gateway settings on DavMail: I keep getting the error message “Unable to bind server socket for SMPT on port 25: port not allowed or in use by another process.” I get the same message for POP and IMAP on their respective ports. I’ve tried changing the portnumbers, but the result is the same. I’ve also asked for help on the DavMail “Help” site, but so far, no response.

    As an FYI, I’m running Windows 7, and understood I could use my standard ports. In Thunderbird, my POP3 is on port 110; IMAP is port 143; and SMTP is port 25.

    Sure would appreciate any help you could offer!

  2. I have updated the post to include some notes on problems you may be encountering. Running the command netstat -a -n | find "LISTEN" in a Command Prompt window will show the ports programs are listening on. This can be used to see if the ports are really already in use.

  3. Hmmm…how do I interpret the results? I end up with 2 columns of data (4 if you count “TCP” as the 1st column and “LISTENING” as the 4th column), starting with all the way up to–then it changes to up to–then there’s one instance of–at which point the format changes completely to [::]135 up to 49181. I’d have copied it all and appended it to this email, but can’t figure out to copy from the command prompt.

  4. You have identified the column with the data you want. The port number is after the last colon in the list. If your chosen ports are in the list, they are already in use and you won’t be able to use them.

    The address is the component before the final colon. They are: (any IPv4 address); (localhost); 192.168.x.x (a zero configuration address); and [::] (any IPv6 address). Other than [::1] (IPv6 localhost, any other address should be one of the external addresses of your host.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Cookie Consent with Real Cookie Banner