2

In https://unix.stackexchange.com/a/21336/99621 it says that if you do

echo 'body' | mail -s 'subject' myuser

It will send a mail message to the myuser linux account on the local system that this user can check with the mail command. I tried sending mail to my own user account by running that command and it executes without any problems (no output in terminal and 0 exit code).

But when I type mail to check for mail, it says No mail for myuser.

If I replace the above mail sending command with one that doesn't exist, such as notexistinguser, the command still executes without any problems.

How can I send mail to a local Linux user account and check it? (I'm on a pretty minimal installation Archlinux.) I've also installed Postfix which is up and running with the default configuration, thought it might have interfered so I stopped it but still the same problem.

1

For mail to work as expected it requires a mail transfer agent (MTA), such as Sendmail, or Postfix. A minimal installation of Arch Linux includes neither.

You're on the right track installing Postfix. The Arch wiki has a guide for configuring Postfix specifically for local mail delivery here: Postfix - Local mail.

After modifying your /etc/postfix/main.cf configuration file with the changes suggested in the wiki article, you'll want to start the Postfix daemon with the following command:

$ systemctl start postfix

To permanently enable local mail delivery thereafter:

$ systemctl enable postfix

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.