4

I am trying to setup procmail as a mail delivery agent (MDA) for postfix. I understand that I should use the mailbox_command option in postfix for this, but an internet search revealed contradicting advice on how exactly to do this:

  • Several sources suggest to just use

    mailbox_command = /usr/bin/procmail
    

    Examples can be found here and here.

  • Some sources suggest using the -f option, e.g. as in

    mailbox_command = /usr/bin/procmail -f-
    

    See for example here. This seems to adjust the date in From lines.

  • Some sources suggest using procmail in "delivery mode", i.e. using the -d option:

    mailbox_command = /usr/bin/procmail -d ${USER}
    

    See for example here and here.

(There are many variations of these three approaches, e.g. using -a to pass information to the procmail recipes or setting MAILDIR.)

What are the advantages and disadvantages of the three approaches? And in particular, what is the effect of using "delivery mode"?

jochen
  • 278
  • 4
  • 9
  • 1
    `-d` is for when Procmail is invoked as root; but with `mailbox_command`, it won't be -- Postfix will already run it with the recipient's UID and GID. Similarly, `-f-` is probably not necessary with Postfix, as there should not be a `From_` line on the incoming message. – tripleee Aug 20 '15 at 18:21

1 Answers1

2

postfix executes mailbox_command with uid of the recipient. It should make -d ${USER} unnecessary.

http://www.postfix.org/postconf.5.html#mailbox_command

mailbox_command (default: empty)
Optional external command that the local(8) delivery agent should use for mailbox delivery. The command is run with the user ID and the primary group ID privileges of the recipient. Exception: command delivery for root executes with $default_privs privileges.

AnFi
  • 1,516
  • 7
  • 10