User:Hannes Röst/postfix

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Postfix is a free and open-source mail transfer agent (MTA) that routes and delivers electronic mail. You can use postfix for example to

  • receive email from a local program that wants to send email
  • receive email over SMTP (from an email client or from another server)
  • decide what to do with that email (e.g. deliver it locally or relay it to yet another server)
  • process it in a number of ways

=> See Postfix Overview for a good overview over the way a message takes when processed through postfix.

The /etc/postfix/ file stores site specific Postfix configuration parameters while /etc/postfix/ defines daemon processes. The Postfix Basic Configuration tutorial covers the core settings that each site needs to consider.

Basic setup[edit]

The Postfix Documentation or the Ubuntu:Postfix main page are good places to start.


How do I switch between mbox and maildir?[edit]

The slash after the directory in /etc/aliases says whether mbox or maildir should be used.

# use a maildir
testuser:      /var/mail/testuser/
# use a mbox
othertestuser:      /var/mail/othertestuser

How do I relay all undeliverable mail[edit]

This creates a "catch-all" address for local relay if no user can be found to relay the mail to (main.config)

# /etc/postfix/ 
#relay all UNDELIVERABLE email to
luser_relay =
local_recipient_maps =

How to use 2 or more content filters[edit]

Try to do that:

Postfix:25 -> ClamAV:10025 -> Postfix:10026 -> dspam:10000 -> Postfix:10027

using those commands:


unanswered forum thread:

How do I add a mail filter (e.g. sieve) to a postfix / dovecot setup?[edit]

see here

How do I allow one person to send emails for another person?[edit]

smtp_generic_maps is a possible solution here since it only rewrite outgoing email.

Create a user, e.g. called send_for_xxx and give it a username/pw. Then use the smtp_generic_maps entry in

smtp_generic_maps = hash:/etc/mail/generic

to add a rewrite of the sender email address:


see also and