MAIL(1)

๐Ÿ“ฆ
version 8.1.2-0.20220412cvs ยท 2 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’Œ MAIL(1) โ€” General Commands Manual ๐Ÿ’Œ

okay bestie, welcome to the MAIL(1) page. It's giving iconic Unix mail energy, and we're about to read every single detail together. No skimming, no cap. ๐Ÿ’–


โœจ NAME โœจ

mail, mailx, Mail โ€” send and receive mail. That's the whole vibe. ๐Ÿ’…


๐Ÿ“ฌ SYNOPSIS ๐Ÿ“ฌ

mail [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-r from-addr]
     [-s subject] [--] to-addr ...
mail [-dEIiNnv] -f [file]
mail [-dEIiNnv] [-u user]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

mail is an intelligent mail processing system which has a command syntax reminiscent of ed(1) with lines replaced by messages. It's literally ed(1) but make it mail, and we are obsessed. ๐Ÿ’…

The options are as follows:

  • -a โ€” Specify additional header fields on the command line such as "X-Loop: foo@bar" etc. It can be also used to override MIME headers mail adds by default to each outgoing mail, see โ€œCharacter sets and MIMEโ€ below. You have to use quotes if the string contains spaces. This argument may be specified more than once, the headers will then be concatenated. ๐Ÿซถ
  • -b bcc-addr โ€” Send blind carbon copies to bcc-addr. Sneaky but valid. ๐Ÿ™ˆ
  • -c cc-addr โ€” Send carbon copies to list of users. cc-addr should be a comma separated list of names. Commas are the moment. โœจ
  • -d โ€” Causes mail to output all sorts of information useful for debugging mail. It's giving debug mode, very loud. ๐Ÿ’€
  • -E โ€” Don't send messages with an empty body. No empty vibes allowed. ๐Ÿšซ
  • -f โ€” Use an alternate mailbox. Defaults to the user's mbox if no file is specified. When quit, mail writes undeleted messages back to this file. ๐Ÿ—‚๏ธ
  • -I โ€” Forces mail to run in interactive mode, even when input is not a terminal. In particular, the special ~ command character, used when sending mail, is only available interactively. So if you want the ~ escapes, you need this. ๐ŸŽ€
  • -i โ€” Ignore tty interrupt signals. This is particularly useful when using mail on noisy phone lines. Retro but valid. โ˜Ž๏ธ
  • -N โ€” Inhibits initial display of message headers when reading mail or editing a mail folder. Sometimes you just want the messages, not the header spam. ๐Ÿ™…โ€โ™€๏ธ
  • -n โ€” Inhibits reading /etc/mail.rc upon startup. No system rc for you. ๐Ÿ›‘
  • -r from-addr โ€” Use from-addr as the from address in the message and envelope. Overrides any from options in the startup files. Main character energy. ๐Ÿ‘‘
  • -s subject โ€” Specify subject on command line (only the first argument after the -s flag is used as a subject; be careful to quote subjects containing spaces). So -s "hi bestie" not -s hi bestie. ๐Ÿ˜ญ
  • -u user โ€” Equivalent to:
$ mail -f /var/mail/user

except that locking is done. Locking is the extra slay. ๐Ÿ”’

  • -v โ€” Verbose mode. The details of delivery are displayed on the user's terminal. You'll see everything. ๐Ÿ‘€
  • -- โ€” End of options. Any further argument is treated as a direct receipient address.
Note: For security reasons the -- separator is strongly recommended for scripts that need to send mails to addresses obtained from untrusted sources (such as web forms). This is not a drill. ๐Ÿšจ

๐Ÿš€ Startup actions ๐Ÿš€

At startup time, mail will execute commands in the system command file, /etc/mail.rc, unless explicitly told not to by using the -n option. Next, the commands in the user's personal command file ~/.mailrc are executed. mail then examines its command line options to determine whether the user requested a new message to be sent or existing messages in a mailbox to be examined. It's a whole little startup routine. โœจ


