#### 3.5.7 How to Alter the Behavior of `mail` ¶

Following variables control the behavior of GNU `mail`:

mail: `boolean` append ¶

  Default: True
  Comment: Read-Only

  Messages saved in `mbox` are appended to the end, rather than prepended. This is the default and cannot be changed. This variable exists only for compatibility with other `mailx` implementations.

mail: `boolean` appenddeadletter ¶

  Default: False

  If this variable is set, the contents of canceled letter is appended to the user’s `dead.letter` file. Otherwise it overwrites its contents.

mail: `boolean` askbcc ¶

  Default: False

  When set to `True` the user will be prompted to enter `Bcc` field before composing the message.

mail: `boolean` askcc ¶

  Default: True

  When set to `True` the user will be prompted to enter `Cc` field before composing the message.

mail: `boolean` asksub ¶

  Default: True in interactive mode, False otherwise.

  When set to `True` the user will be prompted to enter `Subject` field before composing the message.

mail: `boolean` autoinc ¶

  Default: True

  Automatically incorporate newly arrived messages.

mail: `boolean` autoprint ¶

  Default: False

  Causes the delete command to behave like `dp`: after deleting a message, the next one will be typed automatically.

mail: `boolean` bang ¶

  Default: False

  When set, every occurrence of `!` in arguments to `!` escape is replaced with the last executed command.

  See Executing Shell Commands: ~! and ~|, for details on the `!` escape.

mail: `boolean` datefield ¶

  Default: False

  By default the date in a header summary is taken from the SMTP envelope of the message. Setting this variable tells `mail` to use the date from `Date:` header field, converted to local time. Notice, that for messages lacking this field `mail` will fall back to using SMTP envelope.

  See fromfield.

mail: `string` charset ¶

  Default: ‘`auto`’

  The value of this variable is the character set used for input and output operations. If the value is ‘`auto`’, `mail` will try to deduce the name of the character set from the value of `LC_ALL` environment variable. If the variable contains the character set part (e.g. ‘`nb_NO.utf-8`’), it will be used. Otherwise, `mail` will look up in its built-in database the value of the character for this language/territory combination. If `LC_ALL` is not set, the `LANG` environment variable is inspected.

  The value of `charset` controls both input and output operations. On input, it is used to set the value of the ‘`charset`’ parameter in the ‘`Content-Type`’ MIME header, if its value begins with ‘`text/`’ and the ‘`charset`’ parameter is not present.

  On output, it is used to display values of the header fields encodied using RFC 2047. If the variable is unset, no decoding is performed and the fields are printed as they are. Otherwise, they are recoded to that character set.

mail: `string` cmd ¶

  Default: Unset

  Contains default shell command for `pipe`.

mail: `numeric` columns ¶

  Default: Detected at startup by querying the terminal device. If this fails, the value of environment variable `COLUMNS` is used.

  This variable contains the number of columns on terminal screen.

mail: `numeric` crt ¶
mail: `boolean` crt ¶

  Default: True in interactive mode, False otherwise.

  The variable `crt` determines the minimum number of lines the body of the message must contain in order to be piped through pager command specified by environment variable `PAGER`. If `crt` is set to a numeric value, this value is taken as the threshold. Otherwise, if `crt` is set without a value, then the height of the terminal screen is used to compute the threshold. The number of lines on screen is controlled by `screen` variable.

mail: `boolean` debug ¶
mail: `string` debug ¶

  Default: Unset

  Sets mailutils debug level. If set to string, the value must be a valid Mailutils debugging specification. See Debug Statement, for a description.

  If unset (i.e. `set nodebug`), clears and disables all debugging information. If set to ‘`true`’ (i.e. `set debug`), sets maximum debugging (‘`<trace7`’) on mailbox and its underlying objects.

mail: `string` decode-fallback ¶

  Default: ‘`none`’

  This variable controls the way to represent characters that cannot be rendered using current character set. It can have three values:

  ‘`none`’

    Such characters are not printed at all. The conversion process stops at the first character that cannot be rendered.

  ‘`copy-pass`’

    The characters are displayed ‘`as is`’. Notice, that depending on your setup, this may screw-up your terminal settings.

  ‘`copy-octal`’

    Unprintable characters are represented by their octal codes. Printable ones are printed ‘`as is`’.

