wiki:howto/MailServerTutorial

<- Back to the HOWTO section

Tutorial for the setup of an electronic mail (E-mail) server using MacPorts software

  • Audience: Advanced setup of Electronic Mail
  • Requires: MacPorts >= 1.9.1
  • Created: 31 July 2010; Revision: 31 July 2010

Introduction

Despite its simple seeming exterior, Electronic Mail is a complex interaction of multiple different pieces of software from many sources. Fortunately, MacPorts has made the porting and installation of these parts on an OSX system "easy."

Decisions made by the System Administrator (i.e. the person installing the software) control the various features available for mail delivery, mail reading and system maintenance.

This document represents an attempt to describe a step by step process to convert OSX Snow Leopard (1.6) running on something like a MacMini into a mail server for a Home user(s) or Small business (SoHo - Small office/Home office http://en.wikipedia.org/wiki/Small_office/home_office). It attempts to gather into one location information which is useful or necessary to accomplish this goal. Consequently, this document may seem a bit long-winded, but major portions of it can be skipped by those who are familiar with the details.

The goal here is to create a system which utilizes MacPorts and native Apple software so that the resulting system becomes as "automagically" self-maintaing, and as immune to "gotchas' caused by Apple system updates as possible.

See also the MacPorts HowTos: Fetchmail -> Postfix -> Dovecot for additional discussions and perspectives on the process.

A list of Home pages for the various products discussed can be found at the end of this document:

Why did I write this?

Even though I've been a Unix System Administrator for over 30 years and have done this many different times, every time I do it on a new system, I find that not only do I have to start over again from scratch because the technology has "changed" (or probably more correctly "morphed") but that I have to keep trying to find my "old notes." .... :) And, invariably, I find I have "forgotten" to do something "FIRST" necessitating one to start over again.

This document represents "my favorite" Electronic Mail tools. All are "Open Software" of one form or another -- most under the GPL - http://www.gnu.org/licenses/gpl.html

There are other options available.

Step 1: Do a little planning

For a starting definition of terms and concepts.... http://wiki2.dovecot.org describes Dovecot V2.0 -- including an excellent "Generic information about mail servers!"

An excellent graphical depiction of the Electronic Mail process can be found at: http://workaround.org/ispmail/lenny/bigpicture

Consider the software functionality which you might want to provide and the software necessary to install (AND maintain).

  • MUA - Mail User Agent aka Email Client - used by the end user to read their mail.
    • Apple Mail - implying mail readable from a single location or computer.
    • Webmail - mail readable from any location via a web browser.
  • MTA - Mail Transfer Agent - used by two mail servers to exchange (i.e. send and receive) electronic mail over the Internet using the SMTP protocol.
    • Postfix
  • MDA - Mail Delivery Agent - This provides an interface between the MTA and the UserDovecot / Procmail
    • POP
    • IMAP
    • Fetchmail - a remote-mail retrieval and forwarding utility
  • SASL - authorization
  • Spam Assassin - Spam Scan

OSX 10.6 contains an installation of Procmail. This version can be utilized or disabled and replace by the MacPorts install. This document will describe the MacPorts installation of Procmail.

One of the goals of this installation will be to provide both Local (single PC) and Remote Access (webmail) consequently we will configure IMAP as the primary protocol for the mail server and require that the Apple Mail client "leave mail on the server" in its configuration.

Similarly, Apple Mail provides functionality similar to FetchMail and Spam Assassin. However, the advantage of using Fetchmail is that it both runs "constantly," not just when the mail client is launched, but that it collects mail

Step 2 "Where are you going to put things?"

Most everything can be put where MacPorts and/or Apple wants to put them with no problem. The only item of particular concern is the location of the mail spool, as this could become potentially large and one might want to place it on a separate disk.

Similarly, by configuring log files to be in default areas, makes them readily available to the Apple Utility, Console.

Step 3 "Install and configure Apache2, MySQL, and PHP"

I will assume that Apache2 has already been installed. That installation will (should have) include MySQL and PHP. See: howto/MAMP" (aka MAMP) for detailed instructions.

Step 4 Install and configure Procmail

Apple provides a procmail installation (as it does with the Apache web server. We will use the MacPorts versions of both these servers and their respective "dependencies."

The MacPorts default installation of Procmail will configure itself to use /opt/local/ as the root of its storage system.

TODO: still much more to write?

Optional Parts

fetchmail is a full-featured IMAP and POP client which allows users to automatically download mail from remote IMAP and POP servers and save it into local mailboxes; there it can be accessed more easily

  • SASL
  • Spam Assassin
  • Clam Antivirus

TODO: still much more to write?

<- Back to the HOWTO section

Last modified 2 weeks ago Last modified on Nov 27, 2017, 3:26:37 PM