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

Tip

Check existing sites for mail_server configuration.

The SMTP server details are stored in the site file (server_meta, mail_server).

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

server_meta:

  mail_server:
    smtp_relay_host: smtp.sparkpostmail.com
    smtp_relay_port: 587
    smtp_username: SMTP_Injection
    smtp_password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    admin_email: patrick@kbsoftware.co.uk
    sender_rules:
      /.*@kbsoftware.co.uk/: patrick@kbsoftware.co.uk
  • sender_rules is the from address. This address will be used for sending all the emails. This is 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