Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mail(1) — bsd — Apollo Domain/OS SR10.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

binmail(1)

fmt(1)

newaliases(1)

aliases(5)

mailaddr(7)

sendmail(8)

MAIL(1)                              BSD                               MAIL(1)



NAME
     mail - send and receive mail

SYNOPSIS
     mail [ -v ] [ -i ] [ -n ] [ -d ] [ -s subject ] [ user ...  ]
     mail [ -v ] [ -i ] [ -n ] -f [ name ]
     mail [ -v ] [ -i ] [ -n ] -u user

INTRODUCTION
     mail is a intelligent mail-processing system, similar in command syntax
     to ed(1), with lines replaced by messages. Note that information about
     this command refers to /usr/ucb/mail; do not confuse it with /bin/mail,
     which is documented under the binmail(1) command.

     To send a message to one or more people, invoke mail with arguments that
     are the names of intended recipients. Then type in your message, followed
     by an EOF (CTRL/D) at the beginning of a line.  Use -s on the command
     line, to specify a subject.

     In normal usage mail is given no arguments and checks your mail out of
     the post office, then prints a one-line header of each message there.
     The current message is initially the first message (numbered 1) and you
     can use the print command (abbreviated as p) to print it.  You can move
     among the messages much as you move between lines in ed(1), with the
     commands `-' and `+' moving backwards and forwards. You can also specify
     absolute message numbers.

     After examining a message, you can delete (d) the message or reply (r) to
     it.  Deletion causes the mail program to forget about the message.  This
     is not irreversible; you can undelete (u) the message by giving its
     number, or you can abort the mail session by giving the exit (x) command.

     You can give a list of message numbers to commands such as print and
     delete, as arguments to apply to a number of messages at once.  Thus
     delete 1 2 deletes messages 1 and 2, while delete 1-5 deletes messages 1
     through 5.  The asterisk addresses all messages, and ($) addresses the
     last message; thus you can use the command top (which prints the first
     few lines of a message) in the form top * to print the first few lines of
     all messages.

     Use the reply command to respond to the originator of a message.  The
     text you then type in, up to an end-of-file, comprises the contents of
     the message.  While you are composing a message, mail treats lines
     beginning with a tilde (~) specially.  For instance, typing ~m alone on a
     line places a copy of the current message into the response, right-
     shifting it by a tabstop.  Other escapes set up subject fields, add and
     delete recipients to the message, and allow you to escape to an editor to
     revise the message or to a shell to run some commands.

     Use the quit (q) command to end a mail session. mail sends messages that
     you examined to your mbox file unless you delete them, in which case it
     discards them.  It sends unexamined messages back to the post office.

     You can also create a personal distribution lists so that, for instance,
     you can send mail to "cohorts" and have it go to a predefined group of
     people.  Define such a list by placing a line like

          alias cohorts bill larry shemp

     in the file .mailrc in your home directory.  Use the alias (a) command in
     mail.  to display the current list of aliases.  You can create system-
     wide distribution lists by editing /usr/lib/aliases.  Refer to aliases(5)
     and sendmail(8); these aliases are kept in a different syntax.  mail
     expands personal aliases in mail sent to others so that they can reply to
     the recipients.  mail does not expand system-wide aliases when it sends
     mail, but any reply returned to the machine has the system-wide alias
     expanded as all mail goes through sendmail(8).

     To send network mail (ARPA, UUCP, Berknet), see mailaddr(7) for a
     description of network addresses.