โœ‰๏ธ Sending mail โœ‰๏ธ

To send a message to one or more people, mail can be invoked with arguments which are the names of people to whom the mail will be sent. You are then expected to type in your message, followed by a control-D (โ€˜^Dโ€™) at the beginning of a line. The section below, โ€œReplying to or originating mailโ€, describes some features of mail available to help you compose your letter. So type, then ^D, and you're done. ๐Ÿ’Œ


๐Ÿ“ฅ Reading mail ๐Ÿ“ฅ

In normal usage, mail is given no arguments and checks your mail out of the post office, then prints out a one line header of each message found. The current message is initially set to the first message (numbered 1) and can be printed using the print command (which can be abbreviated p). Moving among the messages is much like moving between lines in ed(1); you may use + and - to shift forwards and backwards, or simply enter a message number to move directly. Very ed-coded, we love to see it. ๐Ÿ’…


๐Ÿ—‘๏ธ Disposing of mail ๐Ÿ—‘๏ธ

After examining a message, you can delete (d) or reply (r) to it. Deletion causes the mail program to forget about the message. This is not irreversible; the message can be undeleted (u) by giving its number, or the mail session can be aborted by giving the exit (x) command. Deleted messages, however, will usually disappear, never to be seen again. So be careful, bestie. ๐Ÿ˜ญ


๐Ÿ”ข Specifying messages ๐Ÿ”ข

Commands such as print and delete can be given a list of message numbers 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. Group chat energy: you can address multiple messages at once. ๐Ÿซถ

Messages may also be selected using one of the following categories:

  • * โ€” all messages
  • $ โ€” last message
  • :d โ€” deleted messages
  • :n โ€” new messages
  • :o โ€” old messages
  • :r โ€” read messages
  • :u โ€” unread messages

Thus the command top, which prints the first few lines of a message, could be used in top * to print the first few lines of all messages. Iconic. โœจ


๐Ÿ’ฌ Replying to or originating mail ๐Ÿ’ฌ

You can use the reply command to set up a response to a message, sending it back to the person who it was from. Text you then type in, up to an end-of-file, defines the contents of the message. While you are composing a message, mail treats lines beginning with the tilde (โ€˜~โ€™) character specially. For instance, typing ~m (alone on a line) will place a copy of the current message into the response, right shifting it by a single tab-stop (see the indentprefix variable, below). Other escapes will 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. (These options are given in the summary below.) So ~ is your little command magic while composing. ๐Ÿช„


๐Ÿ‘‹ Ending a mail processing session ๐Ÿ‘‹

You can end a mail session with the quit (q) command. Messages which have been examined go to your mbox file unless they have been deleted, in which case they are discarded. Unexamined messages go back to the post office (see the -f option above). Bye bestie, but responsibly. ๐Ÿ’–


๐Ÿ‘ฏ Personal and system wide distribution lists ๐Ÿ‘ฏ

It is also possible to create personal distribution lists so that, for instance, you can send mail to โ€œcohortsโ€ and have it go to a group of people. Such lists can be defined by placing a line like

alias cohorts bill ozalp jkf mark kridle@ucbcory

in the file .mailrc in your home directory. The current list of such aliases can be displayed with the alias command in mail. System wide distribution lists can be created by editing /etc/aliases, (see aliases(5)); these are kept in a different syntax. In mail you send, personal aliases will be expanded in mail sent to others so that they will be able to reply to the recipients. System wide aliases are not expanded when the mail is sent, but any reply returned to the machine will have the system wide alias expanded as all mail goes through an MTA. Group chats but make it Unix. ๐Ÿซ‚


๐Ÿ“ฎ Recipient address specifications ๐Ÿ“ฎ

Recipient addresses (any of the โ€œToโ€, โ€œCcโ€ or โ€œBccโ€ header fields) are subject to expansion when the expandaddr option is set.

