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:
- How to create Maildir directory with enough permissions for Postfix?
- /home/user directory permissions being set to 777
- 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.