Fixing the variable
If you'd like to make this change system wide I'd be inclined to add an entry in the directory /etc/profile.d
for it. You can simply put a file in there with the contents as follows:
# /etc/profile.d/mailenv.sh
MAIL=$HOME/Maildir
or
MAILDIR=$HOME/Maildir
This environment variable, $HOME
, should be in scope when the user logs in. We're putting this entry in /etc/profile.d
so that it gets sourced when a user logs in, into their shell's environment. From then on, any subsequent "interactive" shells they may spawn will inherit the environment variable from the original parent shell.
mu-tool
You can also install the mailutils
package:
$ sudo apt-get install mailutils
Which includes the tool mu-tool
. The following command will show your mail setup.
$ mu-tool info
VERSION=2.99.97
SYSCONFDIR=/etc
MAILSPOOLDIR=/var/mail/
SCHEME=mbox
LOG_FACILITY=mail
IPV6
USE_LIBPAM
HAVE_LIBLTDL
WITH_GDBM
WITH_GNUTLS
WITH_GSASL
WITH_GSSAPI
WITH_GUILE
WITH_PYTHON
....
Consolidating mbox
I don't think you want to do this. When dealing with mail there are usually 2 locations that you need to have. The first is often referred to as the spool or "post office". This is a location where the mail server can deliver mail. The other is your mailbox (aka. mbox
).
The mail
man page hints at this too:
/var/mail/* post office (unless overridden by the MAIL
environment variable)
~/mbox user’s old mail
When the same server is tasked with spooling the mail, and allowing the user to read the mail, then these 2 directories will reside on the same box, in different locations. When reading the mail using something like POP or IMAP the "post office" will reside on that server and your mailbox will reside locally on whatever client you happen to be using.
References