Software > My PostFix Setup

My PostFix Setup

My PostFix Setup

(Last update: 2005-07-30

If you used sendmail in Jaguar, you've noticed that Panther replaced it with postfix. Actually, sendmail appears to be still present, but in fact now it's just a stub that redirects everything to postfix for backwards compatibility (see man sendmail).

I was using sendmail in Jaguar mostly to get emailed the output of my cron tasks, and here's how I set up postfix to achieve the same result in Panther and Tiger. This may not be the best way, but it's been working fine here for years, now. OTOH, incoming emails are blocked by the firewall, on my machines, so if this is not your case make sure to check the postfix man page (man postfix), the aliases man page (man 5 aliases) and the contents of /etc/postfix/ (AFAIK, postfix's incoming access is closed by default).

I. Setting up postfix's config

The only thing I had to add in there is my domain name:

  1. First, backup the original file:
    sudo ditto /etc/postfix/ /etc/postfix/
  2. Then open /etc/postfix/ (still as root):
    % sudo pico /etc/postfix/
  3. Locate the INTERNET HOST AND DOMAIN NAMES section. It ends with:
    #myhostname = host.domain.tld
    #myhostname = virtual.domain.tld
  4. Create a new line below, and type (using your own domain name, of course):
    myhostname =
  5. Save and close /etc/postfix/

II. Setting up the aliases file

  1. Go to /etc
    % cd /etc
  2. Notice that etc contains a symlink named "aliases" that points to "/postfix/aliases. Rather than editing that file, we'll create our own. First we rename that alias:
    % sudo mv aliases aliasesReadme
  3. Then we'll copy the contents of the file it points to:
    % cat postfix/aliases
  4. This file starts with a sample of the config file, followed with the man page. Since we only want the config part, copy everything above the line that goes:
    # ALIASES(5)               ALIASES(5)
  5. Create a new aliases file in /etc:
    % sudo pico aliases
  6. Paste the config sample copied from postfix/aliases.
  7. Locate the line that reads:
    # Person who should get root's mail. Don't receive mail as root!
  8. On the line below ( "#root: you"), replace "you" with your short username, and remove the pound ('#'). This line instructs postfix to forward to you the emails sent to root.
  9. Save and close the file.
  10. Now run the following to rebuild aliases.db:
    % sudo newaliases

III. Sending out

So far the emails aren't sent out and are visible only in Terminal (see man mail). But it's very easy to get them sent to your public email address, so they'll show up in your emailer wherever you are:

  1. Open or create ~/.forward:
    % pico ~/.forward
  2. Just enter your email address (with no quotes). If you want the messages redirected to several addresses, put them each on a different line. And if you want to get the emails in Terminal too, add your short username.
  3. Save and close the file.

IV. Launching the mail server at startup

It's necessary to make sure that the mailserver will be launched at startup, but the method isn't the same in Panther and Tiger:


  1. Run:
    % sudo pico /etc/hostconfig
  2. Locate MAILSERVER and make sure it's set to -YES-.
  3. Save and close the file.


  1. Run:
    % sudo pico /System/Library/launchDaemons/org.postfix.master.plist
  2. Locate <string>org.postfix.master</string>, create a new line bellow, and type the following lines:

    So at this point, the plist will begin with:
    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
    <plist version="1.0">
  3. Save and close the file.

V. Launching or reloading postfix

Finally, in Panther postfix has to be launched--or to be told to reload its config file if it's already running (this isn't necessary in Tiger):

  1. Run:
    % sudo postfix start
  2. If the result is postfix/postfix-script: fatal: the Postfix mail system is already running, then run:
    % sudo postfix reload
  3. This will reload postfix with the edited config file.

VI. Root's tasks reports

(That part was updated on 21/02/2005, thanks to John Baltutis' comments, to match system changes introduced later in Panther.)
With this setup, you'll get by email the result of your own cron tasks and the emails sent to root. However, by default the result of the root's cron maintenance task (the daily, weekly and monthly cleanup tasks) is written to the /var/log directory instead of being emailed. To get these by email too, it's necessary to override the task output variables resident in the periodic configuration file located at /private/etc/defaults/periodic.conf (periodic is the "engine" of cron). But rather than editing that file, we'll create our own periodic conf file :

  1. Open or create /etc/periodic.conf.local
    % sudo pico /etc/periodic.conf.local
  2. Add the following lines:
    daily_output="root /var/log/daily.out" #sends it to both
    weekly_output="root /var/log/weekly.out" #sends it to both
    monthly_output="root /var/log/monthly.out" #sends it to both
  3. Save and close the file.

 Previous Comments

There are no comments yet. Be the first to post one!

Please Log in if you wish to comment.