MAIL(1) MAIL(1) NAME mail, edmail, sendmail, seemail, aliasmail, smtp, smtpd, to, vwhois, vismon - mail commands SYNOPSIS mail [ arg ... ] upas/edmail [ -cmpre ] [ -[fF] mfile ] upas/sendmail [ -xr# ] person ... upas/to [ -x# ] seemail [ -as ] [ -u user ] [ -f file ] [ -r reminders ] upas/aliasmail name ... smtp [ -fdu ] [ -hhost ] [ -ggateway ] [ .domain ] address sender rcpt-list smtpd [ -d ] vwhois people ... vismon system DESCRIPTION Mail Mail invokes edmail -m when no persons appear on the command line. It invokes sendmail otherwise. Mailbox Editing Edmail edits a mailbox. The default mailbox is /mail/box/username/mbox. The -f and -F command line options and the s and S editing commands specify an alternate mail- box. Unrooted path names are interpreted relative to /mail/box/username for -f and s and relative to the current directory for -F and S. If the mfile argument is omitted, the name defaults to stored. The options for edmail are: -c Create a mailbox. -r Reverse: print mail in first-in, first-out order. -p Print all the mail messages without prompting for commands. -m Use a manual style of interface, that is, print no messages unless directed to. -f mfile Read messages from the specified file (see above) instead of the default mailbox. Page 1 Plan 9 (printed 11/18/24) MAIL(1) MAIL(1) -F mfile same as -f with different starting point for rela- tive paths (see above). -e Check silently if there is anything in the mail- box; return zero (true) if so, non-zero otherwise. Edmail prints messages one at a time, prompting between mes- sages. After printing a prompt edmail reads a line from the standard input to direct disposition of the message. Com- mands, as in ed(1), are of the form `[range] command [arguments]'. The command is applied to each message in the (optional) range addressed by message number and/or regular expressions in the style of ed(1). A regular expression in slashes searches among header (postmark) lines; an expres- sion in percent signs searches on message content. address to indicate a single message header address,address to indicate a range of contiguous message headers g/expression/ to indicate all message headers matching the reg- ular expression. The commands are: b Print the headers for the next ten messages. d Mark message to be deleted upon exiting edmail. h Print the disposition, size in characters, and header line of the message. m person ... Mail the message to the named persons. M person ... Same as m except that lines typed on the terminal (terminated by EOT) are prefixed to the message. p Print message. An interrupt stops the printing. r Reply to the sender of the message. R Like `r' but with the message appended to the reply. s mfile (Save) Append the message to the specified mail- box (see above). S mfile Same as s with different starting point for rela- tive paths (see above). q Put undeleted mail back in the mailbox and stop. EOT (control-D) Same as `q'. w file Same as s with the mail header line(s) stripped. W file Same as w with different starting point for rela- tive paths (see above). u Remove mark for deletion. x Exit, without changing the mailbox file. ? Print a command summary. |command Run the command with the message as standard input. !command Escape to the shell to do command. Page 2 Plan 9 (printed 11/18/24) MAIL(1) MAIL(1) = Print the number of the current message. Sending Mail Sendmail takes the standard input up to an end-of-file and adds it to each person's mailbox. When running in an 8½(1) window, sendmail automatically puts the window into Hold mode (see 8½(1)); this means that the message can be edited freely, because nothing will be sent to sendmail until the ESC key is hit to exit Hold mode. With option -#, sendmail does not send mail, but instead reports what command would be used to send the mail. With option -x, sendmail does not send mail, but instead reports the full mail address of the recipient. Option -r tells sendmail that its input is via a pipe from another program. It won't turn on Hold mode and will expect a From line at the start of the message to pro- vide the name of the sender and timestamp. The message is automatically postmarked with the sender's name and date. Lines that look like postmarks are prefixed with `>'. Person is a user name on the local system, a name for which there is an alias, or a network mail address. To is a preprocessor for sendmail. It takes a mail message as standard input, looks through it for To:, Cc:, and Bcc: header lines, and calls sendmail with the addresses in those header lines as destinations. The Bcc: header lines are removed before passing the message to sendmail. Addressing Conventions The local convention for converting addresses is given by rewrite rules in /mail/lib/rewrite; see rewrite(6). The con- ventions generally used are: - A person containing no `!' or `@' is considered a local user or local alias. It is passed as an argument to aliasmail which returns either the expanded alias or local!person if there is no alias of that name. - A canonical network mail address has the form machine!...!name, with one or more machines mentioned. Aliasmail Aliasmail expands mail aliases, its arguments, according to alias files. Each line of an alias file begins with # (com- ment) or with a name. The rest of a name line gives the expansion. The expansion may contain multiple addresses and may be continued to another line by appending a backslash. Items are separated by white space. In expanding a name, the sender's personal alias file Page 3 Plan 9 (printed 11/18/24) MAIL(1) MAIL(1) /mail/box/username/names is checked first. Then the system alias files, listed one per line in /mail/lib/namefiles, are checked in order. If the name is not found, the expansion is taken to be local!name. Mailboxes Incoming mail for a user username is put in the file /mail/box/username/mbox unless either the file /mail/box/username/forward or /mail/box/username/pipeto exists. The mailbox must have append-only and exclusive- access mode (see chmod(1)). A user must create his or her own mailbox using the -c option of edmail. Mailboxes are created writable (append-only) but not readable by others. Forwarding If the file /mail/box/username/forward exists and is read- able by everyone, incoming mail will be forwarded to the addresses contained in the first line of the file. The file may contain multiple addresses. Forwarding loops are caught and resolved by local delivery. Filtering If the file /mail/box/username/pipeto exists and is readable and executable by everyone, it will be run for each incoming message for the user. The message will be piped to it rather than appended to his/her mail box. The file is run as user none. Misc The seemail command notifies when a new message arrives in your mailbox. It reads a log file, default /sys/log/mail, of incoming messages. It runs continuously where it is invoked, displaying the names and icons of senders of new messages. The -a flag causes it to initialize by displaying all the faces in the log; -s causes it to overwrite multiple appearances of the same face rather than repeatedly display- ing it. The -u option displays incoming mail for the speci- fied user instead of yourself. Seemail's -r option causes it to announce appointments described in the file reminders. Each line of the appoint- ment file contains the month, day, hour, minute and room (any string of non-spaces) of an appointment, in a format compatible with calendar(1). The hour is 24-hour time. The fields may be separated by white space, commas, slashes or colons, and the room may be followed by arbitrary text. On the day of each appointment, seemail displays a clock-face icon with the appointment's room and time, once at midnight (or when the program starts), then an hour before, then 15 minutes before, then 1 minute before, then at the appoint- ment time. At the same time, it displays the room and any following text on a line below the clock time at the top of Page 4 Plan 9 (printed 11/18/24) MAIL(1) MAIL(1) its window. Vwhois just displays in the seemail window the icons of people. Vismon is a version of seemail that connects to a remote Unix (not Plan 9) system to look for mail arriving there. Smtp sends the mail message from standard input to the users rcpt-list on the host at network address address using the Simple Mail Transfer Protocol. The return address of the mail will contain the local system name from the environment variable sysname and the user sender. If .domain is given, it is appended to the end of the system name. The -u option sends the mail in the standard Unix format instead of RFC822 format. The -f flag just prints out the converted message rather than sending it to the destination. The -g option specifies a gateway system to pass the message to if smtp can't find an address or MX entry for the destination sys- tem. The -d option turns on debugging output to standard error. Smtpd receives a message using the Simple Mail Transfer Pro- tocol. Standard input and output are the protocol connec- tion. The -d option turns on debugging output to standard error. Smtpd is normally run by a network listener such as listen(8). FILES /sys/log/mail mail log file /mail/box/* mail directories /mail/box/*/mbox mailbox files /mail/box/*/forward forwarding address(es) /mail/box/*/pipeto mail filter /mail/box/*/L.reading mutual exclusion lock for multiple mbox readers /mail/box/*/L.mbox mutual exclusion lock for altering mbox /mail/box/*/dead.letter unmailable text /mail/box/*/names personal alias files /mail/lib/rewrite rules for handling addresses /mail/lib/namefiles lists files to search for aliases in /lib/face/48x48x? directories of icons for seemail SOURCE /rc/bin/mail /sys/src/cmd/upas source for commands in /bin/upas /sys/src/cmd/seemail /rc/bin/vismon /rc/bin/vwhois SEE ALSO Page 5 Plan 9 (printed 11/18/24) MAIL(1) MAIL(1) face(6), rewrite(6) BUGS Edmail truncates long headers for searching. Page 6 Plan 9 (printed 11/18/24)