0

I have installed Postfix from source in the top level directory /srv/mail/.

I edit the main.cf file and add:

home_mailbox = mail/

When I then send a mail with:

sendmail -t localuser@localhost
> My message here
> .

The mail arrives in:

/home/localuser/mail/new/

Great. I now want to have the mail arrive in another directory NOT the home directory. For example, I would like the mail for user $userName to be sent to:

/path/to/mail/$userName/mail/

In the postfix default main.cf file, the variable mail_spool_directory is listed as:

# The mail_spool_directory parameter specifies the directory where
# UNIX-style mailboxes are kept. The default setting depends on the
# system type.

Originally, I thought this would mean I could set an absolute path under which to store mail. I set:

mail_spool_directory = /var/mail

which I thought, for mail sent to $userName@localhost, would store the mail under:

/var/mail/new/

Alas, this does not work. I still receive mail under the users home directory. The same outcome when the mail_spool_directory was commented.

I have searched online but to no avail. I have tried setting permissions of var/mail to 777. This has no effect on the outcome.

Some other posts I found which have not fixed the issue:

  1. How to create Maildir directory with enough permissions for Postfix?
  2. /home/user directory permissions being set to 777
  3. postfix and dovecot use /root/Maildir instead of /var/spool/mail

What am I not understanding about the setup of the postfix mail directory and meaning of mail_spool_dir?

According to an article I found online, I also attempted using the variable:

$user

within the postfix main.cf but postfix complained the variable was not set.

UPDATE

On the page: http://www.postfix.org/postconf.5.html#mailbox_transport , under mailbox_transport , it states: "

Optional message delivery transport that the local(8) delivery agent should use for mailbox delivery to all local recipients, whether or not they are found in the UNIX passwd database.

The precedence of local(8) 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.

" So perhaps mail_spool_directory is being ignored due to a higher priority directive ? Any guidance is greatly appreciated.

2
  • Are you looking for a pure-Postfix answer or for any answer that would work? Are you using any IMAP server or only direct Maildir access? Commented Jun 22 at 17:20
  • Only direct Maildir access and a pure Postfix answer, please. Commented Jun 22 at 17:22

1 Answer 1

0

As is mentioned in my post above, home_mailbox supersedes mail_spool_directory.

If any value is specified for home_mailbox, then the mail directory is set relative to the users home directory, as the directory defined by home_mailbox. Any value specified for mail_spool_directory is then ignored.

To define a mail directory outside of a users home directory, home_mailbox must not be defined. A value set for mail_spool_directory is then the absolute path of the directory for mail.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .