mail

NAME

mail - send or read mail

SYNOPSIS

mail [-e] [-f file]

mail name ...

DESCRIPTION

You can use the mail(1) utility to read or send mail messages. It is a minimal environment.

To read mail, invoke mail(1) without any arguments. The mail(1) utility opens your mailfile (or the mailfile specified with the -f option). The default mailfile is /var/mail/name, where name is your login name, including your domain name. Additional commands available during mail reading sessions are described in this topic.

To send mail, invoke mail(1) with the name of a user as the operand. The mail(1) utility then takes standard input up to the end of file or a line consisting of only a dot character (.) and adds it to the mailfile of the user name.

The mail(1) command takes the following options:

-e
Test for new mail, but display nothing. Exits with success if there is mail present, failure if there is not.
-f file
Read mail from the specified file instead of from the default mailbox.

On startup, the mail(1) utility reads the startup file /etc/mail.rc, which contains commands (as documented in the mailx(1) reference page). It then reads the startup file $HOME/.mailrc.

Mail reading commands

The mail(1) utility accepts the following commands:

<newline>
Go on to next message.
<EOF>
Store undeleted mail and quit.
!command
Execute the named command in the shell.
+
Go on to next message (same as newline).
-
Go back to previous message.
d
Delete the message and go on to the next message.
m[name...]
Mail the message to one or more users named name; if no user is specified, the message is mailed to the user who invoked mail(1).
p
Display message again.
q
Store undeleted mail and quit; same as end-of-file (EOF).
s[file]
Save the message in file. If no file is named, save it in the file ~/mbox.
w[file]
Save the message without its headers in file. If no file is named, save it in the file ~/mbox.
x
Exit mail(1), undoing all changes to the mailfile in this session. Put all mail back in the mailfile and stop.

DIAGNOSTICS

The mail(1) command can exit with one of the following:

0
The user had mail and the session completed successfully.
1
The user had no mail or there was an initialization error.
>1
An error occurred after initialization.

ENVIRONMENT VARIABLES

The mail(1) command makes use of the following environment variables, if set:

HOME
The user's home directory.
TZ
The current time zone; used in determining the setting of certain date and time strings.

FILES

The mail(1) utility makes use of the following files:

/var/mail/name
Default mailbox file.
$HOME/mbox
Default storage location for read mail messages.

NOTES

The mail(1) and the mailx(1) commands are the same image. If invoked as mail(1), it behaves as mail(1); if invoked as mailx(1), it behaves as mailx(1). When invoked as mail(1), it ignores the contents of the mailx(1) startup files (/etc/mailx.rc and $HOME/.mailrc).

The mail(1) command by itself has no ability to send mail to users on other hosts on the network. That requires a mail routing agent and a mail transfer agent, neither of which is provided with Interix.

The mail(1) command is actually the mailx(1) command; if invoked as mail(1), it behaves as described on this page.

In all other ways, mail(1) behaves as though it were mailx(1) with the following options set:

oneintr
Abort the current letter on one interrupt rather than two.
replacedeadletter
Replace the dead.letter files instead of appending to them.
savelocal
Try to save the dead.letter file in the current directory rather than in the home directory.
set dot
End message entry on a dot character (.) instead of a tilde (~).
set escape=
Disable tilde (~) escapes.
set noheader
Do not print a message summary on startup.
set quiet
Do not print other messages on startup.

See the mailx(1) reference page for more details.

SEE ALSO

mailx(1)