A menu will appear when you
make this port. Select the options Cyrus SASL v2 and Berkeley DB4.3. The script will ask whether you want to add the
postfix user to the
# cd /usr/ports/mail/postfix # make install clean # rehash
Enable Postfix at startup by adding the following to your /etc/rc/conf:
sendmail_enable="NONE" sendmail_flags="-bd" sendmail_pidfile="/var/spool/postfix/pid/master.pid" sendmail_outbound_enable="NO" sendmail_submit_enable="NO" sendmail_msp_queue_enable="NO"
Also create a symbolic link in the startup folder so that Postfix will start when the system boots:
# cd /usr/local/etc/rc.d # ln -s /usr/local/sbin/postfix postfix.sh
Then disable some Sendmail-specific daily maintenance routines in your /etc/periodic.conf file:
daily_clean_hoststat_enable="NO" daily_status_mail_rejects_enable="NO" daily_status_include_submit_mailq="NO" daily_submit_queuerun="NO"
With Postfix configured, create a needed file called alias.db, and then start it.
# newaliases # ls -l /etc/aliases.db # postmap /usr/local/etc/postfix/virtual # postfix start
Although the setup described in this article does not use this file, Postfix looks for it anyway. You may need this file depending on your future needs.
To test whether Postfix is running:
telnet localhost 25 You should see a prompt Trying 127.0.0.1... Connected to < your host name > Escape character is '^]'. quit
There is one final file to edit, /usr/local/etc/postfix main.cf. Change the entire main.cf as follows. (Again, bracketed numbers refer to footnotes, so remove them.)
command_directory = /usr/local/sbin daemon_directory = /usr/local/libexec/postfix mailq_path = /usr/local/bin/mailq manpage_directory = /usr/local/man newaliases_path = /usr/local/bin/newaliases queue_directory = /var/spool/postfix sample_directory = /usr/local/etc/postfix sendmail_path = /usr/local/sbin/sendmail mail_owner = postfix soft_bounce = no myhostname = domain1
myorigin = $mydomain relay_domains = $mydestination local_recipient_maps = $virtual_mailbox_maps recipient_delimiter = + debug_peer_level = 2 unknown_local_recipient_reject_code = 550 setgid_group = maildrop html_directory = no readme_directory = no masquerade_domains = $mydomain smtpd_recipient_restrictions = reject_non_fqdn_recipient permit_mynetworks reject_unauth_destination reject_unknown_sender_domain permit smtpd_helo_restrictions = reject_invalid_hostname smtpd_require_helo = yes mailbox_transport = lmtp:unix:/var/imap/socket/lmtp virtual_transport = lmtp:unix:/var/imap/socket/lmtp virtual_mailbox_domains = domain1, domain2
virtual_alias_maps = hash:/usr/local/etc/postfix/virtual
 The primary domain for email purposes.
 A list of all domains you plan to manage, including your primary domain.
For details on the options listed above, see /usr/local/etc/postfix/dist/main.cf.