An address may be expanded as follows:

  • An address that starts with a pipe (โ€˜|โ€™) character is treated as a command to run. The command immediately following the โ€˜|โ€™ is executed with the message as its standard input.
  • An address that starts with a โ€˜+โ€™ character is treated as a folder.
  • An address that contains a โ€˜/โ€™ character but no โ€˜!โ€™, โ€˜%โ€™, or โ€˜@โ€™ characters is also treated as a folder.
  • If none of the above apply, the recipient is treated as a local or network mail address.

If the expandaddr option is not set (the default), no expansion is performed and the recipient is treated as a local or network mail address. So default is no expansion, no cap. ๐Ÿšซ


๐Ÿ”ค Character sets and MIME ๐Ÿ”ค

Generally mail does not handle neither different character sets nor any other MIME feature. Especially it does not perform any any conversions between character sets while displaying or sending mails. So no MIME magic, okay? ๐Ÿ’€

Starting from April 2017, however, as a Debian extension this version of mail adds a few MIME headers to every outgoing mail in order to indicate that the mail is sent as 8-bit plain text data that uses character set encoding detected from the current locale(7) settings. The -a command-line option can be used to override those headers, for example:

$ mail -a 'Content-Type: text/plain; charset="ISO-8859-1"'

sets header indicating legacy character encoding. So if you need old-school charset vibes, use -a. ๐ŸŒˆ


๐Ÿ“œ SUMMARY ๐Ÿ“œ

(Adapted from the โ€œMail Reference Manualโ€.)

