1 MAIL(1)                          User Commands                         MAIL(1)
   2 
   3 
   4 
   5 NAME
   6        mail, rmail - read mail or send mail to users
   7 
   8 SYNOPSIS
   9    Sending Mail
  10        mail [-tw] [-m message_type] recipient...
  11 
  12 
  13        rmail [-tw] [-m message_type] recipient...
  14 
  15 
  16    Reading Mail
  17        mail [-ehpPqr] [-f file]
  18 
  19 
  20    Debugging
  21        mail [-x debug_level] [other_mail_options] recipient...
  22 
  23 
  24 DESCRIPTION
  25        A recipient is usually a domain style address ("user@machine") or a
  26        user name recognized by login(1). When recipients are named, mail
  27        assumes a message is being sent. It reads from the standard input up to
  28        an end-of-file (Control-d) or, if reading from a terminal device, until
  29        it reads a line consisting of just a period. When either of those
  30        indicators is received, mail adds the letter to the mailfile for each
  31        recipient.
  32 
  33 
  34        A letter is composed of some header lines followed by a blank line
  35        followed by the message content. The header lines section of the letter
  36        consists of one or more UNIX postmarks:
  37 
  38          From sender date_and_time [remote from remote_system_name]
  39 
  40 
  41 
  42 
  43        followed by one or more standardized message header lines of the form:
  44 
  45          keyword-name: [printable text]
  46 
  47 
  48 
  49 
  50        where keyword-name is comprised of any printable, non-whitespace
  51        characters other than colon (`:'). A MIME-version: header line
  52        indicates that the message is formatted as described in RFC 2045. A
  53        Content-Length: header line, indicating the number of bytes in the
  54        message content, is always present unless the letter consists of only
  55        header lines with no message content. A Content-Type: header line that
  56        describes the type of the message content (such as text/plain,
  57        application/octet-stream, and so on) is also present, unless the letter
  58        consists of only header lines with no message content. Header lines may
  59        be continued on the following line if that line starts with white
  60        space.
  61 
  62 OPTIONS
  63    Sending Mail
  64        The following command-line arguments affect sending mail:
  65 
  66        -m message_type
  67                           A Message-Type: line is added to the message header
  68                           with the value of message_type.
  69 
  70 
  71        -t
  72                           A To: line is added to the message header for each
  73                           of the intended recipients.
  74 
  75 
  76        -w
  77                           A letter is sent to a remote recipient without
  78                           waiting for the completion of the remote transfer
  79                           program.
  80 
  81 
  82 
  83        If a letter is found to be undeliverable, it is returned to the sender
  84        with diagnostics that indicate the location and nature of the failure.
  85        If mail is interrupted during input, the message is saved in the file
  86        dead.letter to allow editing and resending. dead.letter is always
  87        appended to, thus preserving any previous contents. The initial attempt
  88        to append to (or create) dead.letter is in the current directory. If
  89        this fails, dead.letter is appended to (or created in) the user's login
  90        directory. If the second attempt also fails, no dead.letter processing
  91        is done.
  92 
  93 
  94        rmail only permits the sending of mail; uucp(1C) uses rmail as a
  95        security precaution. Any application programs that generate mail
  96        messages should be sure to invoke rmail rather than mail for message
  97        transport and/or delivery.
  98 
  99 
 100        If the local system has the Basic Networking Utilities installed, mail
 101        can be sent to a recipient on a remote system. There are numerous ways
 102        to address mail to recipients on remote systems depending on the
 103        transport mechanisms available to the local system. The two most
 104        prevalent addressing schemes are Domain-style and UUCP-style.
 105 
 106        Domain-style addressing
 107                                   Remote recipients are specified by appending
 108                                   an `@' and domain (and possibly sub-domain)
 109                                   information to the recipient name (such as
 110                                   user@sf.att.com). (The local system
 111                                   administrator should be consulted for
 112                                   details on which addressing conventions are
 113                                   available on the local system.)
 114 
 115 
 116        UUCP-style addressing
 117                                   Remote recipients are specified by prefixing
 118                                   the recipient name with the remote system
 119                                   name and an exclamation point, such as
 120                                   sysa!user. If csh(1) is the default shell,
 121                                   sysa\!user should be used. A series of
 122                                   system names separated by exclamation points
 123                                   can be used to direct a letter through an
 124                                   extended network (such as
 125                                   sysa!sysb!sysc!user or
 126                                   sysa\!sysb\!sysc\!user).
 127 
 128 
 129    Reading Mail
 130        The following command-line arguments affect reading mail:
 131 
 132        -e
 133                   Test for the presence of mail. mail prints nothing.
 134 
 135                   An exit status of 0 is returned if the user has mail.
 136                   Otherwise, an exit status of 1 is returned.
 137 
 138 
 139        -E
 140                   Similar to -e, but tests only for the presence of new mail.
 141 
 142                   An  exit  status  of 0 is returned if the user has new
 143                   mail to read,  an exit status of 1 is returned if the
 144                   user  has no mail,  or an exit status of 2 is returned
 145                   if the user has mail which has already been read.
 146 
 147 
 148        -h
 149                   A window of headers are initially displayed rather than the
 150                   latest message. The display is followed by the ? prompt.
 151 
 152 
 153        -p
 154                   All messages are printed without prompting for disposition.
 155 
 156 
 157        -P
 158                   All messages are printed with all header lines displayed,
 159                   rather than the default selective header line display.
 160 
 161 
 162        -q
 163                   mail terminates after interrupts. Normally an interrupt
 164                   causes only the termination of the message being printed.
 165 
 166 
 167        -r
 168                   Messages are printed in first-in, first-out order.
 169 
 170 
 171        -f file
 172                   mail uses file (such as mbox) instead of the default
 173                   mailfile.
 174 
 175 
 176 
 177        mail, unless otherwise influenced by command-line arguments, prints a
 178        user's mail messages in last-in, first-out order. The default mode for
 179        printing messages is to display only those header lines of immediate
 180        interest. These include, but are not limited to, the UNIX From and
 181        >From postmarks,      From:, Date:, Subject:, and Content-Length: header
 182        lines, and any recipient header lines such as To:, Cc:, Bcc:, and so
 183        forth. After the header lines have been displayed, mail displays the
 184        contents (body) of the message only if it contains no unprintable
 185        characters. Otherwise, mail issues a warning statement about the
 186        message having binary content and not display the content. This can be
 187        overridden by means of the p command.
 188 
 189 
 190        For each message, the user is prompted with a ? and a line is read from
 191        the standard input. The following commands are available to determine
 192        the disposition of the message:
 193 
 194        #
 195                              Print the number of the current message.
 196 
 197 
 198        -
 199                              Print previous message.
 200 
 201 
 202        <new-line>,+, or   n
 203                              Print the next message.
 204 
 205 
 206        !command
 207                              Escape to the shell to do command.
 208 
 209 
 210        a
 211                              Print message that arrived during the mail
 212                              session.
 213 
 214 
 215        d, or dp
 216                              Delete the current message and print the next
 217                              message.
 218 
 219 
 220        d n
 221                              Delete message number n. Do not go on to next
 222                              message.
 223 
 224 
 225        dq
 226                              Delete message and quit mail.
 227 
 228 
 229        h
 230                              Display a window of headers around current
 231                              message.
 232 
 233 
 234        hn
 235                              Display a window of headers around message number
 236                              n.
 237 
 238 
 239        h a
 240                              Display headers of all messages in the user's
 241                              mailfile.
 242 
 243 
 244        h d
 245                              Display headers of messages scheduled for
 246                              deletion.
 247 
 248 
 249        m [ persons ]
 250                              Mail (and delete) the current message to the
 251                              named persons.
 252 
 253 
 254        n
 255                              Print message number n.
 256 
 257 
 258        p
 259                              Print current message again, overriding any
 260                              indications of binary (that is, unprintable)
 261                              content.
 262 
 263 
 264        P
 265                              Override default brief mode and print current
 266                              message again, displaying all header lines.
 267 
 268 
 269        q, or Control-d
 270                              Put undeleted mail back in the mailfile and quit
 271                              mail.
 272 
 273 
 274        r [ users ]
 275                              Reply to the sender, and other users, then delete
 276                              the message.
 277 
 278 
 279        s [ files ]
 280                              Save message in the named files (mbox is default)
 281                              and delete the message.
 282 
 283 
 284        u [ n ]
 285                              Undelete message number n (default is last read).
 286 
 287 
 288        w [ files ]
 289                              Save message contents, without any header lines,
 290                              in the named files (mbox is default) and delete
 291                              the message.
 292 
 293 
 294        x
 295                              Put all mail back in the mailfile unchanged and
 296                              exit mail.
 297 
 298 
 299        y [ files ]
 300                              Same as -w option.
 301 
 302 
 303        ?
 304                              Print a command summary.
 305 
 306 
 307 
 308        When a user logs in, the presence of mail, if any, is usually
 309        indicated. Also, notification is made if new mail arrives while using
 310        mail.
 311 
 312 
 313        The permissions of mailfile can be manipulated using chmod(1) in two
 314        ways to alter the function of mail. The other permissions of the file
 315        can be read-write (0666), read-only (0664), or neither read nor write
 316        (0660) to allow different levels of privacy. If changed to other than
 317        the default (mode 0660), the file is preserved even when empty to
 318        perpetuate the desired permissions. (The administrator can override
 319        this file preservation using the DEL_EMPTY_MAILFILE option of
 320        mailcnfg.)
 321 
 322 
 323        The group ID of the mailfile must be mail to allow new messages to be
 324        delivered, and the mailfile must be writable by group mail.
 325 
 326    Debugging
 327        The following command-line arguments cause mail to provide debugging
 328        information:
 329 
 330        -x debug_level
 331                          mail creates a trace file containing debugging
 332                          information.
 333 
 334 
 335 
 336        The -x option causes mail to create a file named /tmp/MLDBGprocess_id
 337        that contains debugging information relating to how mail processed the
 338        current message. The absolute value of debug_level controls the
 339        verboseness of the debug information. 0 implies no debugging. If
 340        debug_level is greater than 0, the debug file is retained only if mail
 341        encountered some problem while processing the message. If debug_level
 342        is less than 0, the debug file is always be retained. The debug_level
 343        specified via -x overrides any specification of DEBUG in
 344        /etc/mail/mailcnfg. The information provided by the -x option is
 345        esoteric and is probably only useful to system administrators.
 346 
 347    Delivery Notification
 348        Several forms of notification are available for mail by including one
 349        of the following lines in the message header.
 350 
 351 
 352        Transport-Options: [ /options ]
 353 
 354 
 355        Default-Options: [ /options ]
 356 
 357 
 358        >To: recipient [      /options ]
 359 
 360 
 361        Where the "/options" can be one or more of the following:
 362 
 363        /delivery
 364                       Inform the sender that the message was successfully
 365                       delivered to the recipient's mailbox.
 366 
 367 
 368        /nodelivery
 369                       Do not inform the sender of successful deliveries.
 370 
 371 
 372        /ignore
 373                       Do not inform the sender of failed deliveries.
 374 
 375 
 376        /return
 377                       Inform the sender if mail delivery fails. Return the
 378                       failed message to the sender.
 379 
 380 
 381        /report
 382                       Same as /return except that the original message is not
 383                       returned.
 384 
 385 
 386 
 387        The default is /nodelivery/return. If contradictory options are used,
 388        the first is recognized and later, conflicting, terms are ignored.
 389 
 390 OPERANDS
 391        The following operand is supported for sending mail:
 392 
 393        recipient
 394                     A domain style address ("user@machine") or user login name
 395                     recognized by login(1).
 396 
 397 
 398 USAGE
 399        See largefile(5) for the description of the behavior of mail and rmail
 400        when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 401 
 402 ENVIRONMENT VARIABLES
 403        See environ(5) for descriptions of the following environment variables
 404        that affect the execution of mail: LC_CTYPE, LC_MESSAGES, and NLSPATH.
 405 
 406        TZ
 407              Determine the timezone used with date and time strings.
 408 
 409 
 410 EXIT STATUS
 411        The following exit values are returned:
 412 
 413        0
 414              Successful completion when the user had mail.
 415 
 416 
 417        1
 418              The user had no mail or an initialization error occurred.
 419 
 420 
 421        >1
 422              An error occurred after initialization.
 423 
 424 
 425 FILES
 426        dead.letter
 427                            unmailable text
 428 
 429 
 430        /etc/passwd
 431                            to identify sender and locate recipients
 432 
 433 
 434        $HOME/mbox
 435                            saved mail
 436 
 437 
 438        $MAIL
 439                            variable containing path name of mailfile
 440 
 441 
 442        /tmp/MLDBG*
 443                            debug trace file
 444 
 445 
 446        /var/mail/*.lock
 447                            lock for mail directory
 448 
 449 
 450        /var/mail/:saved
 451                            directory for holding temp files to prevent loss of
 452                            data in the event of a system crash
 453 
 454 
 455        /var/mail/user
 456                            incoming mail for user; that is, the mailfile
 457 
 458 
 459        /var/tmp/ma*
 460                            temporary file
 461 
 462 
 463 SEE ALSO
 464        chmod(1), csh(1), login(1), mailx(1), uucp(1C), uuencode(1C),
 465        vacation(1), write(1), attributes(5), environ(5), largefile(5)
 466 
 467 
 468        Solaris Advanced User's Guide
 469 
 470 NOTES
 471        The interpretation and resulting action taken because of the header
 472        lines described in the Delivery Notifications section only occur if
 473        this version of mail is installed on the system where the delivery (or
 474        failure) happens.  Earlier versions of mail might not support any types
 475        of delivery notification.
 476 
 477 
 478        Conditions sometimes result in a failure to remove a lock file.
 479 
 480 
 481        After an interrupt, the next message might not be printed. Printing can
 482        be forced by typing a p.
 483 
 484 
 485 
 486                                  May 17, 2020                          MAIL(1)