Postfix

From LQWiki
Jump to: navigation, search

The Postfix MTA is a sendmail alternative created by Wietse Venema that is designed to be faster, much easier to administer and more secure than sendmail. It is said that in achieving these design goals, it is less flexible than sendmail. Postfix generally works without much input by the system administrator and can drop right in and transparently replace a sendmail installation.

How to get it

Install Postfix as described at Installing Software. If you need a modified Postfix, download the source code, then compile, link and install it. For downloading, visit http://www.postfix.org. Building is described at Compilation from source.

How to use it

To see if your Postfix is configured properly, send yourself a mail:

$ sendmail -t me@home.org
FROM:me@server.org
TO:me@home.org
SUBJECT:test
this is a sendmail test

Stop your input by typing CTRL_D. In this case, me@home.org is your e-mail-address.

How to configure it

Deliver all mail to procmail

To make your postfix MTA deliver all mail to procmail for further processing,

  • make sure procmail is installed
  • enter in /etc/postfix/main.cf a line like:
mailbox_command = /usr/bin/procmail
  • restart your postfix
/etc/init.d/postfix restart

Catch-all e-Mail addresses

Imagine you have a domain example.org and want all mails for this domain in a mailbox, so, no more "user does not exist" replies to senders. Then you configure a catch-all for this domain.

Go to webmin->servers->postfix->virtual domain Enter a Domain mapping lookup table. Click on "new" and map, e.g. example.org to exampleuser.

Allow sending from a MUA

Imagine you have a mail server running postfix and you want to use it in a MUA (e.g. kmail) as smtp server. This will most likely fail with an error message like

Relay access denied

And you will have no chance to authenticate. To change this, add

smtpd_sasl_auth_enable=yes

to /etc/postfix/main.cf, and outcomment all lines starting with tlsmgr in /etc/postfix/master.conf.

Working with the Mail Queue

The outgoing mail queue is often stuck, so here's how you deal with that:

To watch your outgoing mail queue, use the command

mailq

To read your outgoing mail queue, use webmin which has an own module for Postfix.

To flush your mail queue, use

postqueue -f

To delete a mail from your mail queue, find out its mail-id by running

mailq

then delete the mail by running

postsuper -d mail-id

See also

External links