Installing and Configuring IMAP4 and POP3 access in Exchange 2007

Installing and Configuring IMAP4 and POP3 access in Exchange 2007In Exchange 2007, the client connectivity most people pay attention to include MAPI, ActiveSync, and Outlook Web Access, because that’s what most clients are going to use. But there are great reasons to use POP3 and IMAP4 in Exchange 2007; legacy clients and applications, server processes, mobile devices that don’t support ActiveSync, and third party mail clients that cannot use MAPI. In this post we will go over how to install and enable POP3 and IMAP4 in Exchange 2007 so that you can support any or all of the clients that need to use these tried and true protocols. Both are a core part of the Client Access Server role, so all we need to do is secure them, enable them, and start them up. All of this will be done on the CAS server.

POP3 vs. IMAP

If you haven’t used them before, you may wonder what the difference is. While there are exceptions to the following, it suffices for now. POP3 is the older protocol, and is typically used when your server holds your email in a flat inbox, and only until you retrieve it. Your client will pull all your email off of the server each time it checks for mail. IMAP is more often used when you want to store all your email on the server, support multiple client applications (or devices) accessing the same mailbox, and you also want to support folders for sorting the email. If you have more than one thing you want to use to check email (your PC and your phone for example) use IMAP.

Securing the protocols

Before we even start down the road of enabling POP3 and IMAP, let’s talk about security. Both protocols are Clear text protocols; they transmit all data including authentication without encryption. Fortunately, both protocols also support encrypted versions of these protocols, typically called POPS and IMAPS. POP3 over SSL, and IMAP over SSL both use certificates to secure the communications between client and server, and they are the options you will want to use whenever possible.

Since you’ll be using a certificate, you should consider whether you want to use an internal certificate, or one from a Public Certificate Authority. Internal certs from an AD integrated CA don’t cost you anything other than time and a little effort, and will be trusted by your domain members, but if you don’t already have a CA, or if you need to support non-domain joined systems, get a server validation certificate that uses the CN you want to identify your POP/IMAP server. You can open the Exchange Management Shell and issue the following command to create a certificate request for submitting to your preferred CA.

New-ExchangeCertificate -generaterequest -subjectname “dc=com,dc=example,o=Example  Corporation,cn=CAS01.example.com” -domainname POP3.example.com,IMAP.example.com,autodiscover.example.com -PrivateKeyExportable $true -path c:\scratch\certrequest.txt

In the above command we specify that the private key is exportable, and we include SANs for POP3, IMAP, and autodiscover. Adjust the server names and paths as needed. Take the file created and submit it to a CA. When your certificate is issued, run this command in the EMS to import the certificate so you can use it.

Import-ExchangeCertificate -Path c:\scratch\filename.cer -friendlyname “CAS01cert”

POP3

Remember, the POP3 service is part of the CAS server role, so to start using POP3 on Exchange 2007, you just need to set the service startup to automatic, and start it. As we discussed, POP3 by itself is unencrypted, so we also want to ensure that POP3 over SSL is enabled and uses the certificate we installed above. Here are the three commands you will run in the EMS to do this:

set-service msexchangepop3 –startuptype automatic
start-service –name msexchangepop3
set-popsettings -server CAS01 –x509certificatename CAS01cert

And then restart the POP3 service. You can use the EMS or services.msc as you prefer.

IMAP

If you want to enable IMAP on Exchange 2007, the procedure is nearly identical to POP3. Again, we are opting to use the SSL version for the encryption:

set-service msexchangeimap4 –startuptype automatic
start-service –name msexchangeimap4
set-imapsettings -server CAS01 -X509CertificateName CAS01cert

And then restart the IMAP service.

Client setup

It’s important to remember that the standard versions of POP3 and IMAP are Clear text protocols; they transmit all data including authentication without encryption. Fortunately, both protocols also support encrypted versions of these protocols, typically called POPS and IMAPS. POP3 over SSL, and IMAP over TLS both use certificates to secure the communications between client and server, and they are the options you will want to use whenever possible.

Clients will be allowed to connect using either POP3 or IMAP by default, and there is no distinction between the Clear text and the encrypted versions. If you don’t want a user to use either, you can disable them on a per mailbox basis. If you don’t want a user to use the Clear text versions, don’t open the ports on the firewall. You can use the Exchange Management Console to alter the properties of the mailbox, or use the EMS. Here are the commands to disable both for a particular mailbox:

Set-casmailbox identity mailboxname –popenabled $false
Set-casmailbox identity mailboxname –imapenabled $false

Here’s a list of the ports you will need to have open on the firewall and forwarded to your CAS server for POP and IMAP:

Protocol                               TCP port               encrypted?
POP3                                     110                         no
IMAP4                                  143                         no
IMAP over SSL                   993                         yes
POPS over SSL                   995                         yes

There are so many different client applications, it is impossible to show all the various settings, but the good news is they will all look very similar. Since a picture is worth a thousand words, here are two using Windows Live Mail:

IMAP-Exchange-2007

POP3-Exchange-2007

Notice that both have you authenticating using Clear text. Keep in mind that your credentials will be secured by the SSL connection. There are a couple of older standards that would encrypt credentials (but not data) that are still available, but hardly ever used, and not used by Exchange. If you fire up Wireshark, you will see the certificate exchange, and then everything else will be encrypted. There will be no reading usernames, passwords, or email in a packet trace when you are using SSL.

You now have all the information you need to expand your client support IMAP4 on Exchange 2007 and POP3 on Exchange 2007.


Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>