wiki:howto/SetupPostfix

Version 15 (modified by magill@…, 13 years ago) (diff)

--

<- Back to the HOWTO section

How to set-up Postfix

  • Audience: Advanced E-Mail set-up
  • Requires: MacPorts >= 1.6, mail/postfix, shells/zsh-devel

Introduction

This How-to is part of the Fetchmail -> Postfix -> Dovecot advanced e-Mail set-up.

Postfix is a mail transfer agent which can distribute your in and outbound mail. The set-up described here will distribute inbound mail to a Dovecot IMAP server and outbound mail to an internet service provider.

Distribution of E-Mail directly to the end receiver is one of the joys of the internet which has been destroyed by SPAM.

Installation

First set-up a mail storage where postfix will store your mail. See Dovecot for a possible set-up. Without a proper mail storage you might have difficulty accessing your mail later.

Z-Shell

Install Z-Shell if you are planning to use the attached command files:

sudo port install zsh-devel

Postfix

Install postfix with:

port install postfix +tls +ldap

or - alternatively - use the postfix which comes pre installed with Max OSX.

Configuration

Most of the postfix configuration is done in the main.cf file which you find either in /opt/local/etc/postfix (macports) or /etc/postfix (OSX).

Step 1: setup main.cf

set hostname and domain

Search for my_computer and my_domain in main.cf and replace them with the domain name and computer name of your computer. You can find them out with the hostname command.

The following lines need attention:

myhostname = my_computer.local
mydomain = my_domain.com
mydestination = localhost,localhost.my_domain.com,my_computer,my_computer.local,my_computer.my_domain.com
masquerade_domains = my_domain.com

Note: if you don't use an domain name apart from .local then you can remove the duplicate.

set relayhost

Your outbound mail needs to go to a relayhost as most of us can't send e-mail directly any more. My relayhost is smtp.my_domain.com this does not need to be for you.

The following lines need attention:

relayhost = [smtp.my_domain.com]

/usr <-> /opt/local

Depending on which version of postfix (osx vs. macports) you use you have to change all lines containing /usr to /opt/local. The MacPorts installation automatically changes these in main.cf to /opt/local.

/private <-> /opt/local

Depending on which version of postfix (osx vs. macports) you use you have to change all lines containing /private to /opt/local. The MacPorts installation automatically changes these in main.cf to /opt/local.

verify your changes

Use "diff" to list the differences between the original (main.cf.sample) and the current main.cf file.

Note that "main.cf.default" lists all possible parameters and their defaults for the "cf" file.

Step 2: setup relay passwords

TODO

Step 3: starting the daemon

Restart_Postfix.command This command creates or updates the database files. Run via "sudo."

Step 4: testing the deamon

The attached Test_Postfix.command will send a test e-mail to your self - provided you replaced my_name and my_computer with your own name and computer name.

Optional Parts

TODO: What else can be done?

<- Back to the HOWTO section

Attachments (3)

Download all attachments as: .zip