postfix

Monitoring

To view the queue:

postqueue -p

Send

To check if the system is correctly configured to send system emails try:

mail root
mail patrick

Fill in the details, then Ctrl D when you finish writing the message.

Note

To check email from Flowable you need to set up a workflow.

Errors

Postfix writes to syslog. To extract all the postfix entries:

sudo cat /var/log/syslog | parse-log - postfix'

Tip

I think all the postfix programs (eg qmngr, smtpd, etc) prefix their program name in the log with postfix.

Configuration

Application (Django / Flowable)

To use postfix installed using our Salt states (as detailed below):

Use TLS           False / No
Host              localhost
Port              25

pillar

The SMTP server details are stored in a config file e.g. config/postfix/office365.sls:

mail_server:
  smtp_relay_host: 11.1.111.11
  smtp_relay_port: 25

Add the following to the sites pillar e.g. sites/KB101.sls:

server_meta:
  mail_domain: KB101
  admin_email: patrick@kbsoftware.co.uk
  smtp_tls_security_level: may
  sender_rules:
    /.*/: noreply@kbsoftware.co.uk
  • To find the mail_domain, log onto the server and run hostname -f.

  • sender_rules is the from address. This address will be used for sending all the emails. This is a useful for Office 365 SMTP servers, because all email must be sent from a specific domain. (I think the regular expression, /.*/:, matches all emails).

Linux

The main configuration file is /etc/postfix/main.cf. It includes the following:

  • /etc/aliases, where mail to root should go.

  • smtp_generic_maps, a catch all (for /etc/aliases)

  • sender_canonical_maps, is used to change the from address.

  • relayhost instructs Postfix to forward everything.

  • If using SparkPost (see mail for more information), authentication details will be added to /etc/postfix/main.cf.

Maintenance

Warning

Think carefully before running the following command…

Delete all messages in the queue:

postsuper -d ALL

Questions

Are these error messages?:

match_list_match: permit_mynetworks: no match