Each command is typed on a line by itself, and may take arguments following the command word. The command need not be typed in its entirety โ€” the first command which matches the typed prefix is used. For commands which take message lists as arguments, if no message list is given, then the next message forward which satisfies the command's requirements is used. If there are no messages forward of the current message, the search proceeds backwards, and if there are no good messages at all, mail types โ€œNo applicable messagesโ€ and aborts the command. So abbreviations are your friend, but only the first match wins. ๐Ÿ†

  • - โ€” Print out the preceding message. If given a numeric argument n, goes to the nth previous message and prints it. Backwards but make it fashion. โช
  • = โ€” Prints the currently selected message number. So you know where you are. ๐Ÿ“
  • ? โ€” Prints a brief summary of commands. Help is here. ๐Ÿ†˜
  • ! โ€” Executes the shell (see sh(1) and csh(1)) command which follows. Shell escape, periodt. ๐Ÿ’ป
  • alias โ€” (a) With no arguments, prints out all currently defined aliases. With one argument, prints out that alias. With more than one argument, creates a new alias or changes an old one. Alias queen. ๐Ÿ‘‘
  • alternates โ€” (alt) The alternates command is useful if you have accounts on several machines. It can be used to inform mail that the listed addresses are really you. When you reply to messages, mail will not send a copy of the message to any of the addresses listed on the alternates list. If the alternates command is given with no argument, the current set of alternate names is displayed. Multiple accounts? Valid. ๐Ÿซถ
  • chdir โ€” (cd or ch) Changes the user's working directory to that specified, if given. If no directory is given, then changes to the user's login directory. Directory hopping. ๐Ÿ“
  • copy โ€” (c) The copy command does the same thing that save does, except that it does not mark the messages it is used on for deletion when you quit. Save but no delete. ๐Ÿซก
  • delete โ€” (d) Takes a list of messages as argument and marks them all as deleted. Deleted messages will not be saved in mbox, nor will they be available for most other commands. Gone but not forgotten? Actually forgotten. ๐Ÿ’€
  • dp โ€” (also dt) Deletes the current message and prints the next message. If there is no next message, mail says โ€œNo more messages.โ€
  • edit, e โ€” takes a list of messages and points the text editor at each one in turn. On return from the editor, the message is read back in. So like, you edit, you come back, it's updated. ๐Ÿ’…
  • exit, ex, x โ€” effects an immediate return to the shell without modifying the user's system mailbox, mbox file, or edit file in -f. So it's the "I'm out, don't touch anything" move. ๐Ÿ’จ
  • file, fi โ€” the same as folder. Periodt.
  • folder, fo โ€” the folder command switches to a new mail file or folder. With no arguments, it tells you which file you are currently reading. If you give it an argument, it will write out changes (such as deletions) you have made in the current file and read in the new file. Some special conventions are recognized for the name: # means the previous file, % means your system mailbox, %user means user's system mailbox, & means your mbox file, and +folder means a file in your folder directory. So many shortcuts, iykyk. ๐Ÿ—‚๏ธ
  • folders โ€” list the names of the folders in your folder directory. Like a little folder fashion show. ๐Ÿ“โœจ
  • from, f โ€” takes a list of messages and prints their message headers. Just the receipts, bestie. ๐Ÿงพ
  • headers, h โ€” lists the current windowful of headers. To view the next or previous group of headers, see the z command. So it's like scrolling but make it mail. ๐Ÿ“œ
  • help โ€” a synonym for ?. So if you're confused, just ask. ๐Ÿ™‹
  • hold, ho, also preserve โ€” takes a message list and marks each message therein to be saved in the user's system mailbox instead of in mbox. Does not override the delete command. So it's like "keep this one safe, but delete still wins." ๐Ÿ›ก๏ธ
  • ignore โ€” add the list of header fields named to the ignored list. Header fields in the ignore list are not printed on your terminal when you print a message. This command is very handy for suppression of certain machine-generated header fields. The Type and Print commands can be used to print a message in its entirety, including ignored fields. If ignore is executed with no arguments, it lists the current set of ignored fields. So you can ghost those annoying headers. ๐Ÿ™ˆ
  • inc โ€” incorporate any new messages that have arrived while mail is being read. The new messages are added to the end of the message list, and the current message is reset to be the first new mail message. This does not renumber the existing message list, nor does it cause any changes made so far to be saved. So fresh mail, but no renumbering and no saving. ๐Ÿ’Œ
  • list, l โ€” list the valid mail commands. A menu of moves. ๐Ÿ“‹
  • mail, m โ€” takes as argument login names and distribution group names and sends mail to those people. Slide into their inbox. โœ‰๏ธ
  • mbox โ€” indicate that a list of messages be sent to mbox in your home directory when you quit. This is the default action for messages if you do not have the hold option set. So it's the default "save to mbox" vibe. ๐Ÿ“ฆ
  • more, mo โ€” takes a message list and invokes the pager on that list. Because sometimes you need to scroll. ๐Ÿ“–
  • next, n, like + or CR โ€” goes to the next message in sequence and types it. With an argument list, types the next matching message. Next, next, next. โญ๏ธ
  • preserve, pre โ€” a synonym for hold. Same energy. ๐Ÿซถ
  • Print, P โ€” like print but also prints out ignored header fields. See also print, ignore, and retain. So it shows everything, no secrets. ๐Ÿ‘€
  • print, p โ€” takes a message list and types out each message on the user's terminal. Just prints it. ๐Ÿ–จ๏ธ
  • quit, q โ€” terminates the session, saving all undeleted, unsaved messages in the mbox file in the user's login directory, preserving all messages marked with hold or preserve or never referenced in the user's system mailbox, and removing all other messages from the user's system mailbox. If new mail has arrived during the session, the message โ€œYou have new mailโ€ is given. If given while editing a mailbox file with the -f flag, then the edit file is rewritten. A return to the shell is effected, unless the rewrite of edit file fails, in which case the user can escape with the exit command. So it's the big goodbye, but with rules. ๐Ÿ‘‹
  • Reply, R โ€” reply to originator. Does not reply to other recipients of the original message. So just the sender, not the whole group chat. ๐Ÿ“ฉ
  • reply, r โ€” takes a message list and sends mail to the sender and all recipients of the specified message. The default message must not be deleted. So reply-all energy, but don't delete the original. ๐Ÿ—ฃ๏ธ
  • respond โ€” a synonym for reply. Same thing, different name. ๐Ÿ’ฌ
  • retain โ€” add the list of header fields named to the retained list. Only the header fields in the retain list are shown on your terminal when you print a message. All other header fields are suppressed. The Type and Print commands can be used to print a message in its entirety. If retain is executed with no arguments, it lists the current set of retained fields. So it's the opposite of ignore โ€” only the chosen ones show. ๐Ÿ‘‘
  • save, s โ€” takes a message list and a filename and appends each message in turn to the end of the file. The filename in quotes, followed by the line count and character count is echoed on the user's terminal. So it saves and tells you the stats. ๐Ÿ’พ
  • saveignore โ€” saveignore is to save what ignore is to print and type. Header fields thus marked are filtered out when saving a message by save or when automatically saving to mbox. So it's ignore, but for saving. ๐Ÿšซ
  • saveretain โ€” saveretain is to save what retain is to print and type. Header fields thus marked are the only ones saved with a message when saving by save or when automatically saving to mbox. saveretain overrides saveignore. So it's retain, but for saving, and it wins. ๐Ÿ†
  • set, se โ€” with no arguments, prints all variable values. Otherwise, sets option. Arguments are of the form option=value (no space before or after =) or option. Quotation marks may be placed around any part of the assignment statement to quote blanks or tabs, i.e., set indentprefix="->". So you can customize your mail vibe. ๐ŸŽ›๏ธ
  • shell, sh โ€” invokes an interactive version of the shell. Escape to the command line. ๐Ÿš
  • size โ€” takes a message list and prints out the size in characters of each message. How many characters? This many. ๐Ÿ“
  • source โ€” the source command reads commands from a file. So you can script your mail session. ๐Ÿ“œ
  • top โ€” takes a message list and prints the top few lines of each. The number of lines printed is controlled by the variable toplines and defaults to five. Just a little peek. ๐Ÿ‘€
  • Type, T โ€” identical to the Print command. Same as Print. ๐Ÿ”
  • type, t โ€” a synonym for print. Just another name for print. ๐Ÿ–จ๏ธ
  • unalias โ€” takes a list of names defined by alias commands and discards the remembered groups of users. The group names no longer have any significance. So bye-bye aliases. ๐Ÿ‘‹
  • undelete, u โ€” takes a message list and marks each message as not being deleted. Oops, undo. โ†ฉ๏ธ
  • unread, U โ€” takes a message list and marks each message as not having been read. So you can pretend you never saw it. ๐Ÿ™ˆ
  • unset โ€” takes a list of option names and discards their remembered values; the inverse of set. So it's the undo for settings. ๐Ÿ—‘๏ธ
  • visual, v โ€” takes a message list and invokes the display editor on each message. Fancy editor time. โœจ
  • write, w โ€” similar to save, except that only the message body (without the header) is saved. Extremely useful for such tasks as sending and receiving source program text over the message system. So just the body, no header. ๐Ÿ“
  • xit, x โ€” a synonym for exit. Same as exit. ๐Ÿšช
  • z โ€” mail presents message headers in windowfuls as described under the headers command. You can move mail's attention forward to the next window with the z command. Also, you can move to the previous window by using z-. So z for next, z- for previous. ๐Ÿ”„

