The first thing to sort out is which mail program you are using when you run mail
.
Do this:
$ command -v mail # (Similar to the old `which`.) You'll likely see:
/usr/bin/mail
Then see what this is:
$ ls -l /usr/bin/mail # And now you'll likely see (at least for Debian):
lrwxrwxrwx 1 root root 22 Feb 17 2019 /usr/bin/mail -> /etc/alternatives/mail
Then see where that is:
$ ls -l /etc/alternatives/mail # And I get:
lrwxrwxrwx 1 root root 23 Dec 10 19:58 /etc/alternatives/mail -> /usr/bin/mail.mailutils
And finally check this out:
$ ls -l /usr/bin/mail.mailutils
-rwxr-xr-x 1 root root 218160 Nov 18 2020 /usr/bin/mail.mailutils
So when you are running mail
, you are actually running mail.mailutils
. Also notice that it's owned by root, but everyone has permission to run read and execute it.
Now looking at the configuration documentation for the mailutils
package, we see that there are many possible methods for configuration, including:
System wide configuration in /etc/mailutils.conf
, or
User over-rides in /home/[your-username]/.mail
, or even
Startup overrides with mail --file /var/mail/[your-username]
Settings from method 2 overrides method 1, and method 3 overrides both methods 2 and 1.
One important point is that the mailbox format doesn't have to be mbox
(single large files with multiple messages in each file). It can also be mailbox
format (or a tree of individual files). There are also other formats available, like mh
.
For the first two options above you will likely want to use a URL
mailbox {
# Create mailbox URL using PATTERN.
# (preferred way of configuring mailbox locations)
mailbox-pattern PATTERN;
}
Like this:
mailbox { mailbox-pattern "/var/mail/${user}"; }
Another important point is that your system has two places for your mailboxes:
- Incoming messages are in one place, typically
/var/mail/[username]
, and
- read messages are, depending on the mailbox format, in either:
/home/[your-username]/mbox
or
/home/[your-username]/mailbox/*
.
If you're using any of the mailutils programs, you can see how your system is configured with:
$ mailutils info # which gives you something like this:
VERSION=3.10
SYSCONFDIR=/etc
MAILSPOOLDIR=/var/mail
SCHEME=mbox
LOG_FACILITY=mail
...
Finally, don't confuse the two different uses of the term 'spool' as related to mail. exim4 has what it calls a spool, which is where it holds messages waiting to be delivered, and then when you go to read emails some people say you're reading from the mail spool. It is probably better to remember that you're reading from a mailbox, and that only exim4 has a spool. For locally delivered messages exim4 reads a message from it's spool, and puts it into your mailbox, normally in /var/mail/[your-username]
if you're using mbox
.
Also note that you must be in the mail
group, as others above have clarified. What they didn't tell you was that you might need to reboot to make your addition to the mail group stick and show up when you open a terminal window. Simply opening another terminal windows won't have you in that group, and logging out and re-logging in won't fix it either.
So now that you know which mailbox you're trying to read, you can look at it's permissions to see if you need to update them or not.
ls -l /var/mail
command?-rw-rw---- 1 1006 mail 2037 2013-08-10 12:38 abuse
ls -l /var/mail/fmaster
?-rw-rw---- 1 fmaster mail 2035 2013-08-10 00:16 fmaster
. And what is the output ofgroups fmaster
?