How to set up postfix¶
Postfix is a UNIX mail server.
On Beautiful Canoe servers we use it to send security updates and similar to
sudo apt-get install postfix
sudo yum install postfix
/etc/postfix/main.cf in your favourite text editor and search for
This should be set to:
relayhost = [smtp.aston.ac.uk]
Restart postfix to apply the configuration changes:
sudo systemctl restart postfix
Open SMTP in the firewall¶
Ensure that SMTP services can get through the firewall:
sudo ufw allow smtp
To test postfix, send an email from the command line, which requires the
sudo apt-get install mailutils mail -s Test USER@aston.ac.uk <<<"Test"
and check that the email arrives in your usual mailbox.
Set up the aliases database¶
If you now look in
/var/log/syslog you are likely to see lines like this:
... postfix/local: warning: hash:/etc/aliases is unavailable. open database /etc/aliases.db: No such file or directory ... postfix/local: warning: hash:/etc/aliases: lookup of 'root' failed
At this stage, the file
/etc/aliases has been created by postfix, but the database
/etc/aliases.db has not.
To fix this, run
sudo postalias /etc/aliases
Configure cron jobs to send emails¶
anacron are UNIX utilities to run commands at specified intervals, usually hourly, daily, weekly or monthly.
These utilities are usually used to automate server management tasks such as performing backups and rotating logs.
cron to send email to a mailbox that is likely to be read (rather than
/etc/anacrontab and change the line that starts with