mail: `boolean` dot ¶

  Default: False

  If set, causes `mail` to interpret a period alone on a line as the terminator of a message you are sending.

mail: `boolean` editheaders ¶

  Default: False

  When set, `mail` will include message headers in the text of the `~e` and `~v` escapes, thus allowing you to customize the headers.

mail: `boolean` emptystart ¶

  Default: False

  If the mailbox is empty, `mail` normally prints ‘`No mail for user`’ and exits immediately. If this option is set, `mail` will start no matter is the mailbox empty or not.

mail: `string` escape ¶

  Default: ‘`~`’

  Current value of the command escape character.

mail: `boolean` flipr ¶

  Default: Unset

  If set, the variable `flipr` swaps the meanings of `reply` and `Reply` commands (see Replying).

mail: `string` folder ¶

  Default: Unset

  The name of the directory to use for storing folders of messages. If unset, `$HOME` is assumed.

mail: `boolean` fromfield ¶

  Default: True

  By default the sender address is taken from the ‘`From`’ header. Unsetting this variable tells `mail` to obtain it from the SMTP envelope instead.

  See datefield.

mail: `boolean` fullnames ¶

  Default: True

  Preserve personal parts (comments) of recipient addresses when replying to a message.

  When unset, only emails will be used.

  See Replying.

mail: `boolean` header ¶

  Default: True, unless started with `--nosum` (`-N`) option.

  Whether to run `headers` command automatically after entering interactive mode.