โœจ Tilde/escapes โœจ

Here's the tea on tilde escapes, which are used when composing messages to perform special functions. Tilde escapes are only recognized at the beginning of lines. The name โ€œtilde escapeโ€ is somewhat of a misnomer since the actual escape character can be set by the option escape. So even though we call them tilde escapes, the escape char can be changed. ๐Ÿ’…

  • ~bname ... โ€” add the given names to the list of carbon copy recipients but do not make the names visible in the Cc: line ("blind" carbon copy). So secret cc. ๐Ÿคซ
  • ~cname ... โ€” add the given names to the list of carbon copy recipients. Regular cc. ๐Ÿ“Ž
  • ~d โ€” read the file dead.letter from your home directory into the message. So it pulls in your dead letter. ๐Ÿ’€
  • ~e โ€” invoke the text editor on the message collected so far. After the editing session is finished, you may continue appending text to the message. Edit, then keep typing. โœ๏ธ
  • ~Fmessages โ€” identical to ~f, except all message headers are included. So like ~f but with all headers. ๐Ÿ“จ
  • ~fmessages โ€” read the named messages into the message being sent. If no messages are specified, read in the current message. Message headers currently being ignored (by the ignore or retain command) are not included. So it includes messages, but not ignored headers. ๐Ÿ“ฅ
  • ~h โ€” edit the message header fields by typing 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. So you can edit headers one by one. โœ๏ธ
  • ~Mmessages โ€” identical to ~m, except all message headers are included. Like ~m but all headers. ๐Ÿ“ฌ
  • ~mmessages โ€” read the named messages into the message being sent, indented by a tab or by the value of indentprefix. If no messages are specified, read the current message. Message headers currently being ignored (by the ignore or retain command) are not included. So it indents them. ๐Ÿ“‘
  • ~p โ€” print out the message collected so far, prefaced by the message header fields. So you can preview. ๐Ÿ‘€
  • ~q โ€” abort the message being sent, copying the message to dead.letter in your home directory if save is set. So if you bail, it might save to dead.letter. ๐Ÿšซ
  • ~Rstring โ€” use string as the Reply-To field. So you can set a custom reply-to. ๐Ÿ“ง
  • ~rfilename, ~<filename โ€” read the named file into the message. So you can include a file. ๐Ÿ“‚
  • ~sstring โ€” cause the named string to become the current subject field. So set the subject. ๐Ÿ“
  • ~tname ... โ€” add the given names to the direct recipient list. So add to the To: line. ๐Ÿ“ฌ
  • ~v โ€” invoke an alternate editor (defined by the VISUAL option) on the message collected so far. Usually, the alternate editor will be a screen editor. After you quit the editor, you may resume appending text to the end of your message. So fancy editor time. ๐Ÿ–ฅ๏ธ
  • ~wfilename โ€” write the message onto the named file. So save it. ๐Ÿ’พ
  • ~x โ€” abort the message being sent. No message is copied to ~/dead.letter, even if save is set. So unlike ~q, this one doesn't save to dead.letter. โŒ
  • ~? โ€” prints a brief summary of tilde escapes. So help for tilde escapes. โ“
  • ~!command โ€” execute the indicated shell command, then return to the message. So you can run a command mid-message. ๐Ÿš
  • ~|command โ€” pipe the message through the command as a filter. If the command gives no output or terminates abnormally, retain the original text of the message. The command fmt(1) is often used as command to rejustify the message. So you can filter your message. ๐Ÿšฐ
  • ~:mail-command, ~_mail-command โ€” execute the given mail command. Not all commands, however, are allowed. So some mail commands work, some don't. โš ๏ธ
  • ~~string โ€” insert the string of text in the message prefaced by a single ~. If you have changed the escape character, then you should double that character in order to send it. So to send a literal tilde, you double it. ~
  • ~. โ€” simulate end of file on input. So it's like EOF. ๐Ÿ”š