COMMANDS
     Put each command on a line by itself, with arguments following the
     command word.  You can use the full command name or its valid
     abbreviation.  If a command normally takes a message list as an argument
     but you do not specify a message list, mail uses the next message forward
     that satisfies the command's requirements.  If there are no messages
     forward of the current message, mail searches backwards, and if there are
     no good messages at all, it responds with "No applicable messages" and
     aborts the command.

     -           Go to the previous message and print it.  If you specify a
                 numeric argument n, go to the nth previous message and print
                 it.

     ?           Print a brief summary of commands.

     !           Execute the shell command that follows.

     Print (P)   This command is like print but it also prints out ignored
                 header fields. See also print, ignore, and retain.

     Reply (R)   Reply to originator. This command does not reply to other
                 recipients of the original message.

     Type (T)    Identical to the Print command.

     alias (a)   If you do not specify an argument, print all currently-
                 defined aliases. If you specify one argument, print that
                 alias.  If you specifyWith more than one argument, create a
                 new alias or change an old one.  The alias command is usually
                 used in the ~/.mailrc file.

     alternates (alt)
                 Inform mail that the listed addresses are really you.  When
                 you reply to messages, mail does not send a copy of the
                 message to any address listed on the alternates list. If you
                 specify the alternates command with no argument, it displays
                 the current set of alternate names.  The alternates command
                 is useful if you have several accounts, and is usually used
                 in the ~/.mailrc file.

     chdir (c)   Change your working directory to the one specified.  If you
                 do not specify a directory, change to your log-in directory.

     copy (co)   Peform the same action as save, but do not mark the given
                 messages for deletion.

     delete (d)  Take a list of messages as argument and mark them for
                 deletion.  mail does not save deleted messages in mbox, and
                 they are not available to most other commands.

     dp (or dt)  Delete the current message and print the next message.  If
                 there is no next message, mail displays "at EOF."

     edit (e)    Edit the specified message(s) using the program indicated by
                 the EDITOR string option.
     exit (ex or x)
                 Return immediately to the shell without modifying your system
                 mailbox, your mbox file, or your edit file if using the
                 option -f.

     file (fi)   This command is the same as folder.

     folders     List the names of the folders in your folder directory.

     folder (fo) Switch to a new mail file or folder. If you do not specify an
                 argument, identify which file you are currently reading.  If
                 you specify an argument, write out changes (such as
                 deletions) made in the current file and read in the new file.
                 mail recognizes some special conventions for the name: a
                 pound sign (#) means the previous file, a percent sign (%)
                 means your system mailbox, a percent sign and a username
                 (%user) means user's system mailbox, an ampersand (&) means
                 your ~/mbox file, and +folder means a file in your folder
                 directory (determined by the value of the folder option
                 discussed below).

     from (f)    Print the message headers of the list of messages.

     headers (h) Display one windowful of header lines from the messages
                 around the current message. See also the z command.

     help        This command is a synonym for ?

     hold (ho)   Take a message list and mark each message in it to be saved
                 in the user's system mailbox instead of in mbox.  Do not
                 override the delete command.

     ignore      Add the list of header fields named to the ignore list.
                 Header fields in the ignore list are not displayed on your
                 terminal when you print a message. This command is very handy
                 for suppressing certain machine-generated header fields. You
                 can use the type and print commands to print a message in its
                 entirety, including ignored fields. If you specify ignore
                 with no arguments, it lists the current set of ignored
                 fields. Note that ignore has been superseded by retain.

     mail (m)    Send mail to the specified users and/or distribution groups
                 given as arguments.

     mbox        Indicate a list of messages be added to mbox in your home
                 directory when you quit. This is the default action for
                 messages you have read if you have not set the hold option.

     next (n)    Go to the next message in sequence and type it. You can also
                 use a plus sign (+) or a carriage return.  If you specify an
                 argument list, next displays the next matching message.

     preserve (pre)
                 This command is a synonym for hold.

     print (p)   Take a message list and display each message on your
                 terminal.

     quit (q)    Terminate the session, saving all undeleted, unsaved messages
                 in your ~/mbox file, preserving all unread messages and those
                 marked with hold or preserve in your system mailbox, and
                 deleting all other messages.  If new mail arrives during the
                 session, display the message "You have new mail".  If you
                 specify quit while editing a mailbox file with the -f flag,
                 save the file with changes.  Return to the shell unless the
                 rewrite of the edit file fails, in which case you can escape
                 with the exit command.

     reply (r)   Send mail to the sender and all original recipients of the
                 specified message. Reply to current message if you do not
                 specify one.  You cannot reply to a message marked for
                 deletion.

     respond     This command is a synonym for reply.

     retain      Add the named list of header fields to the "retain list."
                 mail displays only the header fields in the retain list when
                 you print a message; it suppresses all other header fields.
                 You can use the type and commands to print a message in its
                 entirety.  If you specify retain with no arguments, it lists
                 the current set of retained fields.

     save (s)    Take a message list and a filename and append each message in
                 turn to the end of the file.  mail echoes the filename in
                 quotation marks, followed by the line count and character
                 count after the append, on your terminal.  It also marks each
                 message for deletion.

     set (se)    If you do not specify an argument, print all option variable
                 values.  Otherwise, set an option.  Arguments are of the form
                 "option=value" (no space before or after =) or, in the case
                 of Boolean variables, "option."

     shell (sh)  Invoke an interactive version of the shell.

     size        Print the size in characters of each message in the specified
                 list.

     source (so) Read mail commands from a file.

     top         Print the top few lines of each message in the given list.
                 The variable toplines controls the number of lines printed.
                 (The default value is five.)

     type (t)    This command is a synonym for print.

     unalias     Take a list of names defined by alias commands and discard
                 the remembered groups of users.  The group names no longer
                 have any significance.

     undelete (u)
                 Mark each message in the given list as not deleted.

     unread (U)  Mark each message in the given list as unread.  Unread
                 messages return to your system mailbox when you quit the
                 session.

     unset       Discard the values of a list of option names; do the inverse
                 of set.

     visual (v)  Invoke the display editor (defined by the option string
                 VISUAL) on each message in the given list.

     write (w)   This command is similar to save, except that only the message
                 body (without the header) is saved.  write is very useful for
                 tasks such as sending and receiving source-program text over
                 the message system.

     xit (x)     This command is a synonym for exit.

     z           Present message headers in windowsful as described in the
                 headers command.  This command differs from headers in that z
                 displays the range following that presented by the last h or
                 z command; thus sequential z commands advance through the
                 available messages, increasing the current message number
                 accordingly. Use z- tomove backwards.

TILDE ESCAPES
     When composing messages with mail, you can use tilde (~) escape commands
     to perform special functions.  Tilde escapes are recognized only at the
     beginning of lines.  The name "tilde escape" is somewhat of a misnomer
     because you can use the option escape to set the actual escape character.

     ~!command   Execute the indicated shell command, then return to editing
                 the message.

     ~b name ... Add the names to the list of carbon copy recipients but do
                 not show the names in the cc: line (that is, make "blind"
                 carbon copies).

     ~cname...   Add the names to the list of carbon copy recipients.

     ~d          Read the file dead.letter from your home directory into the
                 message.

     ~e          Invoke the text editor (as specified with the EDITOR string
                 option) on the messages collected so far.  When the editing
                 session is finished, you can continue appending text to the
                 message.

     ~f messages Read the messages into the message being sent.  If you do not
                 specify a message, read in the current message.

     ~h          Edit the message header fields by displaying each one in turn
                 and allowing the user to append text to the end or modify the
                 field by using the current terminal erase and kill
                 characters.  If mail is being run in a pad, you will be
                 prompted for changes to the existing header values.  A
                 carriage return will leave the value unchanged, entering a
                 blank in the first position will remove the entry, and
                 entering a new header value will replace the existing header
                 value.

     ~m messages Read the messages into the message being sent, shifted right
                 one tab.  If you do not specify a message, read the current
                 message.

     ~p          Print the message collected so far, prefaced by the message
                 header fields.

     ~q          Abort the message being sent, copying the message to
                 dead.letter in your home directory if save is set.

     ~r filename Read the named file into the message.

     ~s string   Make string the current subject field.

     ~t name ... Add names to the direct-recipient list.

     ~v          Invoke an alternate editor (defined by the VISUAL option) on
                 the messages collected so far.  The alternate editor is
                 usually a screen editor.  After you quit the editor, you can
                 resume adding text to the end of your message.

     ~w filename Write the message into the named file.

     ~|command   Pipe the message through command as a filter.  If the command
                 gives no output or terminates abnormally, retain the original
                 text of the message.  The fmt(1) command is often used to
                 rejustify the message.

     ~~string    Insert the string in the message, prefaced by a single tilde
                 (~).  If you have changed the escape character, you should
                 double that character in order to send it.


OPTIONS CONTROLLED BY SET AND UNSET
     Use the set and unset commands to control options.  Options may be
     binary, in which case you need only see whether they are set or not, or
     string, in which case the actual value is of interest.  The binary
     options include the following:

     append         Cause messages saved in mbox to be appended rather than
                    prefixed.

     ask            Cause mail to prompt you for the subject of each message
                    you send.  If you respond with a newline, mail does not
                    send a subject field.

     askcc          Cause mail to prompt you for additional carbon copy
                    recipients at the end of each message.  Responding with a
                    newline indicates your satisfaction with the current list.

     autoprint      Causes the delete command to behave like dp:  when you
                    delete a message, mail displays the next one
                    automatically.

     debug          The effect is the same as specifying -d on the command
                    line: cause mail to output information useful for
                    debugging mail.

     dot            Cause mail to interpret a period alone on a line as the
                    terminator of the message being sent.

     hold           Hold read messages in the system mailbox by default.

     ignore         Cause interrupt signals from your terminal to be ignored
                    and echoed as @'s.

     ignoreeof      Cause mail to refuse to accept a CTRL/D as the end of a
                    message.  This option also applies to mail command mode.

     metoo          Include the sender in the expanded group.  Usually, when a
                    group containing the sender is expanded, the sender is
                    removed from the expansion.

     nosave         Prevent the normal copying of a partial letter to the file
                    dead.letter in your home directory when you abort a
                    message with two interrupts.

     Replyall       Reverse the sense of reply and Reply commands.

     quiet          Suppress the printing of the version when first invoked.

     verbose        Has the same effect as using the -v flag on the command
                    line. When mail runs in verbose mode, the actual delivery
                    of messages is displayed on your terminal.

     The following options have string values:

     EDITOR         Pathname of the text editor to use in the edit command and
                    ~e escape.  If you do not define an editor, mail uses a
                    default.
     PAGER          Pathname of the program to use in the more command or when
                    the crt variable is set. If you do not define a paginator,
                    mail uses a default.

     SHELL          Pathname of the shell to use in the ! command and the ~!
                    escape.  If you do not define a shell, mail uses a
                    default.

     VISUAL         Pathname of the text editor to use in the visual command
                    and ~v escape.

     crt            Determines how long a message must be before PAGER is used
                    to read it.

     escape         If defined, the first character of this option gives the
                    character to use in place of the tilde (~) to denote
                    escapes.

     folder         The name of the directory to use for storing folders of
                    messages. If this name begins with a slash (/), mail
                    considers it to be an absolute pathname; otherwise, mail
                    finds the folder directory relative to your home
                    directory.

     record         If defined, gives the pathname of the file used to record
                    all outgoing mail.  If not defined, outgoing mail is not
                    saved.

     toplines       If defined, gives the number of lines of a message to be
                    printed out with the top command.  Normally the first five
                    lines are printed.

COMMAND LINE OPTIONS
     -v        Set verbose mode: display details of delivery on your terminal.

     -i        Ignore tty interrupt signals. This is particularly useful when
               using mail on noisy phone lines.

     -n        Inhibit the reading of /usr/lib/Mail.rc.

     -d        Forces mail to deliver mail to user directly, either by copying
               the message into a local mailbox or through uucp if the
               recipient's address includes a '!' character.  When invoked
               without the -d switch, mail calls sendmail for mail delivery.
               In the sendmail configuration file, the -d switch is typically
               included in the mail mailer definition to avoid infinite
               looping.

     -s        Specify a subject line when sending mail.  Only the first
               argument after the -s option is used as a subject.  Make sure
               to enclose subjects containing spaces in quotation marks.

     -f        Read in the contents of your mbox (or the specified file) for
               processing.  Upon termination of the session, write undeleted
               messages back to this file.

     -u user   Read in the contents of /usr/spool/mail/user for processing.
               Upon termination of the session, write undeleted messages back
               to this file.

FILES
     /usr/spool/mail/*        Post office
     ~/mbox                   Your old mail
     ~/.mailrc                File giving initial mail commands
     /tmp/R#                  Temporary for editor escape
     /usr/lib/Mail.help*      Help files
     /usr/lib/Mail.rc         System initialization file
     Message*                 Temporary for editing messages

BUGS
     Many flags that are not useful to the general user are not documented
     here.

     Usually, mail is just a link to Mail, which can be confusing.

SEE ALSO
     binmail(1), fmt(1), newaliases(1), aliases(5), mailaddr(7), sendmail(8)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026