College Logo

Installing Postfix

Postfix is a Mail Transfer Agent (MTA) ? it can accept mail by listening on port 25 and then deliver it to an appropriate destination. You should have the postfix port ready to go so:

cd /usr/ports/mail/postfix
make install

- you don't need to tick any of the options.

Answer Y to the question: You need user "postfix" added to group "mail" and answer Y to the question: Would you like to activate Postfix in /etc/mail/mailer.conf [n]?

Postfix is now installed but you need to make sure that it will run each time the machine starts. I found most of the information below here.

The Unix equivalent of a Windows service is called a daemon and you can control the daemons which run when the machine starts using the /etc/rc.conf file. Edit this file and add the lines:

sendmail_enable="YES"
sendmail_outbound_enable="NO"
sendmail_submit_enable="NO" 
sendmail_msp_queue_enable="NO"

Now you need to disable some Sendmail-specific daily maintenance routines by creating /etc/periodic.conf (if it doesn't already exist) and adding the lines:

daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"

This file is used by cron ? the equivalent of Windows scheduled tasks and we'll see more of that later.

Even if you're not going to use any mail aliases you need an alias database. Check the contents of the file /etc/mail/aliases for more information and then create the database by typing:

/usr/local/bin/newaliases 

Postfix depends on 2 main configuration files ? main.cf and master.cf which will be in /usr/local/etc/postfix by default. The only change I made was in main.cf where I added:

relay_domains = cnwl.ac.uk

Restart the machine after this so that postfix will be started in the normal way. (You don't actually need to restart the server but I like to when I've made major changes to installed software - it gives me confidence that if ever the machine has to be restarted that the relevant software will start. If it doesn't then I find out now when there's no panic rather than later...)