Postfix mailer configuration

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
Postfix mailer configuration
__   _
  -o)/ /  (_)__  __ ____  __      Derek Winterstien
  /\\ /__/ / _ \/ // /\ \/ /      r.o.a.c.h.@.r.o.b.o.t.z...c.o.m
 _\_v __/_/_//_/\_,_/ /_/\_\      Trustix Secure Linux
..............................................................................

Postfix should be configured to start up on boot

  chkconfig Postfix on

Make some configuration changes in postfix

  vi /etc/postfix/main.cf

Add / Modify the following

inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
myorigin = $mydomain

Logs: (var/log/mail)

 debug
 errors
 info - mail delivery attempts
 notice
 warnings - such as hostname verification

Hosting Domains


  1. . canonical hostname and/or domain of machine
  2. . virtual alias domain virtual domain uses unix passwd system accounts
  3. . virtual mailbox domain virtual domain and independent accounts

Configuration: mailbox format


Choose a mailbox format. This guide will cover mbox as opposed to MailDir.

#!!  home_mailbox = Mailbox <- delete or remark out this line.  Do not specify
     the home_mailbox parameter for mbox style delivery.

  mail_spool_directory = /var/spool/mail

Configuration: main.cf


Edit main.cf

  myorigin

  mydestination

  mynetworks_style     ignord if mynetworks list specified

  mynetworks           you can specify a plain text file to contain valid

Example a10: mynetworks


You can list the relays in the main.cf file:

 mynetworks = 168.100.189.0/28, 127.0.0.0/8

Or refer to a hash file:

 mynetworks = hash:/etc/postfix/relay_table

Or a flat text file:

 mynetworks = /etc/postfix/relay_table

In the flat text file, # comments a line, an IP specifies a single host allowed relay. The sendmail format of a partial IP, X.X.X does NOT work. To specify a network use network metrics X.X.X.X/24

Example a20: virtual_alias_maps


You can specify a hash table file for virtual_alias_maps, which is simular to sendmail's 'virtusertable' file with one important difference: postfix virtual domains do not automatically map to unix system accounts.

  • Specify in main.cf:
 virtual_alias_maps = hash:/etc/postfix/virtusers
  • Format:
 username@virtualdomain.com	unixmailbox
  • Hash it:
 postmap virtusers
  • Explained:
The addess username@virtualdomain.com will be directed to the unix system

mailbox named unixmailbox.

Postfix Lookup Table Types: type:name


Not all of them, but on Linux here are a few important ones...

regexp regular expressions lookup table
hash   standard hash index file
sdbm   sdbm supported hash index file
pcre   perl style regular expressions table

Virtual Mailbox Domains and Non-UNIX Accounts


You must use a pop or imap server that is compatible with every recipient address having its own virtual mailbox. For example, popa3d is a great pop server known for simplicity and security, but it will not recognize your virtual, non system mailboxes.

Graylisting and spamd


Visit these updated and related pages