Email - on Linux

About

Linux runs a “locally configured” mailer daemon that doesn't route messages by default through the Internet but only copies messages to other users spool directories

It is real SMTP-compliant email, it's just not routed over the Internet without configuration.

Locally email client send mail to other local users on the system by addressing to user@hostname, or by just specifying the user.

Mail location

It can be found in the MAIL environment variable

echo $MAIL
/var/spool/mail/root

This is called a spool file. Standard location are:

  • /var/mail/USER
  • or /var/spool/mail/USER

Local Client

#centos
yum install mailx
  • mutt
  • alpine
  • less (to probe the file)
# shows the latest mails, at the end if the file
less +G $MAIL 
less +G /var/spool/mail/root

Configuration

The configuration is done via the mail transfer agent (MTA) to forward the messages to an mail address.

PAM has a mail module to set some configuration at login See pam_mail

The variable environment MAIL set the path of a mailbox

MAIL=/var/spool/mail/nico





Discover More
What is Sendmail ?

Sendmail was the first well-known SMTP server. The server has the following components: * a mail transfer agent (MTA) to send mail to the outside world * a mail deliver agent (MDA) to receive email...



Share this page:
Follow us:
Task Runner