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 you in and outbound mail. The set-up described here will distribute inbound mail to Dovecot IMAP server and outbound mail to an internet service provider.
Distribution 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 to store your mail into. See Dovecot for a possible set-up. Without a proper mail storage you might have difficulty access you 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.
/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.
Step 2: setup relay passwords
TODO
Step 3: starting the daemon
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?
Attachments
-
Restart_Postfix.command
(0.6 KB) - added by martin.osx@…
6 months ago.
Z-Shell script to restart postfix.
-
Test_Postfix.command
(449 bytes) - added by martin.osx@…
6 months ago.
Z-Shell script to test postfix configurartion
-
main.cf
(26.8 KB) - added by martin.osx@…
6 months ago.
Postfix configuration