mail: `string` headline ¶

  Default: ‘`%>%a%4m %18f %16d %3l/%-5o %s`’

  Format string to use for the header summary. The ‘`%`’ character introduces a format specifier. The format specifier consists of optional alignment specifier (‘`+`’ or ‘`-`’ sign), optional output width and the specifier letter. Format specifiers are replaced on output with the corresponding piece of information from the message being described.

  The ‘`-`’ character immediately following ‘`%`’ indicates that this field should be left aligned. The ‘`+`’ character indicates right alignment. Default alignment depends on the type of the specifier: the specifiers that produce numeric values (‘`%l`’, ‘`%m`’, and ‘`%o`’) are aligned to the right, whereas the ones producing string or date/time values are aligned to the left.

  A number following ‘`%`’ or the alignment flag, indicates the field width.

  Consider the ‘`%m`’ specifier as an example:

  %m

    Print current message number. Take as much screen columns as necessary for output.

  %4m
  %+4m

    Print current message number. Use exactly 4 screen columns, truncating the output if it does not fit that width. Align the output to the right.

  %-4m

    Same as above, but align to the left.

  Valid format specifiers are:

  %a

    Message attribute. One of the following letters, or a single horizontal space, if none of them applies:

    ‘`M`’ | the message was copied to the mailbox (`mbox` command)
    ‘`P`’ | the message was preserved (`hold` command)
    ‘`*`’ | the message was saved (`save` or `Save`)
    ‘`T`’ | the message was tagged (`tag`)
    ‘`R`’ | the message was read
    ‘`N`’ | the message is new (was not seen)
    ‘`U`’ | the message was seen, but wasn’t read

  %d

    The date when the message was received. It is determined from the message header defined by the ‘`datefield`’ variable (see datefield). If that variable is not set, or the requested header is not present in the message, the date from the envelope is used.

    The output is formatted according to the following format specification (see Date/time Format String):

        %a %b %e %H:%M

    I.e.: abbreviated weekday name, abbreviated month name, day of the month as a decimal number, followed by hour and minutes. All names are displayed according to the current locale.

  %D{fmt}

    Same as ‘`%d`’, but the date is formatted according to the date/time format fmt. It is essentially a C ‘`strftime`’ format string, described in detail in Date/time Format String.

    For example:

        set headline="%4m %20D{%Y-%m-%dT%H:%M:%S}"

    Note, that the opening ‘`{`’ must follow the format letter without any intervening whitespace. If fmt contains ‘`{`’, ‘`}`’, or ‘`\`’, these characters must be escaped with backslash (e.g. ‘`\{`’).

  %Df

    A simplified form of the ‘`%D`’ specifier. It is equivalent to

        %D{%f}

    where f is a single ‘`strftime`’ specifier letter. It can be preceded by ‘`E`’ or ‘`O`’, if the Single UNIX Specification allows such usage (see conversion specs), e.g. ‘`%DOU`’.

    Notice, that ‘`%D`’ not followed by a valid time format in either of the above forms is treated as unknown specifier.

  %f

    The email address of the message sender.

  %l

    The number of lines of the message.

  %m

    Message number.

  %o

    The number of octets (bytes) in the message.

  %s

    Message subject (if any).

  %S

    Message subject (if any) in double quotes.

  %>

    A ‘`>`’ for the current message, otherwise a space.

  %<

    A ‘`<`’ for the current message, otherwise a space.

  %%

    A ‘`%`’ character.

mail: `boolean` hold ¶

  Default: False

  Determines the location where to store the messages in state ‘`read`’ and (if the `keepsave` is also set) ‘`saved`’. When set, these messages will be retained in the system mailbox.

  When not set (the default), such messages will be stored in the user’s personal mailbox.

  See read messages, and See saved messages, for a detailed information on how such messages are processed when the mailbox is being closed.

  See keepsave, for the discussion of the `keepsave` variable.

mail: `boolean` ignore ¶

  Default: False

  When set to `True`, `mail` will ignore keyboard interrupts when composing messages. Otherwise an interrupt will be taken as a signal to abort composing.

mail: `boolean` ignoreeof ¶

  Default: False

  Controls whether typing EOF character terminates the letter being composed.

mail: `string` indentprefix ¶

  Default: "\t" (a tab character).

  String used by the `~m` tilde escape for indenting quoted messages.

mail: `boolean` inplacealiases ¶

  Default: False

  If set, `mail` will expand aliases in the address header field before entering send mode (see Composing Mail). By default, the address header fields are left intact while composing, the alias expansion takes place immediately before sending message.

mail: `boolean` keep ¶

  Comment: Read-Only
  Default: True

  Truncate the user’s system mailbox when it is empty, instead of removing it. This is the default and cannot be changed. This variable exists only for compatibility with other `mailx` implementations.

mail: `boolean` keepsave ¶

  Default: False

  Controls whether saved messages should be retained. The location where they will be retained is controlled by the `hold` variable (see the hold variable).

  This variable is in effect only when operating upon the user’s system mailbox.

  See saved messages, for a detailed information on how the saved messages are processed when the mailbox is being closed.

mail: `boolean` mailx ¶

  Default: False

  When set, enables mailx compatibility mode. This mode has the following effects:

  - When composing a message `mail` will ask for `Cc` and `Bcc` addresses after composing the body. The default behavior is to ask for these values before composing the body.
  - In send mode, if the composition was interrupted, `mail` will exit with zero status. By default it exits with zero status only if the message was sent successfully.
  - The `outfolder` variable is treated as boolean. see outfolder.
  - The value of `outfilename` is ignored (assumed to be ‘`local`’). see outfilename.
  - The values of `folder` and `record` variables are assumed relative to the home directory, unless they begin with ‘`/`’, ‘`~`’, or ‘`+`’.
  - If the value of the `sendmail` variable does not begin with a scheme specification, ‘`sendmail:/`’ is assumed. See sendmail mail variable.

mail: `boolean` metamail ¶
mail: `string` metamail ¶

  Default: True

  This variable controls operation of `decode` command. If it is unset, `decode` will not attempt any interpretation of the content of message parts. Otherwise, if `metamail` is set to `true`, `decode` will use internal metamail support to interpret message parts. Finally, if `metamail` is assigned a string, this string is treated as command line of the external `metamail` command which will be used to display parts of a multipart message. For example:

      # Disable MIME interpretation:
      set nometamail
      # Enable built-in MIME support:
      set metamail
      # Use external program to display MIME parts:
      set metamail="metamail -m mail -p"

mail: `string` mime ¶

  Default: False

  If set, this variable instructs `mail` to compose MIME messages.

  It can be set from the command line using `--mime` option.

mail: `string` mimenoask ¶

  Default: Unset

  By default `mail` asks for confirmation before running interpreter to view a part of the multi-part message. If this variable is set, its value is treated as a comma-separated list of MIME types for which no confirmation is needed. Elements of this list may include shell-style globbing patterns, e.g. setting

      set mimenoask=text/*,image/jpeg

  will disable prompting before displaying any textual files, no matter what their subtype is, and before displaying files with type ‘`image/jpeg`’.

mail: `boolean` metoo ¶

  Default: False

  Usually, when an alias is expanded that contains the sender, the sender is removed from the expansion. Setting this option causes the sender to be included in the group.

mail: `string` mode ¶

  Comment: Read-Only
  Default: The name of current operation mode.

  This variable keeps the name of the current operation mode. Its possible values are:

  headers

    The program is started with the `--headers` (`-H`) command line option (see Invoking `mail`).

  exist

    The program is started with the `--exist` (`-e`) command line option (see Invoking `mail`).

  print

    The program is started with the `--print` (`-p`) command line option (see Invoking `mail`).

  read

    The program operates in read mode. This is the default.

  send

    The program operates in send mode. This means it was given one or more recipient addresses in the command line.

mail: `boolean` nullbody ¶

  Default: True

  Controls whether `mail` accepts messages with an empty body. The default value, `true`, means such messages are sent, and a warning (traditionally saying ‘`Null message body; hope that's ok`’) is displayed. The text of the warning can be set using `nullbodymsg` variable (see below).

  If `nullbody` is unset, `mail` will silently ignore such messages. This can be useful in `crontab` files, to avoid sending mails when nothing important happens. For example, the `crontab` entry below will send mail only if the utility `some-prog` outputs something on its standard output or error:

      */5 * * * * some-prog 2>&1 | \
         /bin/mail -E'set nonullbody' -s 'Periodic synchronization'

mail: `string` nullbodymsg ¶

  Default: ‘`Null message body; hope that's ok`’

  Text of the warning displayed by `mail` before sending an empty message. When available, the translation of this text, in accordance with the current locale, is displayed.

  Unsetting this variable disables the warning.

mail: `boolean` onehop ¶

  Default: Unset

  This variable is not used. It exists for compatibility with other `mailx` implementations and for future use.

mail: `string` outfilename ¶

  Comment: Three-state: ‘`local`’, ‘`email`’, ‘`domain`’.
  Default: ‘`local`’

  Defines the algorithm to convert the recipient email to the name of the file used to record outgoing messages to that recipient. This affects the following commands: `Copy`, `Save`, `Mail`, `followup`, and `Followup`. The following values are allowed:

  `local`

    Local part of the email address is taken as the file name. This is the default.

  `email`

    Entire email is takes as the file name.

  `domain`

    Domain part of the email is used as the file name.

mail: `boolean` outfolder ¶
mail: `string` outfolder ¶

  Default: Unset

  When set as boolean, causes the files used to record outgoing messages to be located in the directory specified by the `folder` variable (unless the pathname is absolute).

  If set to a string value, names the directory where to store these files.

  This variable affects the following commands: `Copy`, `Save`, `Mail`, `followup`, and `Followup`.

  In mailx compatibility mode, only boolean value is allowed. see mailx mail variable.

mail: `boolean` page ¶

  Default: Unset

  If set, the `pipe` command will emit a linefeed character after printing each message.

mail: `string` PID ¶

  Comment: Read-Only
  Default: PID of the process.

  PID of the current `mail` process.

mail: `string` prompt ¶

  Default: "? "

  Contains the command prompt sequence.

mail: `boolean` quiet ¶

  Default: Unset

  This variable is not used. It exists for compatibility with other `mailx` implementations and for future use.

mail: `boolean` quit ¶

  Default: False, unless started with `--quit` (`-q`) option.

  When set, causes keyboard interrupts to terminate the program.

mail: `boolean` rc ¶

  Default: True, unless started with `--norc` (`-N`) option.

  When this variable is set, `mail` will read the system-wide configuration file upon startup. See Personal and System-wide Configuration Files.

mail: `boolean` readonly ¶

  Default: False

  When set, mailboxes are opened in readonly mode. In this mode, any `mail` commands that alter the contents of the mailbox are disabled. These commands include, but are not limited to: `delete`, `save` and `mbox`.

mail: `string` record ¶

  Default: Unset

  When set, outgoing messages produced by the following commmands will be saved to the named file: `mail`, `reply`, `Reply`.

  See also outfolder and outfilename.

mail: `boolean` recursivealiases ¶

  Default: True

  When set, `mail` will expand aliases recursively.

mail: `boolean` regex ¶

  Default: True.

  If set, enables the use of regular expressions in ‘`/.../`’ message specifications.

mail: `string` replyprefix ¶

  Default: ‘`Re:` ’

  Sets the prefix that will be used when constructing the subject line of a reply message.

mail: `string` replyregex ¶

  Default: ‘`^re: *`’

  Sets the regular expression used to recognize subjects of reply messages. If the `Subject` header of the message matches this expression, the value of `replyprefix` will not be prepended to it before replying. The value should be a POSIX extended regular expression. The comparison is case-insensitive.

  For example, to recognize usual English, Polish, Norwegian and German reply subject styles, use:

      set replyregex="^(re|odp|aw|ang)(\\[[0-9]+\\])?:[[:blank:]]"

  (Notice the quoting of backslash characters).

mail: `string` return-address ¶

  Default: unset

  Sets the return email address to use when sending messages. If unset, return address is composed from the current user name and the host name.

mail: `boolean` save ¶

  Default: True.

  When set, the aborted messages will be stored in the user’s `dead.file`. See also `appenddeadletter`.

mail: `numeric` screen ¶

  Default: Detected at startup by querying the terminal device. If this fails, the value of environment variable `LINES` is used.

  This variable contains the number of lines on terminal screen. See also crt.

mail: `string` sendmail ¶

  Default: ‘`sendmail:/usr/lib/sendmail`’

  Contains URL of the mail transport agent. If the value begins with a scheme specifier, it must be one of the mailer URL schemes supported by mailutils (see mailer URL). Otherwise, if not in mailx compatibility mode, the value starting with directory separator (‘`/`’) is treated as the external command that will be started as is and the composed message will be piped to its standard input.

  In mailx compatibility mode (see mailx mail variable), the ‘`sendmail:`’ prefix is assumed.

mail: `boolean` sendwait ¶

  Default: Unset

  This variable is not used. It exists for compatibility with other `mailx` implementations and for future use.

mail: `string` Sign ¶

  Default: Unset

  Contains the filename holding users signature. The contents of this file is appended to the end of a message being composed by `~A` escape.

mail: `string` sign ¶

  Default: Unset

  Contains the user’s signature. The contents of this variable is appended to the end of a message being composed by `~a` escape. Use `Sign` variable, if your signature occupies more than one line.

mail: `boolean` showenvelope ¶

  Default: Unset

  If this variable is set, the `print` command will include the SMTP envelope in its output.

mail: `boolean` showto ¶

  Default: Unset

  If this variable is set, `mail` will show `To:` addresses instead of `From:` for all messages that come from the user that invoked the program.

mail: `string` subject ¶

  Default: Unset

  Contains default subject line. This will be used when `asksub` is off.

mail: `numeric` toplines ¶

  Default: 5

  Number of lines to be displayed by `top` and `Top` commands.

mail: `boolean` variable-pretty-print ¶
mail: `boolean` varpp ¶

  Default: False

  If this variable is set, the listing output by `set` contains short descriptions before each variable. See Setting and Unsetting the Variables.

mail: `boolean` variable-strict ¶
mail: `boolean` varstrict ¶

  Default: False

  Setting this variable enables strict control over variable settings. In this mode, `mail` refuses to set read-only variables. Also, if the user is trying to set an unknown variable, `mail` prints a warning.

  See Setting and Unsetting the Variables.

mail: `boolean` verbose ¶

  Default: False

  When set, the actual delivery of messages is displayed on the user’s terminal.

mail: `boolean` useragent ¶

  Default: True

  Controls whether the ‘`User-Agent`’ header should be added to outgoing messages. The default value of this header is

      User-Agent: mail (GNU Mailutils 3.20)

mail: `boolean` xmailer ¶

  This header is retained for compatibility with previous releases of GNU Mailutils. Since version 3.13 it is an alias for `useragent`.