Email server setup in Mac OS X 10.7 Lion Server

First posted on the 23rd April, 2012 – IT
Last modified on the 23rd April, 2012, at 8:16 pm

As I want to move from a self-signed to a true external authenticated SSL certificate I need to setup a email server for my domain. With Mac OS X 10.7 server installed this should be easy. However the get it working was not so obvious.

The first step is to make sure you DNS passes emails sent to domain name i.e. username@domain to a specific server. This involves setting up an MX record in the DNS. As I use DynDNS to manage my DNS entry this was easily setup in their web interface.

Then I port forwarded the IMAP and POP ports through my router to my server on my LAN.

The next step was to setup the actual mail service on my Mac OS X 10.7 server. The first major issue was to realise that there are two GUI application used to administer the server component of Mac OS X 10.7 server; Server.app and Server Admin.app. Why both are not installed when you purchase Mac OS X server from the apple store I don’t know. The admin app needs to be separately downloaded and installed and is key to this procedure.

In server.app turn on the mail service and add the domain name for which it should respond, in my case mattparkinson.eu hereafter replaced as example.com to stop issues.

Now in Server Admin.app select the mail service under the server. In the settings tab under general the domain name should be set. Under hostname add the internet host name of the mail server, in my case “mail”.

As I only want to use IMAP and need to be able to both send and receive email from this server I disabled POP, enabled SMTP and allowed incoming mail. Now under the advanced tap the authentication method were enabled with only KRAN-MD5 allowed for both SMTP and IMAP/POP.

By default email accounts are enabled on the server for all users using the combination of their short usernames and the domain i.e. username@domain. To add email aliases all you need todo is add username aliases to the respective user of the server. This is done in system preferences by option clicking on a user to edit the advanced options for that give user. Now just add any needed aliases for a user making sure that they are unique. I added ‘me’ and ‘postmaster’ thus enabling me@example.com and postmaster@example.com.

The final step was to setup the email client and test if email could be sent and received using the server both locally when on my LAN and from the internet through my router.

In mail.app or in any other email clients such as on an iPhone the account was setup using the following paramaters:

  • protocol IMAP
  • email address alias@example.com
  • server mail.example.com
  • username and password for the given user (not email alias)
  • authentication md5

After a bit of fiddling, the details of which I can no longer remember, things were working.