- parameter: mailbox_command
- default: (empty)
- versions: ?
Optional external command that the local 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. This is not a problem, because:
- mail for root should always be aliased to a real user and
- don't log in as root, use "su" instead.
The following environment variables are exported to the command:
- Remote client network address. Available in Postfix version 2.2 and later.
- Remote client EHLO command parameter. Available in Postfix version 2.2 and later.
- Remote client hostname. Available in Postfix version 2.2 and later.
- Remote client protocol. Available in Postfix version 2.2 and later.
- The domain part of the recipient address.
- The optional address extension.
- The recipient home directory.
- The recipient address localpart.
- The recipient's username.
- The entire recipient address, before any address rewriting or aliasing.
- The full recipient address.
- SASL authentication method specified in the remote client AUTH command. Available in Postfix version 2.2 and later.
- SASL sender address specified in the remote client MAIL FROM command. Available in Postfix version 2.2 and later.
- SASL username specified in the remote client AUTH command. Available in Postfix version 2.2 and later.
- The full sender address.
- The recipient's login shell.
- The recipient username.
Unlike other Postfix configuration parameters, the mailbox_command parameter is not subjected to $name substitutions. This is to make it easier to specify shell syntax (see example below).
If you can, avoid shell meta characters because they will force Postfix to run an expensive shell process. If you're delivering via Procmail then running a shell won't make a noticeable difference in the total cost.
Note: if you use the mailbox_command feature to deliver mail system-wide, you must set up an alias that forwards mail for root to a real user.
The precedence of local delivery features from high to low is: aliases, .forward files, mailbox_transport_maps, mailbox_transport, mailbox_command_maps, mailbox_command, home_mailbox, mail_spool_directory, fallback_transport_maps, fallback_transport and luser_relay.
- mailbox_command = /some/where/procmail
- mailbox_command = /some/where/procmail -a "$EXTENSION"
- mailbox_command = /some/where/maildrop -d "$USER" -f "$SENDER" "$EXTENSION"