โœจ Mail options โœจ

okay so you can set a whole bunch of options in your .mailrc file to change how mail behaves, and you flip them with the set and unset commands. some of them are binary โ€” for those you only care whether they're on, not what they're worth โ€” and the rest are string options, where the actual value is the whole point. the binary girlies are these:

  • append โ€” makes messages you save into mbox get appended to the end instead of prepended to the front. bestie, this one should always be set (maybe in /etc/mail.rc, so you never forget).
  • ask, asksub โ€” makes mail ask you for the subject of every message you send. if you just hit newline and nothing else, no subject field goes out at all. no subject, no problem.
  • askbcc โ€” prompts you for extra blind carbon copy recipients at the end of each message. hit newline and that means "yeah I'm happy with the list I already have."
  • askcc โ€” same vibe, but for extra carbon copy recipients at the end of each message. newline = you're satisfied with the current list.
  • autoinc โ€” new mail gets automatically incorporated when it arrives. it's basically like running the inc command at every prompt, except the current message doesn't get reset when new mail shows up.
  • autoprint โ€” makes delete act like dp, so after you delete a message, the next one just gets typed out for you automatically. main character convenience ๐Ÿ’…
  • debug โ€” setting this binary option is exactly the same as putting -d on the command line, and it makes mail spit out all sorts of info that's genuinely useful for debugging mail. it's giving detective energy ๐Ÿ”
  • dot โ€” this binary option makes mail treat a lone period on a line as the terminator of a message you're sending. yes, just a . all by itself.
  • expandaddr โ€” makes mail expand message recipient addresses, exactly as explained in the section "Recipient address specifications".
  • from โ€” makes mail use the sender address you specify in the From: field of the message header. a stripped down version of that address also goes into the message envelope. if it's unset, the message won't include an explicit sender address, and a default value gets added by the MTA โ€” typically user@host. and heads up, this value can be overridden by specifying the -r flag on the command line.
  • hold โ€” holds messages in the system mailbox by default.
  • ignore โ€” makes interrupt signals from your terminal get ignored and echoed back as @'s.
  • ignoreeof โ€” a cousin of dot, this one makes mail refuse to accept a control-D as the end of a message. ignoreeof also applies to mail command mode.
  • keep โ€” setting this makes mail truncate your system mailbox instead of deleting it when it's empty.
  • keepsave โ€” messages saved with the save command don't normally get saved in mbox at quit time. use this option to keep them around.
  • metoo โ€” usually, when a group gets expanded and the sender is in it, the sender is removed from the expansion. setting this option makes the sender stay included in the group. don't leave yourself out ๐Ÿซถ
  • noheader โ€” setting this is the same as giving the -N flag on the command line.
  • nosave โ€” normally, when you abort a message with two interrupt characters (usually control-C), mail copies the partial letter into the file dead.letter in your home directory. setting this binary option stops that from happening.
  • quiet โ€” suppresses the printing of the version when mail is first invoked. shhh ๐Ÿคซ
  • Replyall โ€” reverses the sense of the reply and Reply commands. plot twist.
  • searchheaders โ€” if this is set, then a message-list specifier shaped like /x:y expands to all messages containing the substring y in the header field x. the string search is case insensitive. if x is left out, it defaults to the Subject header field. the form /to:y is a special case and expands to all messages containing the substring y in the To, Cc or Bcc header fields. but the check for to is case sensitive, so /To:y lets you limit the search for y to just the To: field. iykyk โœจ
  • skipempty โ€” don't send messages with an empty body. no empty texts, we don't do that here ๐Ÿ’€
  • verbose โ€” setting this is the same as using the -v flag on the command line. when mail runs in verbose mode, the actual delivery of messages gets displayed on your terminal. very "watch me cook" energy.

