The Postfix Cheat Sheet

mail-iconI recently had some trouble with my postfix mail service. Not knowing where to being looking for log files and restart commands, I thought this quick cheat sheet would come in handy in the future:

Starting and Stopping

On CentOS we can speak to postfix like this:

postfix start
postfix stop
postfix reload

The this command re-reads the configuration files. Note that there is no restart command – you have to stop and then start the service again manually.

Log Files

On CentOS 6.5 I could find the log files in /var/log/maillog (that’s a file not a directory). Other installations may have it in /var/log/mail. Refer to your own /etc/syslog.conf file for the exact location.

To display log events life we can make use of tail -f

tail -f /var/log/maillog

Alternatively we can come through the entire log and display the tricky bits:

egrep '(warning|error|fatal|panic):' /var/log/maillog | more

Note that log files are rotated – what you’re looking for may be hiding in other log files (such as maillog-201xxxxx).

Postfix in Plesk

If you’re using Plesk then you can see the individual components of the service under Tools and Settings (or Server if you’re using Power User View) – Services Management. You can start/stop/restart each aspect from here.

Sometimes the SMTP service appears to be offline even though it’s running. This can happen on CentOS. It’s nothing to worry about – simply restart the service from the command line as explained above and it should show up fine in Plesk.

Screen Shot 2014-03-10 at 14.51.03

Further Reading

If you have any further ideas, please let me know in a comment below.

You can leave a comment on my original post.