๐ŸŽ€ Option string values ๐ŸŽ€

these ones actually hold a value, so the value matters. slay:

  • EDITOR โ€” the pathname of the text editor used by the edit command and the ~e escape. if it's not defined, /usr/bin/ex gets used.
  • LISTER โ€” the pathname of the directory lister used by the folders command. default is /bin/ls.
  • MBOX โ€” the name of the mbox file. it can be the name of a folder. the default is mbox in the user's home directory.
  • PAGER โ€” the pathname of the program used by the more command, or whenever the crt variable is set. if this option isn't defined, the default paginator more(1) is used.
  • REPLYTO โ€” if it's set, it gets used to initialize the Reply-To field for outgoing messages.
  • SHELL โ€” the pathname of the shell used by the ! command and the ~! escape. a default shell gets used if this option isn't defined.
  • VISUAL โ€” the pathname of the text editor used by the visual command and the ~v escape. if it's not defined, /usr/bin/vi gets used.
  • crt โ€” this valued option is a threshold that decides how long a message has to be before PAGER gets used to read it. if crt is set without a value, then the height of the terminal screen stored in the system is used to compute that threshold (see stty(1)).
  • escape โ€” if it's defined, the first character of this option gives the character to use in place of ~ to denote escapes.
  • folder โ€” the name of the directory used for storing folders of messages. if this name begins with a /, mail treats it as an absolute pathname; otherwise the folder directory is found relative to your home directory.
  • indentprefix โ€” the string used by the ~m tilde escape for indenting messages, in place of the normal tab character (^I). be sure to quote the value if it contains spaces or tabs! ๐Ÿ™ˆ
  • record โ€” if it's defined, this gives the pathname of the file used to record all outgoing mail. if it's not defined, then outgoing mail is simply not saved.
  • screen โ€” the size of the window of message headers for z.
  • sendmail โ€” pathname to an alternative mail delivery system.
  • toplines โ€” if it's defined, this gives the number of lines of a message that get printed out with the top command; normally, the first five lines are printed.

๐ŸŒธ ENVIRONMENT ๐ŸŒธ

mail utilizes the HOME, LOGNAME, USER, SHELL, DEAD, PAGER, LISTER, EDITOR, VISUAL, REPLYTO, MAIL, MAILRC, and MBOX environment variables. that's a whole roster ๐Ÿ‘‘

if the MAIL environment variable is set, its value is used as the path to the user's mail spool.


๐Ÿ“ FILES ๐Ÿ“

  • /var/mail/* โ€” post office (unless overridden by the MAIL environment variable)
  • ~/mbox โ€” user's old mail
  • ~/.mailrc โ€” file giving initial mail commands; can be overridden by setting the MAILRC environment variable
  • /tmp/R* โ€” temporary files
  • /usr/share/bsd-mailx/mail.*help โ€” help files
  • /etc/mail.rc โ€” system initialization file

๐Ÿšช EXIT STATUS ๐Ÿšช

the mail utility exits 0 on success, and >0 if an error occurs. so if it's zero we're chilling, and anything above zero means something went wrong.


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

fmt(1), newaliases(1), vacation(1), aliases(5), mail.local(8), newaliases(8), sendmail(8), smtpd(8)

Kurt Shoens, "Mail Reference Manual", 4.4BSD User's Supplementary Documents (USD).


๐Ÿ“ STANDARDS ๐Ÿ“

the mailx utility is compliant with the IEEE Std 1003.1-2008 ("POSIX.1") specification. certified, no cap ๐Ÿ’ฏ

the flags [-iNnu] are marked by IEEE Std 1003.1-2008 ("POSIX.1") as being optional.

the flags [-eFH] are marked by IEEE Std 1003.1-2008 ("POSIX.1") as being optional, and are not supported by this implementation of mailx.

the flags [-abcdEIrv] are extensions to the specification.


๐Ÿ•ฐ๏ธ HISTORY ๐Ÿ•ฐ๏ธ

a mail command appeared in Version 1 AT&T UNIX. this man page is derived from the Mail Reference Manual originally written by Kurt Shoens. we're standing on the shoulders of legends ๐Ÿซก


๐Ÿ› BUGS ๐Ÿ›

usually, Mail and mailx are just links to mail, which can be confusing. yeah bestie, that one's a little confusing fr fr.


and that's the whole page, bestie!! this one's from Debian, dated March 31, 2022, and the page itself is MAIL(1). go forth and send your emails, you've got this ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from