.\"@ nail.1 - S-nail(1) reference manual. .\" .\" Copyright (c) 2000-2008 Gunnar Ritter, Freiburg i. Br., Germany. .\" Copyright (c) 2012 - 2019 Steffen (Daode) Nurpmeso . .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\"@ S-nail v14.9.13 / 2019-03-08 .Dd March 08, 2019 .ds VV \\%v14.9.13 .ds VV \\%v14.9.13 .ds UU \\%S-NAIL .ds UA \\%S-nail .ds uA \\%s-nail .ds UR \\%/\:etc/\:s-nail.rc .ds ur \\%~/\:.mailrc .ds VD \\%~/\:dead.letter .ds VM \\%~/\:mbox .ds VN \\%~/\:.netrc .ds VT \\%/\:tmp .ds vS \\%/\:etc/\:mime.types .ds vU \\%~/\:.mime.types .ds OB [Obsolete] .ds OP [Option] .ds IN [v15-compat] .ds OU [no v15-compat] .ds ID [v15 behaviour may differ] .ds NQ [Only new quoting rules] .ds BO (Boolean) .ds RO (Read-only) .if !d str-Lb-libterminfo \ .ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo) .Dt "\*(UU" 1 .Os .\" Uncomment for mandoc(1) compat.: .\".ds mx-toc-name TABLE OF CONTENTS .Mx -enable -preprocessed .Mx -anchor-spass Sh "NAME" 1 .Mx -anchor-spass Sh "SYNOPSIS" 2 .Mx -anchor-spass Sh "\*[mx-toc-name]" 3 .Mx -anchor-spass Sh "DESCRIPTION" 4 .Mx -anchor-spass Ss "Options" 4 .Mx -anchor-spass Ss "A starter" 4 .Mx -anchor-spass Ss "On sending mail, and non-interactive mode" 4 .Mx -anchor-spass Ss "On reading mail, and interactive mode" 4 .Mx -anchor-spass Ss "HTML mail and MIME attachments" 4 .Mx -anchor-spass Ss "Mailing lists" 4 .Mx -anchor-spass Ss "Signed and encrypted messages with S/MIME" 4 .Mx -anchor-spass Ss "On URL syntax and credential lookup" 4 .Mx -anchor-spass Ss "Encrypted network communication" 4 .Mx -anchor-spass Ss "Character sets" 4 .Mx -anchor-spass Ss "Message states" 4 .Mx -anchor-spass Ss "Specifying messages" 4 .Mx -anchor-spass Ss "On terminal control and line editor" 4 .Mx -anchor-spass Ss "Coloured display" 4 .Mx -anchor-spass Ss "Handling spam" 4 .Mx -anchor-spass Sh "COMMANDS" 5 .Mx -anchor-spass Ss "Command modifiers" 5 .Mx -anchor-spass Ss "Old-style argument quoting" 5 .Mx -anchor-spass Ss "Shell-style argument quoting" 5 .Mx -anchor-spass Ss "Message list arguments" 5 .Mx -anchor-spass Ss "Raw data arguments for codec commands" 5 .Mx -anchor-spass Ss "Filename transformations" 5 .Mx -anchor-spass Ss "Commands" 5 .Mx -anchor-spass Sh "COMMAND ESCAPES" 6 .Mx -anchor-spass Sh "INTERNAL VARIABLES" 7 .Mx -anchor-spass Ss "Initial settings" 7 .Mx -anchor-spass Ss "Variables" 7 .Mx -anchor-spass Sh "ENVIRONMENT" 8 .Mx -anchor-spass Sh "FILES" 9 .Mx -anchor-spass Ss "Resource files" 9 .Mx -anchor-spass Ss "The mime.types files" 9 .Mx -anchor-spass Ss "The Mailcap files" 9 .Mx -anchor-spass Ss "The .netrc file" 9 .Mx -anchor-spass Sh "EXAMPLES" 10 .Mx -anchor-spass Ss "An example configuration" 10 .Mx -anchor-spass Ss "S/MIME step by step" 10 .Mx -anchor-spass Ss "Using CRLs with S/MIME or TLS" 10 .Mx -anchor-spass Sh "FAQ" 11 .Mx -anchor-spass Ss "\*(UA shortly hangs on startup" 11 .Mx -anchor-spass Ss "I cannot login to Google mail aka GMail" 11 .Mx -anchor-spass Ss "Not \(dqdefunctional\(dq, but the editor key does not work" 11 .Mx -anchor-spass Ss "Can \*(UA git-send-email?" 11 .Mx -anchor-spass Ss "Howto handle stale dotlock files" 11 .Mx -anchor-spass Sh "IMAP CLIENT" 12 .Mx -anchor-spass Sh "SEE ALSO" 13 .Mx -anchor-spass Sh "HISTORY" 14 .Mx -anchor-spass Sh "AUTHORS" 15 .Mx -anchor-spass Sh "CAVEATS" 16 .Mx -anchor-spass Sh "BUGS" 17 .Mx -anchor-spass Fl ":" .Mx -anchor-spass Fl "A" .Mx -anchor-spass Fl "a" .Mx -anchor-spass ixsx "character set specification" .Mx -anchor-spass Fl "b" .Mx -anchor-spass Fl "C" .Mx -anchor-spass Fl "c" .Mx -anchor-spass Fl "D" .Mx -anchor-spass Fl "d" .Mx -anchor-spass Fl "E" .Mx -anchor-spass Fl "e" .Mx -anchor-spass Fl "F" .Mx -anchor-spass Fl "f" .Mx -anchor-spass Fl "H" .Mx -anchor-spass Fl "h" .Mx -anchor-spass Fl "i" .Mx -anchor-spass Fl "L" .Mx -anchor-spass Fl "M" .Mx -anchor-spass Fl "m" .Mx -anchor-spass Fl "N" .Mx -anchor-spass Fl "n" .Mx -anchor-spass Fl "q" .Mx -anchor-spass Fl "R" .Mx -anchor-spass Fl "r" .Mx -anchor-spass Fl "S" .Mx -anchor-spass Fl "s" .Mx -anchor-spass Fl "T" .Mx -anchor-spass Fl "t" .Mx -anchor-spass Fl "u" .Mx -anchor-spass Fl "V" .Mx -anchor-spass Fl "v" .Mx -anchor-spass Fl "X" .Mx -anchor-spass Fl "Y" .Mx -anchor-spass Fl "~" .Mx -anchor-spass Fl "#" .Mx -anchor-spass Fl "." .Mx -anchor-spass ixsx "magic regular expression characters" .Mx -anchor-spass Cd "mle-go-home" .Mx -anchor-spass Cd "mle-go-bwd" .Mx -anchor-spass Cd "mle-del-fwd" .Mx -anchor-spass Cd "mle-go-end" .Mx -anchor-spass Cd "mle-go-fwd" .Mx -anchor-spass Cd "mle-reset" .Mx -anchor-spass Cd "mle-del-bwd" .Mx -anchor-spass Cd "mle-complete" .Mx -anchor-spass Cd "mle-commit" .Mx -anchor-spass Cd "mle-snarf-end" .Mx -anchor-spass Cd "mle-repaint" .Mx -anchor-spass Cd "mle-hist-fwd" .Mx -anchor-spass Cd "mle-hist-bwd" .Mx -anchor-spass Cd "mle-quote-rndtrip" .Mx -anchor-spass Cd "mle-hist-srch-bwd" .Mx -anchor-spass Cd "mle-hist-srch-fwd" .Mx -anchor-spass Cd "mle-paste" .Mx -anchor-spass Cd "mle-snarf-line" .Mx -anchor-spass Cd "mle-prompt-char" .Mx -anchor-spass Cd "mle-snarf-word-bwd" .Mx -anchor-spass Cd "mle-go-word-fwd" .Mx -anchor-spass Cd "mle-go-word-bwd" .Mx -anchor-spass Cd "mle-cancel" .Mx -anchor-spass Cd "mle-snarf-word-fwd" .Mx -anchor-spass Cd "mle-go-screen-fwd" .Mx -anchor-spass Cd "mle-go-screen-bwd" .Mx -anchor-spass Cd "mle-clear-screen" .Mx -anchor-spass Cd "mle-fullreset" .Mx -anchor-spass Cd "mle-bell" .Mx -anchor-spass Cm "\e" .Mx -anchor-spass Cm "ignerr" .Mx -anchor-spass Cm "local" .Mx -anchor-spass Cm "scope" .Mx -anchor-spass Cm "u" .Mx -anchor-spass Cm "vput" .Mx -anchor-spass Cm "wysh" .Mx -anchor-spass ixsx "primary system mailbox" .Mx -anchor-spass ixsx "secondary mailbox" .Mx -anchor-spass Ic "!" .Mx -anchor-spass Ic "#" .Mx -anchor-spass Ic "+" .Mx -anchor-spass Ic "-" .Mx -anchor-spass Ic "=" .Mx -anchor-spass Ic "?" .Mx -anchor-spass Ic "|" .Mx -anchor-spass Ic "account" .Mx -anchor-spass Ic "unaccount" .Mx -anchor-spass Ic "addrcodec" .Mx -anchor-spass Ic "alias" .Mx -anchor-spass Ic "unalias" .Mx -anchor-spass Ic "alternates" .Mx -anchor-spass Ic "unalternates" .Mx -anchor-spass Ic "answered" .Mx -anchor-spass Ic "unanswered" .Mx -anchor-spass Ic "bind" .Mx -anchor-spass Ic "unbind" .Mx -anchor-spass Ic "call" .Mx -anchor-spass Ic "call_if" .Mx -anchor-spass Ic "cd" .Mx -anchor-spass Ic "certsave" .Mx -anchor-spass Ic "charsetalias" .Mx -anchor-spass Ic "uncharsetalias" .Mx -anchor-spass Ic "chdir" .Mx -anchor-spass Ic "collapse" .Mx -anchor-spass Ic "uncollapse" .Mx -anchor-spass Ic "colour" .Mx -anchor-spass Ic "uncolour" .Mx -anchor-spass Ic "commandalias" .Mx -anchor-spass Ic "uncommandalias" .Mx -anchor-spass Ic "Copy" .Mx -anchor-spass Ic "copy" .Mx -anchor-spass Ic "csop" .Mx -anchor-spass Ic "cwd" .Mx -anchor-spass Ic "Decrypt" .Mx -anchor-spass Ic "decrypt" .Mx -anchor-spass Ic "define" .Mx -anchor-spass Ic "undefine" .Mx -anchor-spass Ic "delete" .Mx -anchor-spass Ic "undelete" .Mx -anchor-spass Ic "digmsg" .Mx -anchor-spass Ic "discard" .Mx -anchor-spass Ic "dp" .Mx -anchor-spass Ic "dt" .Mx -anchor-spass Ic "dotmove" .Mx -anchor-spass Ic "draft" .Mx -anchor-spass Ic "undraft" .Mx -anchor-spass Ic "echo" .Mx -anchor-spass Ic "echoerr" .Mx -anchor-spass Ic "echon" .Mx -anchor-spass Ic "echoerrn" .Mx -anchor-spass Ic "edit" .Mx -anchor-spass Ic "elif" .Mx -anchor-spass Ic "else" .Mx -anchor-spass Ic "endif" .Mx -anchor-spass Ic "environ" .Mx -anchor-spass Ic "errors" .Mx -anchor-spass Ic "eval" .Mx -anchor-spass Ic "exit" .Mx -anchor-spass Ic "File" .Mx -anchor-spass Ic "file" .Mx -anchor-spass ixsx "dotlock files" .Mx -anchor-spass Ic "filetype" .Mx -anchor-spass Ic "unfiletype" .Mx -anchor-spass Ic "flag" .Mx -anchor-spass Ic "unflag" .Mx -anchor-spass Ic "folder" .Mx -anchor-spass Ic "folders" .Mx -anchor-spass Ic "Followup" .Mx -anchor-spass Ic "followup" .Mx -anchor-spass Ic "followupall" .Mx -anchor-spass Ic "followupsender" .Mx -anchor-spass Ic "Forward" .Mx -anchor-spass Ic "forward" .Mx -anchor-spass Ic "from" .Mx -anchor-spass Ic "headerpick" .Mx -anchor-spass Ic "unheaderpick" .Mx -anchor-spass Ic "headers" .Mx -anchor-spass Ic "help" .Mx -anchor-spass Ic "history" .Mx -anchor-spass Ic "hold" .Mx -anchor-spass Ic "if" .Mx -anchor-spass Ic "ignore" .Mx -anchor-spass Ic "list" .Mx -anchor-spass Ic "localopts" .Mx -anchor-spass Ic "Lreply" .Mx -anchor-spass Ic "Mail" .Mx -anchor-spass Ic "mail" .Mx -anchor-spass Ic "mbox" .Mx -anchor-spass Ic "mimetype" .Mx -anchor-spass Ic "unmimetype" .Mx -anchor-spass Ic "mimeview" .Mx -anchor-spass Ic "mlist" .Mx -anchor-spass Ic "unmlist" .Mx -anchor-spass Ic "mlsubscribe" .Mx -anchor-spass Ic "unmlsubscribe" .Mx -anchor-spass Ic "Move" .Mx -anchor-spass Ic "move" .Mx -anchor-spass Ic "More" .Mx -anchor-spass Ic "more" .Mx -anchor-spass Ic "netrc" .Mx -anchor-spass Ic "newmail" .Mx -anchor-spass Ic "next" .Mx -anchor-spass Ic "New" .Mx -anchor-spass Ic "new" .Mx -anchor-spass Ic "noop" .Mx -anchor-spass Ic "Page" .Mx -anchor-spass Ic "page" .Mx -anchor-spass Ic "Pipe" .Mx -anchor-spass Ic "pipe" .Mx -anchor-spass Ic "preserve" .Mx -anchor-spass Ic "Print" .Mx -anchor-spass Ic "print" .Mx -anchor-spass Ic "quit" .Mx -anchor-spass Ic "read" .Mx -anchor-spass Ic "readall" .Mx -anchor-spass Ic "readctl" .Mx -anchor-spass Ic "remove" .Mx -anchor-spass Ic "rename" .Mx -anchor-spass Ic "Reply" .Mx -anchor-spass Ic "reply" .Mx -anchor-spass Ic "replyall" .Mx -anchor-spass Ic "replysender" .Mx -anchor-spass Ic "Resend" .Mx -anchor-spass Ic "resend" .Mx -anchor-spass Ic "Respond" .Mx -anchor-spass Ic "respond" .Mx -anchor-spass Ic "respondall" .Mx -anchor-spass Ic "respondsender" .Mx -anchor-spass Ic "retain" .Mx -anchor-spass Ic "return" .Mx -anchor-spass Ic "Save" .Mx -anchor-spass Ic "save" .Mx -anchor-spass Ic "search" .Mx -anchor-spass Ic "seen" .Mx -anchor-spass Ic "set" .Mx -anchor-spass Ic "unset" .Mx -anchor-spass Ic "shcodec" .Mx -anchor-spass Ic "shell" .Mx -anchor-spass Ic "shortcut" .Mx -anchor-spass Ic "unshortcut" .Mx -anchor-spass Ic "shift" .Mx -anchor-spass Ic "show" .Mx -anchor-spass Ic "size" .Mx -anchor-spass Ic "sleep" .Mx -anchor-spass Ic "sort" .Mx -anchor-spass Ic "unsort" .Mx -anchor-spass Ic "source" .Mx -anchor-spass Ic "source_if" .Mx -anchor-spass Ic "spamclear" .Mx -anchor-spass Ic "spamforget" .Mx -anchor-spass Ic "spamham" .Mx -anchor-spass Ic "spamrate" .Mx -anchor-spass Ic "spamset" .Mx -anchor-spass Ic "spamspam" .Mx -anchor-spass Ic "tls" .Mx -anchor-spass Ic "Top" .Mx -anchor-spass Ic "top" .Mx -anchor-spass Ic "touch" .Mx -anchor-spass Ic "Type" .Mx -anchor-spass Ic "type" .Mx -anchor-spass Ic "unignore" .Mx -anchor-spass Ic "Unread" .Mx -anchor-spass Ic "unread" .Mx -anchor-spass Ic "unretain" .Mx -anchor-spass Ic "urlcodec" .Mx -anchor-spass Ic "varshow" .Mx -anchor-spass Ic "verify" .Mx -anchor-spass Ic "version" .Mx -anchor-spass Ic "vexpr" .Mx -anchor-spass Ic "vpospar" .Mx -anchor-spass Ic "visual" .Mx -anchor-spass Ic "write" .Mx -anchor-spass Ic "xcall" .Mx -anchor-spass Ic "xit" .Mx -anchor-spass Ic "z" .Mx -anchor-spass Ic "Z" .Mx -anchor-spass Ic "~~" .Mx -anchor-spass Ic "~!" .Mx -anchor-spass Ic "~." .Mx -anchor-spass Ic "~:" .Mx -anchor-spass Ic "~<" .Mx -anchor-spass Ic "~ ) or .Ql Fcc: , they will be added to any recipients specified on the command line, and are likewise subject to .Va expandaddr validity checks. If a message subject is specified via .Ql Subject: then it will be used in favour of one given on the command line. .Pp More optional headers are .Ql Reply-To: (possibly overriding .Va reply-to ) , .Ql Sender: .Pf ( Va sender ) , .Ql From: .Pf ( Va from and / or option .Fl r ) . .Ql Message-ID: , .Ql In-Reply-To: , .Ql References: and .Ql Mail-Followup-To: , by default created automatically dependent on message context, will be used if specified (a special address massage will however still occur for the latter). Any other custom header field (also see .Fl C , .Va customhdr and .Ic ~^ ) is passed through entirely unchanged, and in conjunction with the options .Fl ~ or .Fl # it is possible to embed .Sx "COMMAND ESCAPES" . Also see .Fl M , m , q . .Mx .It Fl u Ar user , Fl Fl inbox-of Ns =.. Initially read the .Mx -sx .Sx "primary system mailbox" of .Ar user , appropriate privileges presumed; effectively identical to .Ql Fl \&\&f Ns \0%user . .Mx .It Fl V , Fl Fl version Show \*(UAs .Va version and exit. The command .Ic version will also show the list of .Va features : .Ql $ \*(uA -:/ -Xversion -Xx . .Mx .It Fl v , Fl Fl verbose .Ic set Ns ting the internal variable .Va verbose enables display of some informational context messages. Using it twice increases the level of verbosity. .Mx .It Fl X Ar cmd , Fl Fl early-cmd Ns =.. Add the given (or multiple for a multiline argument) .Ar cmd to a list of commands to be executed before normal operation starts. The commands will be evaluated as a unit, just as via .Ic source . Correlates with .Fl # and .Va errexit . .Mx .It Fl Y Ar cmd , Fl Fl cmd Ns =.. Add the given (or multiple for a multiline argument) .Ar cmd to a list of commands to be executed after normal operation has started. The commands will be evaluated successively in the given order, and as if given on the program's standard input. In conjunction with .Fl t they will be evaluated after the template mail has been fully read. .Mx .It Fl ~ , Fl Fl enable-cmd-escapes Enable .Sx "COMMAND ESCAPES" in compose mode even in non-interactive use cases. This can be used to, e.g., automatically format the composed message text before sending the message: .Bd -literal -offset indent $ ( echo 'line one. Word. Word2.';\e echo '~| /usr/bin/fmt -tuw66' ) |\e LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 bob@exam.ple .Ed .Mx .It Fl # , Fl Fl batch-mode Enables batch mode: standard input is made line buffered, the complete set of (interactive) commands is available, processing of .Sx "COMMAND ESCAPES" is enabled in compose mode, and diverse .Sx "INTERNAL VARIABLES" are adjusted for batch necessities, exactly as if done via .Ic set : .Va emptystart , .Pf no Va errexit , .Pf no Va header , .Pf no Va posix , .Va quiet , .Va sendwait , .Va typescript-mode as well as .Ev MAIL , .Ev MBOX and .Va inbox (the latter three to .Pa /dev/null ) . Also, the values of .Ev COLUMNS and .Ev LINES are looked up, and acted upon. The following prepares an email message in a batched dry run: .Bd -literal -offset indent $ LC_ALL=C printf 'm bob\en~s ubject\enText\en~.\enx\en' |\e LC_ALL=C \*(uA -d#:/ -X'alias bob bob@exam.ple' .Ed .Mx .It Fl \&. , Fl Fl end-options This flag forces termination of option processing in order to prevent .Dq option injection (attacks). It also forcefully puts \*(UA into send mode, see .Sx "On sending mail, and non-interactive mode" . .El .Pp All given .Ar to-addr arguments and all receivers established via .Fl b and .Fl c as well as .Fl T are subject to the checks established by .Va expandaddr , one of the .Sx "INTERNAL VARIABLES" ; they all support the flag .Ql shquote . If the setting of .Va expandargv allows their recognition all .Ar mta-option arguments given at the end of the command line after a .Ql -- separator will be passed through to a file-based .Va mta (Mail-Transfer-Agent) and persist for the entire session. .Va expandargv constraints do not apply to the content of .Va mta-arguments . .Ss "A starter" \*(UA is a direct descendant of .Bx Mail, itself a successor to the Research .Ux mail which .Dq was there from the start according to .Sx HISTORY . It thus represents the user side of the .Ux mail system, whereas the system side (Mail-Transfer-Agent, MTA) was traditionally taken by .Xr sendmail 8 , and most MTAs provide a binary of this name for compatibility purposes. If the \*(OPal SMTP .Va mta is included in the .Va features of \*(UA then the system side is not a mandatory precondition for mail delivery. .Pp Because \*(UA strives for compliance with POSIX .Xr mailx 1 it is likely that some configuration settings have to be adjusted before using it is a smooth experience. (Rather complete configuration examples can be found in the section .Sx EXAMPLES . ) The provided global .Pa \*(UR (one of the .Sx "Resource files" ) template bends those standard imposed settings of the .Sx "INTERNAL VARIABLES" a bit towards more user friendliness and safety, however. .Pp For example, it .Ic set Ns s .Va hold and .Va keepsave in order to suppress the automatic moving of messages to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX that would otherwise occur (see .Sx "Message states" ) , and .Va keep to not remove empty system MBOX mailbox files (or all empty such files if .Va posix .Pf aka\0 Ev POSIXLY_CORRECT mode has been enabled) to avoid mangling of file permissions when files eventually get recreated. .Pp It also enables .Va sendwait in order to synchronize \*(UA with the exit status report of the used .Va mta when sending mails. It .Ic set Ns s .Va emptystart to enter interactive startup even if the initial mailbox is empty, .Va editheaders to allow editing of headers as well as .Va fullnames to not strip down addresses in compose mode, and .Va quote to include the message that is being responded to when .Ic reply Ns ing, which is indented by an .Va indentprefix that also deviates from standard imposed settings. .Va mime-counter-evidence is fully enabled, too. .Pp Some random remarks. The file mode creation mask can be managed explicitly via the variable .Va umask . Files and shell pipe output can be .Ic source Ns d for evaluation, also during startup from within the .Sx "Resource files" . .Ss "On sending mail, and non-interactive mode" To send a message to one or more people, using a local or built-in .Va mta (Mail-Transfer-Agent) transport to actually deliver the generated mail message, \*(UA can be invoked with arguments which are the names of people to whom the mail will be sent, and the command line options .Fl b and .Fl c can be used to add (blind) carbon copy receivers: .Bd -literal -offset indent # Via sendmail(1) $ \*(uA -s ubject -a ttach.txt bill@exam.ple # But... try it in an isolated dry-run mode (-d) first $ LC_ALL=C \*(uA -d -:/ -Ssendwait -Sttycharset=utf8 \e -b bcc@exam.ple -c cc@exam.ple \e -Sfullnames -. \e '(Lovely) Bob ' eric@exam.ple # With SMTP $ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=none \e -S from=scriptreply@exam.ple \e -a /etc/mail.rc \e -. eric@exam.ple < /tmp/letter.txt .Ed .Pp If standard input is a terminal rather than the message to be sent, the user is expected to type in the message contents. In this compose mode \*(UA treats lines beginning with the character .Ql ~ special \(en these are so-called .Sx "COMMAND ESCAPES" , which can be used to read in files, process shell commands, add and edit attachments and more; e.g., .Ic ~v or .Ic ~e will start the .Ev VISUAL text .Ev EDITOR , respectively, to revise the message in its current state, .Ic ~h allows editing of the most important message headers, with the potent .Ic ~^ custom headers can be created, for example (more specifically than with .Fl C and .Va customhdr ) . \*(OPally .Ic ~? gives an overview of most other available command escapes. .Pp The command escape .Ic ~. (see there) will call hooks, insert automatic injections and receivers, leave compose mode and send the message once it is completed. Aborting letter composition is possible with either of .Ic ~x or .Ic ~q , the latter of which will save the message in the file denoted by .Ev DEAD unless .Pf no Va save is set. And unless .Va ignoreeof is set the effect of .Ic ~. can also be achieved by typing end-of-transmission (EOT) via .Ql control-D .Pf ( Ql ^D ) at the beginning of an empty line, and .Ic ~q is always reachable by typing end-of-text (ETX) twice via .Ql control-C .Pf ( Ql ^C ) . .Pp A number of .Sx ENVIRONMENT and .Sx "INTERNAL VARIABLES" can be used to alter default behavior. E.g., messages are sent asynchronously, without supervision, unless the internal variable .Va sendwait is set, therefore send errors will not be recognizable until then. .Ic set Ns ting (also via .Fl S ) .Va editalong will automatically startup an editor when compose mode is entered, and editing of headers additionally to plain body content can be enabled via .Va editheaders : \*(ID some, but not all headers can be created, edited or deleted in an editor, then. .Va askcc and .Va askbcc will cause the user to be prompted actively for (blind) carbon-copy recipients, respectively, and (the default) .Va asksend will request confirmation whether the message shall be sent. .Pp The envelope sender address is defined by .Va from , explicitly defining an originating .Va hostname may be desirable, especially with the built-in SMTP Mail-Transfer-Agent .Va mta . .Sx "Character sets" for outgoing message and MIME part content are configurable via .Va sendcharsets , whereas input data is assumed to be in .Va ttycharset . Message data will be passed over the wire in a .Va mime-encoding . MIME parts aka attachments need to be assigned a .Ic mimetype , usually taken out of .Sx "The mime.types files" . Saving a copy of sent messages in a .Va record mailbox may be desirable \(en as for most mailbox .Ic file targets the value will undergo .Sx "Filename transformations" . Some introductional .Fl d or .Va debug sandbox dry-run tests will prove correctness. .Pp Message recipients (as specified on the command line or defined in .Ql To: , .Ql Cc: or .Ql Bcc: ; these support the .Ql ?single modifier to enforce treatment as a single addressee, e.g., .Ql To?single: exa, ) are subject to .Ic alternates filtering, and may not only be email addressees but can also be names of mailboxes and even complete shell command pipe specifications. If the variable .Va expandaddr is not set then only network addresses (see .Xr mailaddr 7 for a description of mail addresses) and plain user names (including MTA aliases) may be used, other types will be filtered out, giving a warning message. A network address that contains no domain-, but only a valid local user .Ql in angle brackets will be automatically expanded to a valid address when .Va hostname is set to a non-empty value; setting it to the empty value instructs \*(UA that the used .Va mta will perform the necessary expansion. The command .Ic addrcodec may help to generate standard compliant network addresses. .Pp If the variable .Va expandaddr is set then an extended set of recipient addresses will be accepted: Any name that starts with a vertical bar .Ql | character specifies a command pipe \(en the command string following the .Ql | is executed and the message is sent to its standard input; Likewise, any name that consists only of hyphen-minus .Ql - or starts with the character solidus .Ql / or the character sequence dot solidus .Ql ./ is treated as a file, regardless of the remaining content. Any other name which contains a commercial at .Ql @ character is a network address; Any other name which starts with a plus sign .Ql + character is a mailbox name; Any other name which contains a solidus .Ql / character but no exclamation mark .Ql \&! or percent sign .Ql % character before is also a mailbox name; What remains is treated as a network address. .Bd -literal -offset indent $ echo bla | \*(uA -Sexpandaddr -s test ./mbox.mbox $ echo bla | \*(uA -Sexpandaddr -s test '|cat >> ./mbox.mbox' $ echo safe | LC_ALL=C \e \*(uA -:/ -Sv15-compat -Ssendwait -Sttycharset=utf8 \e --set mime-force-sendout \e -Sexpandaddr=fail,-all,+addr,failinvaddr -s test \e -. bob@exam.ple .Ed .Pp To create file-carbon-copies the special recipient header .Ql Fcc: may be used as often as desired. Its entire value (or body in standard terms) is interpreted as a .Ic file target, after having been subject to .Sx "Filename transformations" . Beside using the command escape .Ic ~^ (to create a .Ql Fcc header) this is the only way to create a file-carbon-copy without introducing an ambiguity regarding the interpretation of the address, e.g., to use file names with leading vertical bars or commercial ats. Like all other recipients .Ql Fcc: is subject to the checks of .Va expandaddr . Any local file and pipe command addressee honours the setting of .Va mbox-fcc-and-pcc . .Pp It is possible to create personal distribution lists via the .Ic alias command, so that, for instance, the user can send mail to .Ql cohorts and have it go to a group of people. Different to the alias mechanism of a local .Va mta , which is often tracked in a file .Pa /etc/aliases , documented in .Xr aliases 5 , and the names of which are subject to the .Ql name constraint of .Va expandaddr , personal aliases will be expanded by \*(UA before the message is sent. They are thus a convenient alternative to specifying each addressee by itself, correlate with the active set of .Ic alternates , and are subject to .Va metoo filtering. .Bd -literal -offset indent ? alias cohorts bill jkf mark kridle@ucbcory ~/cohorts.mbox ? alias mark mark@exam.ple .Ed .Pp For the purpose of arranging a complete environment of settings that can be switched to with a single command or command line option there are .Ic account Ns s . Alternatively it is also possible to use a flat configuration, making use of so-called variable chains which automatically pick .Ql USER@HOST or .Ql HOST context-dependent variable variants: for example addressing .Ql Ic File Ns \& pop3://yaa@exam.ple would find .Va \&\&pop3-no-apop-yaa@exam.ple , .Va \&\&pop3-no-apop-exam.ple and .Va pop3-no-apop in order. See .Sx "On URL syntax and credential lookup" and .Sx "INTERNAL VARIABLES" . .Pp The compose mode hooks .Va on-compose-enter , on-compose-splice , on-compose-leave and .Va on-compose-cleanup may be set to .Ic define Ns d macros and provide reliable and increasingly powerful mechanisms to perform automated message adjustments dependent on message context, for example addition of message signatures .Pf ( Va message-inject-head , message-inject-tail ) or creation of additional receiver lists (also by setting .Va autocc , autobcc ) . To achieve that the command .Ic digmsg may be used in order to query and adjust status of message(s). The splice hook can also make use of .Sx "COMMAND ESCAPES" . (\*(ID The compose mode hooks work for .Ic forward , mail , reply and variants; .Ic resend and .Ic Resend only provide the hooks .Va on-resend-enter and .Va on-resend-cleanup , which are pretty restricted due to the nature of the operation.) .Pp To avoid environmental noise scripts should .Dq detach \*(UA from any configuration files and create a script-local environment, ideally with the command line options .Fl \&: to disable any configuration file in conjunction with repetitions of .Fl S to specify variables: .Bd -literal -offset indent $ env LC_ALL=C \*(uA -:/ \e -Sv15-compat -Ssendwait \e -Sttycharset=utf-8 -Smime-force-sendout \e -Sexpandaddr=fail,-all,failinvaddr \e -S mta=smtps://mylogin@exam.ple:465 -Ssmtp-auth=login \e -S from=scriptreply@exam.ple \e -s 'Subject to go' -a attachment_file \e -Sfullnames -. \e 'Recipient 1 ' rec2@exam.ple \e < content_file .Ed .Pp As shown, scripts can .Dq fake a locale environment, the above specifies the all-compatible 7-bit clean .Ev LC_ALL .Dq C , but will nonetheless take and send UTF-8 in the message text by using .Va ttycharset . If character set conversion is compiled in .Pf ( Va features includes the term .Ql +iconv ) invalid (according to .Va ttycharset ) character input data would normally cause errors; setting .Va mime-force-sendout will instead, as a last resort, classify the input as binary data, and therefore allow message creation to be successful. (Such content can then be inspected either by installing a .Va pipe-TYPE/SUBTYPE handler for .Ql application/octet-stream , or possibly automatically through .Va mime-counter-evidence ) . .Pp In interactive mode, which is introduced in the next section, messages can be sent by calling the .Ic mail command with a list of recipient addresses: .Bd -literal -offset indent $ \*(uA -d -Squiet -Semptystart "/var/spool/mail/user": 0 messages ? mail "Recipient 1 ", rec2@exam.ple \&... ? # Will do the right thing (tm) ? m rec1@exam.ple rec2@exam.ple .Ed .Ss "On reading mail, and interactive mode" When invoked without addressees \*(UA enters interactive mode in which mails may be read. When used like that the user's system .Va inbox (for more on mailbox types please see the command .Ic file ) is read in and a one line header of each message therein is displayed if the variable .Va header is set. The visual style of this summary of .Ic headers can be adjusted through the variable .Va headline and the possible sorting criterion via .Va autosort . Scrolling through .Va screen Ns fuls of .Ic headers can be performed with the command .Ic z . If the initially opened mailbox is empty \*(UA will instead exit immediately (after displaying a message) unless the variable .Va emptystart is set. .Pp At the .Va prompt the command .Ic list will give a listing of all available commands and .Ic help will \*(OPally give a summary of some common ones. If the \*(OPal documentation strings are available (see .Va features ) one can type .Ql help X .Pf "(or " Ql \&?X ) and see the actual expansion of .Ql X and what its purpose is, i.e., commands can be abbreviated (note that POSIX defines some abbreviations, so that the alphabetical order of commands does not necessarily relate to the abbreviations; it is however possible to define overwrites with .Ic commandalias ) . These commands can also produce a more .Va verbose output. .Pp Messages are given numbers (starting at 1) which uniquely identify messages; the current message \(en the .Dq dot \(en will either be the first new message, or the first unread message, or the first message of the mailbox; the internal variable .Va showlast will instead cause usage of the last message for this purpose. The command .Ic headers will display a .Va screen Ns ful of header summaries containing the .Dq dot , whereas .Ic from will display only the summaries of the given messages, defaulting to the .Dq dot . .Pp Message content can be displayed with the command .Ic type .Pf ( Ql t , alias .Ic print ) . Here the variable .Va crt controls whether and when \*(UA will use the configured .Ev PAGER for display instead of directly writing to the user terminal .Va screen , the sole difference to the command .Ic more , which will always use the .Ev PAGER . The command .Ic top will instead only show the first .Va toplines of a message (maybe even compressed if .Va topsqueeze is set). Message display experience may improve by setting and adjusting .Va mime-counter-evidence , and also see .Sx "HTML mail and MIME attachments" . .Pp By default the current message .Pf ( Dq dot ) is displayed, but like with many other commands it is possible to give a fancy message specification (see .Sx "Specifying messages" ) , e.g., .Ql t:u will display all unread messages, .Ql t. will display the .Dq dot , .Ql t 1 5 will type the messages 1 and 5, .Ql t 1-5 will type the messages 1 through 5, and .Ql t- and .Ql t+ will display the previous and the next message, respectively. The command .Ic search (a more substantial alias for .Ic from ) will display a header summary of the given message specification list instead of their content, e.g., the following will search for subjects: .Pp .Dl ? from "'@Some subject to search for'" .Pp In the default setup all header fields of a message will be .Ic type Ns d, but fields can be white- or blacklisted for a variety of applications by using the command .Ic headerpick , e.g., to restrict their display to a very restricted set for .Ic type : .Ql Ic \:headerpick Cd \:type retain Ar \:from to cc subject . In order to display all header fields of a message regardless of currently active ignore or retain lists, use the commands .Ic Type and .Ic Top ; .Ic Show will show the raw message content. Note that historically the global .Pa \*(UR not only adjusts the list of displayed headers, but also sets .Va crt . (\*(ID A yet somewhat restricted) Reliable scriptable message inspection is available via .Ic digmsg . .Pp Dependent upon the configuration a line editor (see the section .Sx "On terminal control and line editor" ) aims at making the user experience with the many .Sx COMMANDS a bit nicer. When reading the system .Va inbox , or when .Fl f (or .Ic file ) specified a mailbox explicitly prefixed with the special .Ql %: modifier (to propagate it to a .Mx -sx .Sx "primary system mailbox" ) , then messages which have been read .Pf (see\0 Sx "Message states" ) will be automatically moved to a .Mx -sx .Sx "secondary mailbox" , the user's .Ev MBOX file, when the mailbox is left, either by changing the active mailbox or by quitting \*(UA \(en this automatic moving from a system- or primary- to the secondary mailbox is not performed when the variable .Va hold is set. Messages can also be explicitly .Ic move Ns d to other mailboxes, whereas .Ic copy keeps the original message. .Ic write can be used to write out data content of specific parts of messages. .Pp After examining a message the user can .Ic reply Ql r to the sender and all recipients (which will also be placed in .Ql To: unless .Va recipients-in-cc is set), or .Ic Reply Ql R exclusively to the sender(s). The command .Ic Lreply knows how to apply a special addressee massage, see .Sx "Mailing lists" . Dependent on the presence and value of .Va quote the message being replied to will be included in a quoted form. .Ic forward Ns ing a message will allow editing the new message: the original message will be contained in the message body, adjusted according to .Ic headerpick . It is possible to .Ic resend or .Ic Resend messages: the former will add a series of .Ql Resent- headers, whereas the latter will not; different to newly created messages editing is not possible and no copy will be saved even with .Va record unless the additional variable .Va record-resent is set. When sending, replying or forwarding messages comments and full names will be stripped from recipient addresses unless the internal variable .Va fullnames is set. .Pp Of course messages can be .Ic delete Ql d , and they can spring into existence again via .Ic undelete , or when the \*(UA session is ended via the .Ic exit or .Ic xit commands to perform a quick program termation. To end a mail processing session regulary and perform a full program exit one may issue the command .Ic quit . It will, among others, move read messages to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX as necessary, discard deleted messages in the current mailbox, and update the \*(OPal (see .Va features ) line editor .Va history-file . .Ss "HTML mail and MIME attachments" Messages which are HTML-only become more and more common, and of course many messages come bundled with a bouquet of MIME (Multipurpose Internet Mail Extensions) parts. To get a notion of MIME types \*(UA has a default set of types built-in, onto which the content of .Sx "The mime.types files" will be added (as configured and allowed by .Va mimetypes-load-control ) . Types can also become registered with the command .Ic mimetype . To improve interaction with faulty MIME part declarations which are often seen in real-life messages, setting .Va mime-counter-evidence will allow verification of the given assertion, and possible provision of an alternative, better MIME type. .Pp Whereas \*(UA \*(OPally supports a simple HTML-to-text filter for displaying HTML messages (indicated by .Ql +filter-html-tagsoup in .Va features ) , it cannot handle MIME types other than plain text itself. Instead programs need to become registered to deal with specific MIME types or file extensions. These programs may either prepare plain text versions of their input in order to enable \*(UA to integrate their output neatlessly in its own message visualization (a mode which is called .Cd copiousoutput ) , or display the content themselves, for example in an external graphical window: such handlers will only be considered by and for the command .Ic mimeview . .Pp To install a handler program for a specific MIME type an according .Va pipe-TYPE/SUBTYPE variable needs to be set; to instead define a handler for a specific file extension the respective .Va pipe-EXTENSION variable can be used \(en these handlers take precedence. \*(OPally \*(UA supports mail user agent configuration as defined in RFC 1524; this mechanism (see .Sx "The Mailcap files" ) will be queried for display or quote handlers if none of the former two did; it will be the sole source for handlers of other purpose. A last source for handlers is the MIME type definition itself, if a type-marker has been registered with the command .Ic mimetype , which many of the built-in MIME types do. .Pp For example, to display a HTML message inline (converted to a more fancy plain text representation than the built-in filter is capable to produce) with either of the text-mode browsers .Xr lynx 1 or .Xr elinks 1 , teach \*(UA about MathML documents and make it display them as plain text, and to open PDF attachments in an external PDF viewer, asynchronously and with some other magic attached: .Bd -literal -offset indent ? if [ "$features" !% +filter-html-tagsoup ] ? #set pipe-text/html='?* elinks -force-html -dump 1' ? set pipe-text/html='?* lynx -stdin -dump -force_html' ? # Display HTML as plain text instead ? #set pipe-text/html=? ? endif ? mimetype ? application/mathml+xml mathml ? wysh set pipe-application/pdf='?&=? \e trap "rm -f \e"${MAILX_FILENAME_TEMPORARY}\e"" EXIT;\e trap "trap \e"\e" INT QUIT TERM; exit 1" INT QUIT TERM;\e mupdf "${MAILX_FILENAME_TEMPORARY}"' .Ed .Ss "Mailing lists" Known or subscribed-to mailing lists may be flagged in the summary of .Ic headers .Pf ( Va headline format character .Ql %L ) , and will gain special treatment when sending mails: the variable .Va followup-to-honour will ensure that a .Ql Mail-\:Followup-\:To: header is honoured when a message is being replied to .Pf ( Ic reply and .Ic Lreply ) , and .Va followup-to controls creation of this header when creating .Ic mail Ns s; it may be created automatically, e.g., when list-replying via .Ic Lreply , when .Ic reply is used and the messages .Ql Mail-Followup-To: is honoured etc. .Pp The commands .Ic mlist and .Ic mlsubscribe manage \*(UAs notion of which addresses are mailing lists. With the \*(OPal regular expression support any such address .Mx -ix "magic regular expression characters" which contains magic regular expression characters .Ql ( ^[]*+?|$ ; see .Xr re_format 7 or .Xr regex 7 , dependent on the host system) will be compiled and used as one, possibly matching many addresses. .Bd -literal -offset indent ? set followup-to followup-to-honour=ask-yes \e reply-to-honour=ask-yes ? mlist a1@b1.c1 a2@b2.c2 '.*@lists\e.c3$' ? mlsubscribe a4@b4.c4 exact@lists.c3 .Ed .Pp Known and subscribed lists differ in that for the latter the .Va user Ns s address is not part of a generated .Ql Mail-Followup-To: . There are exceptions, for example if multiple lists are addressed and not all have the subscription attribute. When replying to a message its list address .Pf ( Ql List-Post: header) is automatically and temporarily treated like a known .Ic mlist ; dependent on the variable .Va reply-to-honour an existing .Ql Reply-To: is used instead (if it is a single address on the same domain as .Ql List-Post: ) in order to accept a list administrator's wish that is supposed to have been manifested like that. .Ss "Signed and encrypted messages with S/MIME" \*(OP S/MIME provides two central mechanisms: message signing and message encryption. A signed message contains some data in addition to the regular text. The data can be used to verify that the message has been sent using a valid certificate, that the sender address matches that in the certificate, and that the message text has not been altered. Signing a message does not change its regular text; it can be read regardless of whether the recipients software is able to handle S/MIME. It is thus usually possible to sign all outgoing messages if so desired. .Pp Encryption, in contrast, makes the message text invisible for all people except those who have access to the secret decryption key. To encrypt a message, the specific recipients public encryption key must be known. It is therefore not possible to send encrypted mail to people unless their key has been retrieved from either previous communication or public key directories. Because signing is performed with private keys, and encryption with public keys, messages should always be signed before becoming encrypted. .Pp A central concept to S/MIME is that of the certification authority (CA). A CA is a trusted institution that issues certificates. For each of these certificates it can be verified that it really originates from the CA, provided that the CA's own certificate is previously known. A set of CA certificates is usually delivered and installed together with the cryptographical library that is used on the local system. Therefore reasonable security for S/MIME on the Internet is provided if the source that provides that library installation is trusted. It is also possible to use a specific pool of trusted certificates. If this is desired, .Va smime-ca-no-defaults should be set to avoid using the default certificate pool, and .Va smime-ca-file and/or .Va smime-ca-dir should be pointed to a trusted pool of certificates. A certificate cannot be more secure than the method its CA certificate has been retrieved with. .Pp This trusted pool of certificates is used by the command .Ic verify to ensure that the given S/MIME messages can be trusted. If so, verified sender certificates that were embedded in signed messages can be saved locally with the command .Ic certsave , and used by \*(UA to encrypt further communication with these senders: .Bd -literal -offset indent ? certsave FILENAME ? set smime-encrypt-USER@HOST=FILENAME \e smime-cipher-USER@HOST=AES256 .Ed .Pp To sign outgoing messages, in order to allow receivers to verify the origin of these messages, a personal S/MIME certificate is required. \*(UA supports password-protected personal certificates (and keys), see .Va smime-sign-cert . The section .Sx "On URL syntax and credential lookup" gives an overview of the possible sources of user credentials, and .Sx "S/MIME step by step" shows examplarily how a private S/MIME certificate can be obtained. In general, if such a private key plus certificate .Dq pair is available, all that needs to be done is to set some variables: .Bd -literal -offset indent ? set smime-sign-cert=ME@exam.ple.paired \e smime-sign-digest=SHA512 \e smime-sign .Ed .Pp Variables of interest for S/MIME in general are .Va smime-ca-dir , .Va smime-ca-file , .Va smime-ca-flags , .Va smime-ca-no-defaults , .Va smime-crl-dir , .Va smime-crl-file . For S/MIME signing of interest are .Va smime-sign , .Va smime-sign-cert , .Va smime-sign-include-certs and .Va smime-sign-digest . Additional variables of interest for S/MIME en- and decryption: .Va smime-cipher and .Va smime-encrypt-USER@HOST . S/MIME is available if .Ql +smime is included in .Va features . .Pp \*(ID Note that neither S/MIME signing nor encryption applies to message subjects or other header fields yet. Thus they may not contain sensitive information for encrypted messages, and cannot be trusted even if the message content has been verified. When sending signed messages, it is recommended to repeat any important header information in the message text. .Ss "On URL syntax and credential lookup" \*(IN For accessing protocol-specific resources usage of Uniform Resource Locators (URL, RFC 1738) has become omnipresent. \*(UA expects and understands URLs in the following form; parts in brackets .Ql [] denote optional parts, optional either because there also exist other ways to define the information in question or because support of the part is protocol-specific, e.g., .Ql /path is used by the \*(OPal Maildir directory and the IMAP protocol, but not by POP3; If any of .Ql USER and .Ql PASSWORD are specified they must be given in URL percent encoded form (RFC 3986; the command .Ic urlcodec may be helpful): .Pp .Dl PROTOCOL://[USER[:PASSWORD]@]server[:port][/path] .Pp Note that these \*(UA URLs most often do not conform to any real standard, but instead represent a normalized variant of RFC 1738 \(en they are not used in data exchange but only meant as a compact, easy-to-use way of defining and representing information in a well-known notation. .Pp Many internal variables of \*(UA exist in multiple versions, called variable chains for the rest of this document: the plain .Ql variable as well as .Ql variable-HOST and .Ql variable-USER@HOST . Here .Ql HOST indeed means .Ql server:port if a .Ql port had been specified in the respective URL, otherwise it refers to the plain .Ql server . Also, .Ql USER is not truly the .Ql USER that had been found when doing the user chain lookup as is described below, i.e., this .Ql USER will never be in URL percent encoded form, whether it came from an URL or not; i.e., variable chain name extensions of .Sx "INTERNAL VARIABLES" must not be URL percent encoded. .Pp For example, whether an hypothetical URL .Ql smtp://hey%3Ayou@our.house had been given that includes a user, or whether the URL was .Ql smtp://our.house and the user had been found differently, to lookup the variable chain .Va smtp-use-starttls \*(UA first looks for whether .Ql smtp-\:use-\:starttls-\:hey:you@our.house is defined, then whether .Ql smtp-\:use-\:starttls-\:our.house exists before finally ending up looking at the plain variable itself. .Pp \*(UA obeys the following logic scheme when dealing with the necessary credential information of an account: .Bl -bullet .It If no .Ql USER has been given in the URL the variables .Va user-HOST and .Va user are looked up. If no such variable(s) can be found then \*(UA will, when enforced by the \*(OPal variables .Va netrc-lookup-HOST or .Va netrc-lookup , search .Sx "The .netrc file" of the user for a .Ql HOST specific entry which provides a .Ql login name: this lookup will only succeed if unambiguous (one possible matching entry for .Ql HOST ) . .Pp If there is still no .Ql USER then \*(UA will fall back to the user who is supposed to run \*(UA, the identity of which has been fixated during \*(UA startup and is known to be a valid user on the current host. .It Authentication: unless otherwise noted this will lookup the .Va PROTOCOL-auth-USER@HOST , PROTOCOL-auth-HOST , PROTOCOL-auth variable chain, falling back to a protocol-specific default should this have no success. .It If no .Ql PASSWORD has been given in the URL, then if the .Ql USER has been found through the \*(OPal .Va netrc-lookup that may have already provided the password, too. Otherwise the variable chain .Va password-USER@HOST , password-HOST , password is looked up and used if existent. .Pp Afterwards the complete \*(OPal variable chain .Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup is looked up. If set, the .Ic netrc cache is searched for a password only (multiple user accounts for a single machine may exist as well as a fallback entry without user but with a password). .Pp If at that point there is still no password available, but the (protocols') chosen authentication type requires a password, then in interactive mode the user will be prompted on the terminal. .El .Pp .Sy Note: S/MIME verification works relative to the values found in the .Ql From: (or .Ql Sender: ) header field(s), which means that the values of .Va smime-sign , smime-sign-cert , smime-sign-include-certs and .Va smime-sign-digest will not be looked up using the .Ql USER and .Ql HOST chains from above but instead use the corresponding values from the message that is being worked on. In unusual cases multiple and different .Ql USER and .Ql HOST combinations may therefore be involved \(en on the other hand those unusual cases become possible. The usual case is as short as: .Bd -literal -offset indent set mta=smtp://USER:PASS@HOST smtp-use-starttls \e smime-sign smime-sign-cert=+smime.pair .Ed .Pp The section .Sx EXAMPLES contains complete example configurations. .Ss "Encrypted network communication" \*(OP SSL (Secure Sockets Layer) aka its successor TLS (Transport Layer Security) are protocols which aid in securing communication by providing a safely initiated and encrypted network connection. A central concept of TLS is that of certificates: as part of each network connection setup a (set of) certificates will be exchanged, and by using those the identity of the network peer can be cryptographically verified; if possible the TLS/SNI (ServerNameIndication) extension will be enabled in order to allow servers fine-grained control over the certificates being used. TLS works by using a locally installed pool of trusted certificates, and verifying the connection peer succeeds if that provides a certificate which has been issued or is trusted by any certificate in the trusted local pool. .Pp The local pool of trusted so-called CA (Certification Authority) certificates is usually delivered with the used TLS library, and will be selected automatically. It is also possible to use a specific pool of trusted certificates. If this is desired, .Va tls-ca-no-defaults should be set to avoid using the default certificate pool, and .Va tls-ca-file and/or (with special preparation) .Va tls-ca-dir should be pointed to a trusted pool of certificates. A certificate cannot be more secure than the method its CA certificate has been retrieved with. For inspection or other purposes, the certificate of a server (as seen when connecting to it) can be fetched like this: .Bd -literal -offset indent $ &1 | tee log.txt .Ed .Pp \*(UA also supports a mode of operation in which certificates are not at all matched against a local pool of CA certificates. Instead a message digest will be calculated for the certificate presented by the connection peer, and be compared against .Va tls-fingerprint (a variable chain that picks up .Ql USER@HOST or .Ql HOST context-dependent variable variants), and the connection will succeed if the calculated digest equals the expected one. The used message digest can be configured via (the chain) .Va tls-fingerprint-digest . The command .Ic tls may be helpful. .Pp It depends on the used protocol whether encrypted communication is possible, and which configuration steps have to be taken to enable it. Some protocols, e.g., POP3S, are implicitly encrypted, others, like POP3, can upgrade a plain text connection if so requested. For example, to use the .Ql STLS that POP3 offers (a member of) the variable (chain) .Va pop3-use-starttls needs to be set, with convenience via .Ic shortcut : .Bd -literal -offset indent shortcut encpop1 pop3s://pop1.exam.ple shortcut encpop2 pop3://pop2.exam.ple set pop3-use-starttls-pop2.exam.ple set mta=smtps://smtp.exam.ple:465 set mta=smtp://smtp.exam.ple smtp-use-starttls .Ed .Pp Normally that is all there is to do, given that TLS libraries try to provide safe defaults, plenty of knobs however exist to adjust settings. For example certificate verification settings can be fine-tuned via .Va tls-ca-flags , and the TLS configuration basics are accessible via .Va tls-config-pairs , for example to specify the allowed protocols or cipher lists that a communication channel may use. In the past hints on how to restrict the set of protocols to highly secure ones were indicated, but as of the time of this writing the list of protocols or ciphers may need to become relaxed in order to be able to connect to some servers; the following example allows connecting to a .Dq Lion that uses OpenSSL 0.9.8za from June 2014 (refer to .Sx "INTERNAL VARIABLES" for more on variable chains): .Bd -literal -offset indent wysh set tls-config-pairs-lion@exam.ple='MinProtocol=TLSv1.1,\e CipherString=TLSv1.2:!aNULL:!eNULL:\e ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:\e DHE-RSA-AES256-SHA:@STRENGTH' .Ed .Pp The OpenSSL program .Xr ciphers 1 can be used and should be referred to when creating a custom cipher list. Variables of interest for TLS in general are .Va tls-ca-dir , .Va tls-ca-file , .Va tls-ca-flags , .Va tls-ca-no-defaults , .Va tls-config-file , .Va tls-config-module , .Va tls-config-pairs , .Va tls-crl-dir , .Va tls-crl-file , .Va tls-rand-file as well as .Va tls-verify . Also see .Va tls-features . TLS is available if .Ql +tls is included in .Va features . .Ss "Character sets" \*(OP \*(UA detects the character set of the terminal by using mechanisms that are controlled by the .Ev LC_CTYPE environment variable (in fact .Ev LC_ALL , .Ev \&\&LC_CTYPE , .Ev LANG , in that order, see there). The internal variable .Va ttycharset will be set to the detected terminal character set accordingly, and will thus show up in the output of commands like, e.g., .Ic set and .Ic varshow . .Pp However, the user may give .Va ttycharset a value during startup, making it possible to send mail in a completely .Dq faked locale environment, an option which can be used to generate and send, e.g., 8-bit UTF-8 input data in a pure 7-bit US-ASCII .Ql LC_ALL=C environment (an example of this can be found in the section .Sx "On sending mail, and non-interactive mode" ) . Changing the value does not mean much beside that, because several aspects of the real character set are implied by the locale environment of the system, which stays unaffected by .Va ttycharset . .Pp Messages and attachments which consist of 7-bit clean data will be classified as consisting of .Va charset-7bit character data. This is a problem if the .Va ttycharset character set is a multibyte character set that is also 7-bit clean. For example, the Japanese character set ISO-2022-JP is 7-bit clean but capable to encode the rich set of Japanese Kanji, Hiragana and Katakana characters: in order to notify receivers of this character set the mail message must be MIME encoded so that the character set ISO-2022-JP can be advertised! To achieve this, the variable .Va charset-7bit must be set to ISO-2022-JP. (Today a better approach regarding email is the usage of UTF-8, which uses 8-bit bytes for non-US-ASCII data.) .Pp If the \*(OPal character set conversion capabilities are not available .Pf ( Va features does not include the term .Ql +iconv ) , then .Va ttycharset will be the only supported character set, it is simply assumed that it can be used to exchange 8-bit messages (over the wire an intermediate, configurable .Va mime-encoding may be applied), and the rest of this section does not apply; it may however still be necessary to explicitly set it if automatic detection fails, since in that case it defaults to LATIN1 aka ISO-8859-1 unless the operating system environment is known to always and exclusively support UTF-8 locales. .Pp \*(OP When reading messages, their text is converted into .Va ttycharset as necessary in order to display them on the user's terminal. Unprintable characters and invalid byte sequences are detected and replaced by proper substitution characters. Character set mappings for source character sets can be established with the command .Ic charsetalias , which may be handy to work around faulty character set catalogues (e.g., to add a missing LATIN1 to ISO-8859-1 mapping), or to enforce treatment of one character set as another one (e.g., to interpret LATIN1 as CP1252). Also see .Va charset-unknown-8bit to deal with another hairy aspect of message interpretation. .Pp When sending messages their parts and attachments are classified. Whereas no character set conversion is performed on those parts which appear to be binary data, the character set being used must be declared within the MIME header of an outgoing text part if it contains characters that do not conform to the set of characters that are allowed by the email standards. Permissible values for character sets used in outgoing messages can be declared using the .Va sendcharsets variable, and .Va charset-8bit , which defines a catch-all last-resort fallback character set that is implicitly appended to the list of character sets in .Va sendcharsets . .Pp When replying to a message and the variable .Va reply-in-same-charset is set, then the character set of the message being replied to is tried first (still being a subject of .Ic charsetalias ) . And it is also possible to make \*(UA work even more closely related to the current locale setting automatically by using the variable .Va sendcharsets-else-ttycharset , please see there for more information. .Pp All the specified character sets are tried in order unless the conversion of the part or attachment succeeds. If none of the tried (8-bit) character sets is capable to represent the content of the part or attachment, then the message will not be send and its text will optionally be .Va save Ns d in .Ev DEAD . If that is not acceptable, the variable .Va mime-force-sendout can be set in order to force sending of non-convertible text as .Ql application/octet-stream classified binary content instead; like this receivers still have the option to inspect message content (for example by setting .Va mime-counter-evidence ) . .Pp In general, if a message saying .Dq cannot convert from a to b appears, either some characters are not appropriate for the currently selected (terminal) character set, or the needed conversion is not supported by the system. In the first case, it is necessary to set an appropriate .Ev LC_CTYPE locale and/or the variable .Va ttycharset . The best results are usually achieved when \*(UA is run in a UTF-8 locale on an UTF-8 capable terminal, in which case the full Unicode spectrum of characters is available. In this setup characters from various countries can be displayed, while it is still possible to use more simple character sets for sending to retain maximum compatibility with older mail clients. .Pp On the other hand the POSIX standard defines a locale-independent 7-bit .Dq portable character set that should be used when overall portability is an issue, the even more restricted subset named .Dq portable filename character set consists of A-Z, a-z, 0-9, period .Ql \&. , underscore .Ql _ and hyphen-minus .Ql - . .Ss "Message states" \*(UA differentiates in between several message states; the current state will be reflected in the summary of .Ic headers if the .Va attrlist of the configured .Va headline allows, and .Sx "Specifying messages" dependent on their state is possible. When operating on the system .Va inbox , or in any other .Mx -sx .Sx "primary system mailbox" , special actions, like the automatic moving of messages to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX , may be applied when the mailbox is left (also implicitly by program termination, unless the command .Ic exit was used) \(en however, because this may be irritating to users which are used to .Dq more modern mail-user-agents, the provided global .Pa \*(UR template sets the internal .Va hold and .Va keepsave variables in order to suppress this behaviour. .Bl -hang -width ".It Ql new" .It Ql new Message has neither been viewed nor moved to any other state. Such messages are retained even in the .Mx -sx .Sx "primary system mailbox" . .It Ql unread Message has neither been viewed nor moved to any other state, but the message was present already when the mailbox has been opened last: Such messages are retained even in the .Mx -sx .Sx "primary system mailbox" . .It Ql read The message has been processed by one of the following commands: .Ic ~f , .Ic ~m , .Ic ~F , .Ic ~M , .Ic copy , .Ic mbox , .Ic next , .Ic pipe , .Ic Print , .Ic print , .Ic top , .Ic Type , .Ic type , .Ic undelete . The commands .Ic dp and .Ic dt will always try to automatically .Dq step and .Ic type the .Dq next logical message, and may thus mark multiple messages as read, the .Ic delete command will do so if the internal variable .Va autoprint is set. .Pp Except when the .Ic exit command is used, messages that are in a .Mx -sx .Sx "primary system mailbox" and are in .Ql read state when the mailbox is left will be saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX unless the internal variable .Va hold it set. .It Ql deleted The message has been processed by one of the following commands: .Ic delete , .Ic dp , .Ic dt . Only .Ic undelete can be used to access such messages. .It Ql preserved The message has been processed by a .Ic preserve command and it will be retained in its current location. .It Ql saved The message has been processed by one of the following commands: .Ic save or .Ic write . Unless when the .Ic exit command is used, messages that are in a .Mx -sx .Sx "primary system mailbox" and are in .Ql saved state when the mailbox is left will be deleted; they will be saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX when the internal variable .Va keepsave is set. .El .Pp In addition to these message states, flags which otherwise have no technical meaning in the mail system except allowing special ways of addressing them when .Sx "Specifying messages" can be set on messages. These flags are saved with messages and are thus persistent, and are portable between a set of widely used MUAs. .Bl -hang -width ".It Ic answered" .It Ic answered Mark messages as having been answered. .It Ic draft Mark messages as being a draft. .It Ic flag Mark messages which need special attention. .El .Ss "Specifying messages" \*(NQ Commands which take .Sx "Message list arguments" , such as .Ic from aka\& .Ic search , .Ic type and .Ic delete , can be given a list of message numbers as arguments to apply to a number of messages at once. Thus .Ql delete 1 2 deletes messages 1 and 2, whereas .Ql delete 1-5 will delete the messages 1 through 5. In sorted or threaded mode (see the .Ic sort command), .Ql delete 1-5 will delete the messages that are located between (and including) messages 1 through 5 in the sorted/threaded order, as shown in the .Ic headers summary. The following special message names exist: .Bl -tag -width ".It Ar BaNg" .It Ar \&. The current message, the so-called .Dq dot . .It Ar \&; The message that was previously the current message; needs to be quoted. .It Ar \&, The parent message of the current message, that is the message with the Message-ID given in the .Ql In-Reply-To: field or the last entry of the .Ql References: field of the current message. .It Ar - The previous undeleted message, or the previous deleted message for the .Ic undelete command; In .Ic sort Ns ed or .Ql thread Ns ed mode, the previous such message in the according order. .It Ar + The next undeleted message, or the next deleted message for the .Ic undelete command; In .Ic sort Ns ed or .Ql thread Ns ed mode, the next such message in the according order. .It Ar ^ The first undeleted message, or the first deleted message for the .Ic undelete command; In .Ic sort Ns ed or .Ql thread Ns ed mode, the first such message in the according order. .It Ar $ The last message; In .Ic sort Ns ed or .Ql thread Ns ed mode, the last such message in the according order. Needs to be quoted. .It Ar & Ns Ar x In .Ql thread Ns ed .Ic sort mode, selects the message addressed with .Ar x , where .Ar x is any other message specification, and all messages from the thread that begins at it. Otherwise it is identical to .Ar x . If .Ar x is omitted, the thread beginning with the current message is selected. .It Ar * All messages. .It Ar ` All messages that were included in the .Sx "Message list arguments" of the previous command; needs to be quoted. .It Ar x-y An inclusive range of message numbers. Selectors that may also be used as endpoints include any of .Ar .;-+^$ . .It Ar address A case-insensitive .Dq any substring matches search against the .Ql From: header, which will match addresses (too) even if .Va showname is set (and POSIX says .Dq any address as shown in a header summary shall be matchable in this form ) ; However, if the .Va allnet variable is set, only the local part of the address is evaluated for the comparison, not ignoring case, and the setting of .Va showname is completely ignored. For finer control and match boundaries use the .Ql @ search expression. .It Ar / Ns Ar string All messages that contain .Ar string in the subject field (case ignored according to locale). See also the .Va searchheaders variable. If .Ar string is empty, the string from the previous specification of that type is used again. .It Xo Op Ar @ Ns Ar name-list Ns .Ar @ Ns Ar expr .Xc All messages that contain the given case-insensitive search .Ar expr Ns ession; If the \*(OPal regular expression support is available .Ar expr will be interpreted as (an extended) one if any of the .Mx -sx .Sx "magic regular expression characters" is seen. If the optional .Ar @ Ns Ar name-list part is missing the search is restricted to the subject field body, but otherwise .Ar name-list specifies a comma-separated list of header fields to search, e.g., .Pp .Dl '@to,from,cc@Someone i ought to know' .Pp In order to search for a string that includes a .Ql @ (commercial at) character the .Ar name-list is effectively non-optional, but may be given as the empty string. Also, specifying an empty search .Ar expr Ns ession will effectively test for existence of the given header fields. Some special header fields may be abbreviated: .Ql f , .Ql t , .Ql c , .Ql b and .Ql s will match .Ql From , .Ql To , .Ql Cc , .Ql Bcc and .Ql Subject , respectively and case-insensitively. \*(OPally, and just like .Ar expr , .Ar name-list will be interpreted as (an extended) regular expression if any of the .Mx -sx .Sx "magic regular expression characters" is seen. .Pp The special names .Ql header or .Ql < can be used to search in (all of) the header(s) of the message, and the special names .Ql body or .Ql > and .Ql text or .Ql = will perform full text searches \(en whereas the former searches only the body, the latter also searches the message header (\*(ID this mode yet brute force searches over the entire decoded content of messages, including administrativa strings). .Pp This specification performs full text comparison, but even with regular expression support it is almost impossible to write a search expression that safely matches only a specific address domain. To request that the body content of the header is treated as a list of addresses, and to strip those down to the plain email address which the search expression is to be matched against, prefix the effective .Ar name-list with a tilde .Ql ~ : .Pp .Dl '@~f,c@@a\e.safe\e.domain\e.match$' .It Ar :c All messages of state or with matching condition .Ql c , where .Ql c is one or multiple of the following colon modifiers: .Pp .Bl -tag -compact -width ".It Ar :M" .It Ar a .Ic answered messages (cf. the variable .Va markanswered ) . .It Ar d .Ql deleted messages (for the .Ic undelete and .Ic from commands only). .It Ar f .Ic flag Ns ged messages. .It Ar L Messages with receivers that match .Ic mlsubscribe Ns d addresses. .It Ar l Messages with receivers that match .Ic mlist Ns ed addresses. .It Ar n .Ql new messages. .It Ar o Old messages (any not in state .Ql read or .Ql new ) . .It Ar r .Ql read messages. .It Ar S \*(OP Messages with unsure spam classification (see .Sx "Handling spam" ) . .It Ar s \*(OP Messages classified as spam. .It Ar t Messages marked as .Ic draft . .It Ar u .Ql unread messages. .El .El .Pp \*(OP IMAP-style SEARCH expressions may also be used. These consist of keywords and criterions, and because .Sx "Message list arguments" are split into tokens according to .Sx "Shell-style argument quoting" it is necessary to quote the entire IMAP search expression in order to ensure that it remains a single token. This addressing mode is available with all types of mailbox .Ic folder Ns s; \*(UA will perform the search locally as necessary. Strings must be enclosed by double quotes .Ql \&" in their entirety if they contain whitespace or parentheses; within the quotes, only reverse solidus .Ql \e is recognized as an escape character. All string searches are case-insensitive. When the description indicates that the .Dq envelope representation of an address field is used, this means that the search string is checked against both a list constructed as .Bd -literal -offset indent \&'(\*qname\*q \*qsource\*q \*qlocal-part\*q \*qdomain-part\*q)' .Ed .Pp for each address, and the addresses without real names from the respective header field. These search expressions can be nested using parentheses, see below for examples. .Pp .Bl -tag -compact -width ".It Ar _n_u" .It Ar ( criterion ) All messages that satisfy the given .Ar criterion . .It Ar ( criterion1 criterion2 ... criterionN ) All messages that satisfy all of the given criteria. .It Ar ( or criterion1 criterion2 ) All messages that satisfy either .Ar criterion1 or .Ar criterion2 , or both. To connect more than two criteria using .Ql or specifications have to be nested using additional parentheses, as with .Ql (or a (or b c)) , since .Ql (or a b c) really means .Ql ((a or b) and c) . For a simple .Ql or operation of independent criteria on the lowest nesting level, it is possible to achieve similar effects by using three separate criteria, as with .Ql (a) (b) (c) . .It Ar ( not criterion ) All messages that do not satisfy .Ar criterion . .It Ar ( bcc \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql Bcc: field. .It Ar ( cc \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql Cc: field. .It Ar ( from \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql From: field. .It Ar ( subject \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the .Ql Subject: field. .It Ar ( to \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the envelope representation of the .Ql To: field. .It Ar ( header name \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in the specified .Ql Name: field. .It Ar ( body \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in their body. .It Ar ( text \*q Ns Ar string Ns Ar \*q ) All messages that contain .Ar string in their header or body. .It Ar ( larger size ) All messages that are larger than .Ar size (in bytes). .It Ar ( smaller size ) All messages that are smaller than .Ar size (in bytes). .It Ar ( before date ) All messages that were received before .Ar date , which must be in the form .Ql d[d]-mon-yyyy , where .Ql d denotes the day of the month as one or two digits, .Ql mon is the name of the month \(en one of .Ql Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec , and .Ql yyyy is the year as four digits, e.g., .Ql 28-Dec-2012 . .It Ar ( on date ) All messages that were received on the specified date. .It Ar ( since date ) All messages that were received since the specified date. .It Ar ( sentbefore date ) All messages that were sent on the specified date. .It Ar ( senton date ) All messages that were sent on the specified date. .It Ar ( sentsince date ) All messages that were sent since the specified date. .It Ar () The same criterion as for the previous search. This specification cannot be used as part of another criterion. If the previous command line contained more than one independent criterion then the last of those criteria is used. .El .Ss "On terminal control and line editor" \*(OP Terminal control will be realized through one of the standard .Ux libraries, either the .Lb libtermcap , or, alternatively, the .Lb libterminfo , both of which will be initialized to work with the environment variable .Ev TERM . Terminal control will enhance or enable interactive usage aspects, e.g., .Sx "Coloured display" , and extend behaviour of the Mailx-Line-Editor (MLE), which may learn the byte-sequences of keys like the cursor- and function-keys. .Pp The internal variable .Va termcap can be used to overwrite settings or to learn (correct(ed)) keycodes. Actual library interaction can be disabled completely by setting .Va termcap-disable ; .Va termcap will be queried regardless, which is true even if the \*(OPal library support has not been enabled at configuration time as long as some other \*(OP which (may) query terminal control sequences has been enabled. \*(UA can be told to enter an alternative exclusive screen, the so-called ca-mode, by setting .Va termcap-ca-mode ; this requires sufficient terminal support, and the used .Ev PAGER may also need special configuration, dependent on the value of .Va crt . .Pp \*(OP The built-in Mailx-Line-Editor (MLE) should work in all environments which comply to the ISO C standard .St -isoC-amd1 , and will support wide glyphs if possible (the necessary functionality had been removed from ISO C, but was included in .St -xpg4 ) . Usage of a line editor in interactive mode can be prevented by setting .Va line-editor-disable . Especially if the \*(OPal terminal control support is missing setting entries in the internal variable .Va termcap will help shall the MLE misbehave, see there for more. The MLE can support a little bit of .Ic colour . .Pp \*(OP If the .Ic history feature is available then input from line editor prompts will be saved in a history list that can be searched in and be expanded from. Such saving can be prevented by prefixing input with any amount of whitespace. Aspects of history, like allowed content and maximum size, as well as whether history shall be saved persistently, can be configured with the internal variables .Va history-file , .Va history-gabby , .Va history-gabby-persist and .Va history-size . There also exists the macro hook .Va on-history-addition which can be used to apply fine control on what enters history. .Pp The MLE supports a set of editing and control commands. By default (as) many (as possible) of these will be assigned to a set of single-letter control codes, which should work on any terminal (and can be generated by holding the .Dq control key while pressing the key of desire, e.g., .Ql control-D ) . If the \*(OPal .Ic bind command is available then the MLE commands can also be accessed freely by assigning the command name, which is shown in parenthesis in the list below, to any desired key-sequence, and the MLE will instead and also use .Ic bind to establish its built-in key bindings (more of them if the \*(OPal terminal control is available), an action which can then be suppressed completely by setting .Va line-editor-no-defaults . .Sx "Shell-style argument quoting" notation is used in the following; combinations not mentioned either cause job control signals or do not generate a (unique) keycode: .Pp .Bl -tag -compact -width ".It Ql \eBa" .It Ql \ecA Go to the start of the line .Mx .Pf ( Cd mle-go-home ) . .It Ql \ecB Move the cursor backward one character .Mx .Pf ( Cd mle-go-bwd ) . .It Ql \ecD Forward delete the character under the cursor; quits \*(UA if used on the empty line unless the internal variable .Va ignoreeof is set .Mx .Pf ( Cd mle-del-fwd ) . .It Ql \ecE Go to the end of the line .Mx .Pf ( Cd mle-go-end ) . .It Ql \ecF Move the cursor forward one character .Mx .Pf ( Cd mle-go-fwd ) . .It Ql \ecG Cancel current operation, full reset. If there is an active history search or tabulator expansion then this command will first reset that, reverting to the former line content; thus a second reset is needed for a full reset in this case .Mx .Pf ( Cd mle-reset ) . .It Ql \ecH Backspace: backward delete one character .Mx .Pf ( Cd mle-del-bwd ) . .It Ql \ecI \*(NQ Horizontal tabulator: try to expand the word before the cursor, supporting the usual .Sx "Filename transformations" .Mx .Pf ( Cd mle-complete ; this is affected by .Cd mle-quote-rndtrip ) . .It Ql \ecJ Newline: commit the current line .Mx .Pf ( Cd mle-commit ) . .It Ql \ecK Cut all characters from the cursor to the end of the line .Mx .Pf ( Cd mle-snarf-end ) . .It Ql \ecL Repaint the line .Mx .Pf ( Cd mle-repaint ) . .It Ql \ecN \*(OP Go to the next history entry .Mx .Pf ( Cd mle-hist-fwd ) . .It Ql \ecO (\*(OPally context-dependent) Invokes the command .Ic dt . .It Ql \ecP \*(OP Go to the previous history entry .Mx .Pf ( Cd mle-hist-bwd ) . .It Ql \ecQ Toggle roundtrip mode shell quotes, where produced, on and off .Mx .Pf ( Cd mle-quote-rndtrip ) . This setting is temporary, and will be forgotten once the command line is committed; also see .Ic shcodec . .It Ql \ecR \*(OP Complete the current line from (the remaining) older history entries .Mx .Pf ( Cd mle-hist-srch-bwd ) . .It Ql \ecS \*(OP Complete the current line from (the remaining) newer history entries .Mx .Pf ( Cd mle-hist-srch-fwd ) . .It Ql \ecT Paste the snarf buffer .Mx .Pf ( Cd mle-paste ) . .It Ql \ecU The same as .Ql \ecA followed by .Ql \ecK .Mx .Pf ( Cd mle-snarf-line ) . .It Ql \ecV Prompts for a Unicode character (hexadecimal number without prefix, see .Ic vexpr ) to be inserted .Mx .Pf ( Cd mle-prompt-char ) . Note this command needs to be assigned to a single-letter control code in order to become recognized and executed during input of a key-sequence (only three single-letter control codes can be used for that shortcut purpose); this control code is then special-treated and thus cannot be part of any other sequence (because it will trigger the .Cd mle-prompt-char function immediately). .It Ql \ecW Cut the characters from the one preceding the cursor to the preceding word boundary .Mx .Pf ( Cd mle-snarf-word-bwd ) . .It Ql \ecX Move the cursor forward one word boundary .Mx .Pf ( Cd mle-go-word-fwd ) . .It Ql \ecY Move the cursor backward one word boundary .Mx .Pf ( Cd mle-go-word-bwd ) . .It Ql \ec[ Escape: reset a possibly used multibyte character input state machine and \*(OPally a lingering, incomplete key binding .Mx .Pf ( Cd mle-cancel ) . This command needs to be assigned to a single-letter control code in order to become recognized and executed during input of a key-sequence (only three single-letter control codes can be used for that shortcut purpose). This control code may also be part of a multi-byte sequence, but if a sequence is active and the very control code is currently also an expected input, then the active sequence takes precedence and will consume the control code. .It Ql \ec\e (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns + . .It Ql \ec] (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns $ . .It Ql \ec^ (\*(OPally context-dependent) Invokes the command .Ql Ic z Ns 0 . .It Ql \ec_ Cut the characters from the one after the cursor to the succeeding word boundary .Mx .Pf ( Cd mle-snarf-word-fwd ) . .It Ql \ec? Backspace: .Cd mle-del-bwd . .It \(en Move the cursor forward one screen width .Mx .Pf ( Cd mle-go-screen-fwd ) . .It \(en Move the cursor backward one screen width .Mx .Pf ( Cd mle-go-screen-bwd ) . .It \(en \*(OP Move the cursor home and clear the screen .Mx .Pf ( Cd mle-clear-screen ) . .It \(en .Mx .Cd mle-fullreset : different to .Cd mle-reset this will immediately reset a possibly active search etc. .It \(en .Mx .Cd mle-bell : ring the audible bell. .El .Ss "Coloured display" \*(OP \*(UA can be configured to support a coloured display and font attributes by emitting ANSI aka ISO 6429 SGR (select graphic rendition) escape sequences. Usage of colours and font attributes solely depends upon the capability of the detected terminal type that is defined by the environment variable .Ev TERM and which can be fine-tuned by the user via the internal variable .Va termcap . .Pp On top of what \*(UA knows about the terminal the boolean variable .Va colour-pager defines whether the actually applicable colour and font attribute sequences should also be generated when output is going to be paged through the external program defined by the environment variable .Ev PAGER (also see .Va crt Ns ). This is not enabled by default because different pager programs need different command line switches or other configuration in order to support those sequences. \*(UA however knows about some widely used pagers and in a clean environment it is often enough to simply set .Va colour-pager ; please refer to that variable for more on this topic. .Pp Colours and font attributes can be managed with the multiplexer command .Ic colour , and .Ic uncolour can be used to remove mappings of a given colour type. If the variable .Va colour-disable is set then any active usage of colour and font attribute sequences is suppressed without affecting possibly established .Ic colour mappings. Since colours are only available in interactive mode, it may make sense to conditionalize the colour setup by encapsulating it with .Ic if : .Bd -literal -offset indent if terminal && [ "$features" =% +colour ] colour iso view-msginfo ft=bold,fg=green colour iso view-header ft=bold,fg=red (from|subject) # regex colour iso view-header fg=red uncolour iso view-header from,subject colour iso view-header ft=bold,fg=magenta,bg=cyan colour 256 view-header ft=bold,fg=208,bg=230 "subject,from" colour mono view-header ft=bold colour mono view-header ft=bold,ft=reverse subject,from endif .Ed .Ss "Handling spam" \*(OP \*(UA can make use of several spam interfaces for the purpose of identification of, and, in general, dealing with spam messages. A precondition of most commands in order to function is that the .Va spam-interface variable is set to one of the supported interfaces. .Sx "Specifying messages" that have been identified as spam is possible via their (volatile) .Ql is-spam state by using the .Ql Ar :s and .Ql Ar :S specifications, and their .Va attrlist entries will be used when displaying the .Va headline in the summary of .Ic headers . .Bl -bullet .It .Ic spamrate rates the given messages and sets their .Ql is-spam flag accordingly. If the spam interface offers spam scores these can be shown in .Va headline by using the format .Ql %$ . .It .Ic spamham , .Ic spamspam and .Ic spamforget will interact with the Bayesian filter of the chosen interface and learn the given messages as .Dq ham or .Dq spam , respectively; the last command can be used to cause .Dq unlearning of messages; it adheres to their current .Ql is-spam state and thus reverts previous teachings. .It .Ic spamclear and .Ic spamset will simply set and clear, respectively, the mentioned volatile .Ql is-spam message flag, without any interface interaction. .El .Pp The .Xr spamassassin 1 based .Va spam-interface .Ql spamc requires a running instance of the .Xr spamd 1 server in order to function, started with the option .Fl -allow-tell shall Bayesian filter learning be possible. .Bd -literal -offset indent $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l] $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \e --daemonize [--local] [--allow-tell] .Ed .Pp Thereafter \*(UA can make use of these interfaces: .Bd -literal -offset indent $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e -Sspamc-command=/usr/local/bin/spamc \e -Sspamc-arguments="-U /tmp/.spamsock" -Sspamc-user= or $ \*(uA -Sspam-interface=spamc -Sspam-maxsize=500000 \e -Sspamc-command=/usr/local/bin/spamc \e -Sspamc-arguments="-d localhost -p 2142" -Sspamc-user= .Ed .Pp Using the generic filter approach allows usage of programs like .Xr bogofilter 1 . Here is an example, requiring it to be accessible via .Ev PATH : .Bd -literal -offset indent $ \*(uA -Sspam-interface=filter -Sspam-maxsize=500000 \e -Sspamfilter-ham="bogofilter -n" \e -Sspamfilter-noham="bogofilter -N" \e -Sspamfilter-nospam="bogofilter -S" \e -Sspamfilter-rate="bogofilter -TTu 2>/dev/null" \e -Sspamfilter-spam="bogofilter -s" \e -Sspamfilter-rate-scanscore="1;^(.+)$" .Ed .Pp Because messages must exist on local storage in order to be scored (or used for Bayesian filter training), it is possibly a good idea to perform the local spam check last. Spam can be checked automatically when opening specific folders by setting a specialized form of the internal variable .Va folder-hook . .Bd -literal -offset indent define spamdelhook { # Server side DCC spamset (header x-dcc-brand-metrics "bulk") # Server-side spamassassin(1) spamset (header x-spam-flag "YES") del :s # TODO we HAVE to be able to do `spamrate :u ! :sS' move :S +maybe-spam spamrate :u del :s move :S +maybe-spam } set folder-hook-SOMEFOLDER=spamdelhook .Ed .Pp See also the documentation for the variables .Va spam-interface , spam-maxsize , .Va spamc-command , spamc-arguments , spamc-user , .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \ spamfilter-rate and .Va spamfilter-rate-scanscore . .Sh COMMANDS \*(UA reads input in lines. An unquoted reverse solidus .Ql \e at the end of a command line .Dq escapes the newline character: it is discarded and the next line of input is used as a follow-up line, with all leading whitespace removed; once an entire line is completed, the whitespace characters .Cm space , tabulator , newline as well as those defined by the variable .Va ifs are removed from the beginning and end. Placing any whitespace characters at the beginning of a line will prevent a possible addition of the command line to the \*(OPal .Ic history . .Pp The beginning of such input lines is then scanned for the name of a known command: command names may be abbreviated, in which case the first command that matches the given prefix will be used. .Sx "Command modifiers" may prefix a command in order to modify its behaviour. A name may also be a .Ic commandalias , which will become expanded until no more expansion is possible. Once the command that shall be executed is known, the remains of the input line will be interpreted according to command-specific rules, documented in the following. .Pp This behaviour is different to the .Xr sh 1 Ns ell, which is a programming language with syntactic elements of clearly defined semantics, and therefore capable to sequentially expand and evaluate individual elements of a line. \*(UA will never be able to handle .Ql \&? set one=value two=$one in a single statement, because the variable assignment is performed by the command .Pf ( Ic set ) , not the language. .Pp The command .Ic list can be used to show the list of all commands, either alphabetically sorted or in prefix search order (these do not match, also because the POSIX standard prescribes a set of abbreviations). \*(OPally the command .Ic help (or .Ic \&? ) , when given an argument, will show a documentation string for the command matching the expanded argument, as in .Ql \&?t , which should be a shorthand of .Ql \&?type ; with these documentation strings both commands support a more .Va verbose listing mode which includes the argument type of the command and other information which applies; a handy suggestion might thus be: .Bd -literal -offset indent ? define __xv { # Before v15: need to enable sh(1)ell-style on _entire_ line! localopts yes;wysh set verbose;ignerr eval "${@}";return ${?} } ? commandalias xv '\ecall __xv' ? xv help set .Ed .Ss "Command modifiers" Commands may be prefixed by one or multiple command modifiers. Some command modifiers can be used with a restricted set of commands only, the .Va verbose version of .Ic list will (\*(OPally) show which modifiers apply. .Bl -bullet .It The modifier reverse solidus .Mx .Cm \e , to be placed first, prevents .Ic commandalias expansions on the remains of the line, e.g., .Ql \eecho will always evaluate the command .Ic echo , even if an (command)alias of the same name exists. .Ic commandalias content may itself contain further command modifiers, including an initial reverse solidus to prevent further expansions. .It The modifier .Mx .Cm ignerr indicates that any error generated by the following command should be ignored by the state machine and not cause a program exit with enabled .Va errexit or for the standardized exit cases in .Va posix mode. .Va \&? , one of the .Sx "INTERNAL VARIABLES" , will be set to the real exit status of the command regardless. .It .Mx .Cm local will alter the called command to apply changes only temporarily, local to block-scope, and can thus only be used inside of a .Ic define Ns d macro or an .Ic account definition. Specifying it implies the modifier .Cm wysh . Block-scope settings will not be inherited by macros deeper in the .Ic call chain, and will be garbage collected once the current block is left. To record and unroll changes in the global scope use the command .Ic localopts . .It .Mx .Cm scope does yet not implement any functionality. .It .Mx .Cm u does yet not implement any functionality. .It Some commands support the .Mx .Cm vput modifier: if used, they expect the name of a variable, which can itself be a variable, i.e., shell expansion is applied, as their first argument, and will place their computation result in it instead of the default location (it is usually written to standard output). .Pp The given name will be tested for being a valid .Xr sh 1 variable name, and may therefore only consist of upper- and lowercase characters, digits, and the underscore; the hyphen-minus may be used as a non-portable extension; digits may not be used as first, hyphen-minus may not be used as last characters. In addition the name may either not be one of the known .Sx "INTERNAL VARIABLES" , or must otherwise refer to a writable (non-boolean) value variable. The actual put operation may fail nonetheless, e.g., if the variable expects a number argument only a number will be accepted. Any error during these operations causes the command as such to fail, and the error number .Va \&! will be set to .Va ^ERR Ns -NOTSUP , the exit status .Va \&? should be set to .Ql -1 , but some commands deviate from the latter, which is documented. .It Last, but not least, the modifier .Mx .Cm wysh can be used for some old and established commands to choose the new .Sx "Shell-style argument quoting" rules over the traditional .Sx "Old-style argument quoting" . This modifier is implied if .Va v15-compat is set to a non-empty value. .El .Ss "Old-style argument quoting" \*(ID This section documents the old, traditional style of quoting non-message-list arguments to commands which expect this type of arguments: whereas still used by the majority of such commands, the new .Sx "Shell-style argument quoting" may be available even for those via .Cm wysh , one of the .Sx "Command modifiers" . Nonetheless care must be taken, because only new commands have been designed with all the capabilities of the new quoting rules in mind, which can, e.g., generate control characters. .Bl -bullet -offset indent .It An argument can be enclosed between paired double-quotes .Ql """argument""" or single-quotes .Ql 'argument' ; any whitespace, shell word expansion, or reverse solidus characters (except as described next) within the quotes are treated literally as part of the argument. A double-quote will be treated literally within single-quotes and vice versa. Inside such a quoted string the actually used quote character can be used nonetheless by escaping it with a reverse solidus .Ql \e , as in .Ql """y\e""ou""" . .It An argument that is not enclosed in quotes, as above, can usually still contain space characters if those spaces are reverse solidus escaped, as in .Ql you\e are . .It A reverse solidus outside of the enclosing quotes is discarded and the following character is treated literally as part of the argument. .El .Ss "Shell-style argument quoting" .Xr sh 1 Ns ell-style, and therefore POSIX standardized, argument parsing and quoting rules are used by most commands. \*(ID Most new commands only support these new rules and are flagged \*(NQ, some elder ones can use them with the command modifier .Cm wysh ; in the future only this type of argument quoting will remain. .Pp A command line is parsed from left to right and an input token is completed whenever an unquoted, otherwise ignored, metacharacter is seen. Metacharacters are vertical bar .Cm \&| , ampersand .Cm & , semicolon .Cm \&; , as well as all characters from the variable .Va ifs , and / or .Cm space , tabulator , newline . The additional metacharacters left and right parenthesis .Cm \&( , \&) and less-than and greater-than signs .Cm < , > that the .Xr sh 1 supports are not used, and are treated as ordinary characters: for one these characters are a vivid part of email addresses, and it seems highly unlikely that their function will become meaningful to \*(UA. .Bd -filled -offset indent .Sy Compatibility note: \*(ID Please note that even many new-style commands do not yet honour .Va ifs to parse their arguments: whereas the .Xr sh 1 Ns ell is a language with syntactic elements of clearly defined semantics, \*(UA parses entire input lines and decides on a per-command base what to do with the rest of the line. This also means that whenever an unknown command is seen all that \*(UA can do is cancellation of the processing of the remains of the line. .Pp It also often depends on an actual subcommand of a multiplexer command how the rest of the line should be treated, and until v15 we are not capable to perform this deep inspection of arguments. Nonetheless, at least the following commands which work with positional parameters fully support .Va ifs for an almost shell-compatible field splitting: .Ic call , call_if , read , vpospar , xcall . .Ed .Pp Any unquoted number sign .Ql # at the beginning of a new token starts a comment that extends to the end of the line, and therefore ends argument processing. An unquoted dollar sign .Ql $ will cause variable expansion of the given name, which must be a valid .Xr sh 1 Ns ell-style variable name (see .Cm vput ) : .Sx "INTERNAL VARIABLES" as well as .Sx ENVIRONMENT (shell) variables can be accessed through this mechanism, brace enclosing the name is supported (i.e., to subdivide a token). .Pp Whereas the metacharacters .Cm space , tabulator , newline only complete an input token, vertical bar .Cm \&| , ampersand .Cm & and semicolon .Cm \&; also act as control operators and perform control functions. For now supported is semicolon .Cm \&; , which terminates a single command, therefore sequencing the command line and making the remainder of the line a subject to reevaluation. With sequencing, multiple command argument types and quoting rules may therefore apply to a single line, which can become problematic before v15: e.g., the first of the following will cause surprising results. .Pp .Dl ? echo one; set verbose; echo verbose=$verbose. .Dl ? echo one; wysh set verbose; echo verbose=$verbose. .Pp Quoting is a mechanism that will remove the special meaning of metacharacters and reserved words, and will prevent expansion. There are four quoting mechanisms: the escape character, single-quotes, double-quotes and dollar-single-quotes: .Bl -bullet -offset indent .It The literal value of any character can be preserved by preceding it with the escape character reverse solidus .Ql \e . .It Arguments which are enclosed in .Ql 'single-\:quotes' retain their literal value. A single-quote cannot occur within single-quotes. .It The literal value of all characters enclosed in .Ql \(dqdouble-\:quotes\(dq is retained, with the exception of dollar sign .Ql $ , which will cause variable expansion, as above, backquote (grave accent) .Ql ` , (which not yet means anything special), reverse solidus .Ql \e , which will escape any of the characters dollar sign .Ql $ (to prevent variable expansion), backquote (grave accent) .Ql ` , double-quote .Ql \(dq (to prevent ending the quote) and reverse solidus .Ql \e (to prevent escaping, i.e., to embed a reverse solidus character as-is), but has no special meaning otherwise. .It Arguments enclosed in .Ql $'dollar-\:single-\:quotes' extend normal single quotes in that reverse solidus escape sequences are expanded as follows: .Pp .Bl -tag -compact -width ".Ql \eNNN" .It Ql \ea bell control character (ASCII and ISO-10646 BEL). .It Ql \eb backspace control character (ASCII and ISO-10646 BS). .It Ql \eE escape control character (ASCII and ISO-10646 ESC). .It Ql \ee the same. .It Ql \ef form feed control character (ASCII and ISO-10646 FF). .It Ql \en line feed control character (ASCII and ISO-10646 LF). .It Ql \er carriage return control character (ASCII and ISO-10646 CR). .It Ql \et horizontal tabulator control character (ASCII and ISO-10646 HT). .It Ql \ev vertical tabulator control character (ASCII and ISO-10646 VT). .It Ql \e\e emits a reverse solidus character. .It Ql \e' single quote. .It Ql \e" double quote (escaping is optional). .It Ql \eNNN eight-bit byte with the octal value .Ql NNN (one to three octal digits), optionally prefixed by an additional .Ql 0 . A 0 byte will suppress further output for the quoted argument. .It Ql \exHH eight-bit byte with the hexadecimal value .Ql HH (one or two hexadecimal characters, no prefix, see .Ic vexpr ) . A 0 byte will suppress further output for the quoted argument. .It Ql \eUHHHHHHHH the Unicode / ISO-10646 character with the hexadecimal codepoint value .Ql HHHHHHHH (one to eight hexadecimal characters) \(em note that Unicode defines the maximum codepoint ever to be supported as .Ql 0x10FFFF (in planes of .Ql 0xFFFF characters each). This escape is only supported in locales that support Unicode (see .Sx "Character sets" ) , in other cases the sequence will remain unexpanded unless the given code point is ASCII compatible or (if the \*(OPal character set conversion is available) can be represented in the current locale. The character NUL will suppress further output for the quoted argument. .It Ql \euHHHH Identical to .Ql \eUHHHHHHHH except it takes only one to four hexadecimal characters. .It Ql \ecX Emits the non-printable (ASCII and compatible) C0 control codes 0 (NUL) to 31 (US), and 127 (DEL). Printable representations of ASCII control codes can be created by mapping them to a different, visible part of the ASCII character set. Adding the number 64 achieves this for the codes 0 to 31, e.g., 7 (BEL): .Ql 7 + 64 = 71 = G . The real operation is a bitwise logical XOR with 64 (bit 7 set, see .Ic vexpr ) , thus also covering code 127 (DEL), which is mapped to 63 (question mark): .Ql \&?\0vexpr\0^\0127\064 . .Pp Whereas historically circumflex notation has often been used for visualization purposes of control codes, e.g., .Ql ^G , the reverse solidus notation has been standardized: .Ql \ecG . Some control codes also have standardized (ISO-10646, ISO C) aliases, as shown above (e.g., .Ql \ea , .Ql \en , .Ql \et ) : whenever such an alias exists it will be used for display purposes. The control code NUL .Pf ( Ql \ec@ , a non-standard extension) will suppress further output for the remains of the token (which may extend beyond the current quote), or, depending on the context, the remains of all arguments for the current command. .It Ql \e$NAME Non-standard extension: expand the given variable name, as above. Brace enclosing the name is supported. .It Ql \e`{command} Not yet supported, just to raise awareness: Non-standard extension. .El .El .Pp Caveats: .Bd -literal -offset indent ? echo 'Quotes '${HOME}' and 'tokens" differ!"# no comment ? echo Quotes ${HOME} and tokens differ! # comment ? echo Don"'"t you worry$'\ex21' The sun shines on us. $'\eu263A' .Ed .Ss "Message list arguments" Many commands operate on message list specifications, as documented in .Sx "Specifying messages" . The argument input is first split into individual tokens via .Sx "Shell-style argument quoting" , which are then interpreted as the mentioned specifications. If no explicit message list has been specified, many commands will search for and use the next message forward that satisfies the commands' requirements, and if there are no messages forward of the current message, the search proceeds backwards; if there are no good messages at all to be found, an error message is shown and the command is aborted. The .Va verbose output of the command .Ic list will indicate whether a command searches for a default message, or not. .Ss "Raw data arguments for codec commands" A special set of commands, which all have the string .Dq codec in their name, e.g., .Ic addrcodec , .Ic shcodec , .Ic urlcodec , take raw string data as input, which means that the content of the command input line is passed completely unexpanded and otherwise unchanged: like this the effect of the actual codec is visible without any noise of possible shell quoting rules etc., i.e., the user can input one-to-one the desired or questionable data. To gain a level of expansion, the entire command line can be .Ic eval Ns uated first, e.g., .Bd -literal -offset indent ? vput shcodec res encode /usr/Sch\[:o]nes Wetter/heute.txt ? echo $res $'/usr/Sch\eu00F6nes Wetter/heute.txt' ? shcodec d $res $'/usr/Sch\eu00F6nes Wetter/heute.txt' ? eval shcodec d $res /usr/Sch\[:o]nes Wetter/heute.txt .Ed .Ss "Filename transformations" Filenames, where expected, and unless documented otherwise, are subsequently subject to the following filename transformations, in sequence: .Bl -bullet -offset indent .It If the given name is a registered .Ic shortcut , it will be replaced with the expanded shortcut. .It The filename is matched against the following patterns or strings: .Pp .Bl -hang -compact -width ".Ar %user" .It Ar # (Number sign) is expanded to the previous file. .It Ar % (Percent sign) is replaced by the invoking .Mx -ix "primary system mailbox" user's primary system mailbox, which either is the (itself expandable) .Va inbox if that is set, the standardized absolute pathname indicated by .Ev MAIL if that is set, or a built-in compile-time default otherwise. .It Ar %user Expands to the primary system mailbox of .Ar user (and never the value of .Va inbox , regardless of its actual setting). .It Ar & (Ampersand) is replaced with the invoking user's .Mx -ix "secondary mailbox" secondary mailbox, the .Ev MBOX . .It Ar +file Refers to a .Ar file in the .Va folder directory (if that variable is set). .It Ar %:filespec Expands to the same value as .Ar filespec , but has special meaning when used with, e.g., the command .Ic file : the file will be treated as a primary system mailbox by, e.g., the .Ic mbox and .Ic save commands, meaning that messages that have been read in the current session will be moved to the .Ev MBOX mailbox instead of simply being flagged as read. .El .It Meta expansions may be applied to the resulting filename, as allowed by the operation and applicable to the resulting access protocol (also see .Sx "On URL syntax and credential lookup" ) . For the file-protocol, a leading tilde .Ql ~ character will be replaced by the expansion of .Ev HOME , except when followed by a valid user name, in which case the home directory of the given user is used instead. .Pp A shell expansion as if specified in double-quotes (see .Sx "Shell-style argument quoting" ) may be applied, so that any occurrence of .Ql $VARIABLE (or .Ql ${VARIABLE} ) will be replaced by the expansion of the variable, if possible; .Sx "INTERNAL VARIABLES" as well as .Sx ENVIRONMENT (shell) variables can be accessed through this mechanism. .Pp Shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) may be applied as documented. If the fully expanded filename results in multiple pathnames and the command is expecting only one file, an error results. .Pp In interactive context, in order to allow simple value acceptance (via .Dq ENTER ) , arguments will usually be displayed in a properly quoted form, e.g., a file .Ql diet\e is \ecurd.txt may be displayed as .Ql 'diet\e is \ecurd.txt' . .El .Ss "Commands" The following commands are available: .Bl -tag -width ".It Ic BaNg" .Mx .It Ic \&! Executes the .Ev SHELL command which follows, replacing unescaped exclamation marks with the previously executed command if the internal variable .Va bang is set. This command supports .Cm vput as documented in .Sx "Command modifiers" , and manages the error number .Va \&! . A 0 or positive exit status .Va \&? reflects the exit status of the command, negative ones that an error happened before the command was executed, or that the program did not exit cleanly, but, e.g., due to a signal: the error number is .Va ^ERR Ns -CHILD , then. .Pp In conjunction with the .Cm vput modifier the following special cases exist: a negative exit status occurs if the collected data could not be stored in the given variable, which is a .Va ^ERR Ns -NOTSUP error that should otherwise not occur. .Va ^ERR Ns -CANCELED indicates that no temporary file could be created to collect the command output at first glance. In case of catchable out-of-memory situations .Va ^ERR Ns -NOMEM will occur and \*(UA will try to store the empty string, just like with all other detected error conditions. .Mx .It Ic # The comment-command causes the entire line to be ignored. .Sy Note: this really is a normal command which' purpose is to discard its arguments, not a .Dq comment-start indicating special character, which means that, e.g., trailing comments on a line are not possible (except for commands which use .Sx "Shell-style argument quoting" ) . .Mx .It Ic + Goes to the next message in sequence and types it (like .Dq ENTER ) . .Mx .It Ic - Display the preceding message, or the n'th previous message if given a numeric argument n. .Mx .It Ic = Shows the message number of the current message (the .Dq dot ) when used without arguments, that of the given list otherwise. Output numbers will be separated from each other with the first character of .Va ifs , and followed by the first character of .Va if-ws , if that is not empty and not identical to the first. If that results in no separation at all a .Cm space character is used. This command supports .Cm vput (see .Sx "Command modifiers" ) , and manages the error number .Va \&! . .Mx .It Ic \&? \*(OP Show a brief summary of commands. \*(OP Given an argument a synopsis for the command in question is shown instead; commands can be abbreviated in general and this command can be used to see the full expansion of an abbreviation including the synopsis, try, e.g., .Ql \&?h , .Ql \&?hel and .Ql \&?help and see how the output changes. This mode also supports a more .Va verbose output, which will provide the information documented for .Ic list . .Mx .It Ic \&| A synonym for the .Ic pipe command. .Mx .Mx .It Ic account , unaccount (ac, una) Creates, selects or lists (an) account(s). Accounts are special incarnations of .Ic define Ns d macros and group commands and variable settings which together usually arrange the environment for the purpose of creating an email account. Different to normal macros settings which are covered by .Ic localopts \(en here by default enabled! \(en will not be reverted before the .Ic account is changed again. The special account .Ql null (case-insensitive) always exists, and all but it can be deleted by the latter command, and in one operation with the special name .Ql * . Also for all but it a possibly set .Va on-account-cleanup hook is called once they are left. .Pp Without arguments a listing of all defined accounts is shown. With one argument the given account is activated: the system .Va inbox of that account will be activated (as via .Ic file ) , a possibly installed .Va folder-hook will be run, and the internal variable .Va account will be updated. The two argument form is identical to defining a macro as via .Ic define : .Bd -literal -offset indent account myisp { set folder=~/mail inbox=+syste.mbox record=+sent.mbox set from='(My Name) myname@myisp.example' set mta=smtp://mylogin@smtp.myisp.example } .Ed .Mx .It Ic addrcodec Perform email address codec transformations on raw-data argument, rather according to email standards (RFC 5322; \*(ID will furtherly improve). Supports .Cm vput (see .Sx "Command modifiers" ) , and manages the error number .Va \&! . The first argument must be either .Ar [+[+[+]]]e[ncode] , .Ar d[ecode] , .Ar s[kin] or .Ar skinl[ist] and specifies the operation to perform on the rest of the line. .Pp Decoding will show how a standard-compliant MUA will display the given argument, which should be an email address. Please be aware that most MUAs have difficulties with the address standards, and vary wildly when (comments) in parenthesis, .Dq double-quoted strings, or quoted-pairs, as below, become involved. \*(ID \*(UA currently does not perform decoding when displaying addresses. .Pp Skinning is identical to decoding but only outputs the plain address, without any string, comment etc. components. Another difference is that it may fail with the error number .Va \&! set to .Va ^ERR Ns -INVAL if decoding fails to find a(n) (valid) email address, in which case the unmodified input will be output again. .Pp .Ar skinlist first performs a skin operation, and thereafter checks a valid address for whether it is a registered mailing list (see .Ic mlist and .Ic mlsubscribe ) , eventually reporting that state in the error number .Va \&! as .Va ^ERR Ns -EXIST . (This state could later become overwritten by an I/O error, though.) .Pp Encoding supports four different modes, lesser automated versions can be chosen by prefixing one, two or three plus signs: the standard imposes a special meaning on some characters, which thus have to be transformed to so-called quoted-pairs by pairing them with a reverse solidus .Ql \e in order to remove the special meaning; this might change interpretation of the entire argument from what has been desired, however! Specify one plus sign to remark that parenthesis shall be left alone, two for not turning double quotation marks into quoted-pairs, and three for also leaving any user-specified reverse solidus alone. The result will always be valid, if a successful exit status is reported (\*(ID the current parser fails this assertion for some constructs). \*(ID Addresses need to be specified in between angle brackets .Ql < , .Ql > if the construct becomes more difficult, otherwise the current parser will fail; it is not smart enough to guess right. .Bd -literal -offset indent ? addrc enc "Hey, you",\e out\e there "\e"Hey, you\e", \e\e out\e\e there" ? addrc d "\e"Hey, you\e", \e\e out\e\e there" "Hey, you", \e out\e there ? addrc s "\e"Hey, you\e", \e\e out\e\e there" diet@exam.ple .Ed .Mx .Mx .It Ic alias , unalias \*(NQ (a, una) Define or list, and remove, respectively, address aliases. Address aliases are a method of creating personal distribution lists that map a single alias name to none to multiple receivers; aliases are expanded after message composing is completed. The latter command removes all given aliases, the special name asterisk .Ql * will remove all existing aliases. When used without arguments the former shows a list of all currently known aliases, with one argument only the target(s) of the given one. When given two arguments, hyphen-minus .Ql - being the first, the target(s) of the second is/are expanded recursively. .Pp In all other cases the given address alias is newly defined or will be appended to: target arguments must either be valid alias names, or any other address type. Recursive expansion of (what looks like) alias name(s) targets can be prevented by prefixing the target with the modifier reverse solidus .Cm \e . A valid alias name conforms to the Postfix MTA .Xr aliases 5 rules, and may consist of alphabetic characters, digits, the underscore, the number sign, colon, commercial at and hyphen-minus; extensions: exclamation mark .Ql \&! , period .Ql \&. as well as .Dq any character that has the high bit set may be used: .Ql [[:alnum:]_#:@!.-]+ . The number sign may need be quoted to avoid misinterpretation as the shell comment character. .Pp \*(ID Unfortunately the colon is currently not supported, as it interferes with normal address parsing rules. \*(ID Such high bit characters will likely cause warnings at the moment for the same reasons why colon is unsupported; also, in the future locale dependent character set validity checks will be performed. .Mx .Mx .It Ic alternates , unalternates \*(NQ (alt) Manage a list of alternate addresses or names of the active user, members of which will be removed from recipient lists (except one). There is a set of implicit alternates which is formed of the values of .Ev LOGNAME , .Va from , .Va sender and .Va reply-to . .Va from will not be used if .Va sender is set. The latter command removes the given list of alternates, the special name .Ql * will discard all existing alternate names. .Pp The former command manages the error number .Va \&! . It shows the current set of alternates when used without arguments; in this mode only it also supports .Cm vput (see .Sx "Command modifiers" ) . Otherwise the given arguments (after being checked for validity) are appended to the list of alternate names; in .Va posix mode they replace that list instead. .Mx .Mx .It Ic answered , unanswered Take a message lists and mark each message as (not) having been answered. Messages will be marked answered when being .Ic reply Ns d to automatically if the .Va markanswered variable is set. See the section .Sx "Message states" . .Mx .Mx .It Ic bind , unbind \*(OP\*(NQ The bind command extends the MLE (see .Sx "On terminal control and line editor" ) with freely configurable key bindings. The latter command removes from the given context the given key binding, both of which may be specified as a wildcard .Ql * , so that, e.g., .Ql unbind * * will remove all bindings of all contexts. Due to initialization order unbinding will not work for built-in key bindings upon program startup, however: please use .Va line-editor-no-defaults for this purpose instead. .Pp With zero arguments, or with a context name the former command shows all key bindings (of the given context; an asterisk .Ql * will iterate over all contexts); a more verbose listing will be produced if either of .Va debug or .Va verbose are set. With two or more arguments a binding is (re)established: the first argument is the context to which the binding shall apply, the second argument is a comma-separated list of the .Dq keys which form the binding, and any remaining arguments form the expansion. To indicate that a binding shall not be auto-committed, but that the expansion shall instead be furtherly editable by the user, a commercial at .Ql @ (that will be removed) can be placed last in the expansion, from which leading and trailing whitespace will finally be removed. Reverse solidus cannot be used as the last character of expansion. An empty expansion will be rejected. .Pp Contexts define when a binding applies, i.e., a binding will not be seen unless the context for which it is defined for is currently active. This is not true for the shared binding .Ql base , which is the foundation for all other bindings and as such always applies, its bindings, however, only apply secondarily. The available contexts are the shared .Ql base , the .Ql default context which is used in all not otherwise documented situations, and .Ql compose , which applies to compose mode only. .Pp .Dq Keys which form the binding are specified as a comma-separated list of byte-sequences, where each list entry corresponds to one key(press). A list entry may, indicated by a leading colon character .Ql \&: , also refer to the name of a terminal capability; several dozen names will be compiled in and may be specified either by their .Xr terminfo 5 , or, if existing, by their .Xr termcap 5 name, regardless of the actually used \*(OPal terminal control library. It is possible to use any capability, as long as the name is resolvable by the \*(OPal control library or was defined via the internal variable .Va termcap . Input sequences are not case-normalized, so that an exact match is required to update or remove a binding. Examples: .Bd -literal -offset indent ? bind base $'\eE',d mle-snarf-word-fwd # Esc(ape) ? bind base $'\eE',$'\ec?' mle-snarf-word-bwd # Esc,Delete ? bind default $'\ecA',:khome,w 'echo Editable binding@' ? bind default a,b,c rm -irf / @ # Also editable ? bind default :kf1 File % ? bind compose :kf1 ~v .Ed .Pp Note that the entire comma-separated list is first parsed (over) as a shell-token with whitespace as the field separator, before being parsed and expanded for real with comma as the field separator, therefore whitespace needs to be properly quoted, see .Sx "Shell-style argument quoting" . Using Unicode reverse solidus escape sequences renders a binding defunctional if the locale does not support Unicode (see .Sx "Character sets" ) , and using terminal capabilities does so if no (corresponding) terminal control support is (currently) available. .Pp The following terminal capability names are built-in and can be used in .Xr terminfo 5 or (if available) the two-letter .Xr termcap 5 notation. See the respective manual for a list of capabilities. The program .Xr infocmp 1 can be used to show all the capabilities of .Ev TERM or the given terminal type; using the .Fl \&\&x flag will also show supported (non-standard) extensions. .Pp .Bl -tag -compact -width kcuuf_or_kcuuf .It Cd kbs Ns \0or Cd kb Backspace. .It Cd kdch1 Ns \0or Cd kD Delete character. .It Cd kDC Ns \0or Cd *4 \(em shifted variant. .It Cd kel Ns \0or Cd kE Clear to end of line. .It Cd kext Ns \0or Cd @9 Exit. .It Cd kich1 Ns \0or Cd kI Insert character. .It Cd kIC Ns \0or Cd #3 \(em shifted variant. .It Cd khome Ns \0or Cd kh Home. .It Cd kHOM Ns \0or Cd #2 \(em shifted variant. .It Cd kend Ns \0or Cd @7 End. .It Cd knp Ns \0or Cd kN Next page. .It Cd kpp Ns \0or Cd kP Previous page. .It Cd kcub1 Ns \0or Cd kl Left cursor (with more modifiers: see below). .It Cd kLFT Ns \0or Cd #4 \(em shifted variant. .It Cd kcuf1 Ns \0or Cd kr Right cursor (ditto). .It Cd kRIT Ns \0or Cd %i \(em shifted variant. .It Cd kcud1 Ns \0or Cd kd Down cursor (ditto). .It Cd kDN \(em shifted variant (only terminfo). .It Cd kcuu1 Ns \0or Cd ku Up cursor (ditto). .It Cd kUP \(em shifted variant (only terminfo). .It Cd kf0 Ns \0or Cd k0 Function key 0. Add one for each function key up to .Cd kf9 and .Cd k9 , respectively. .It Cd kf10 Ns \0or Cd k; Function key 10. .It Cd kf11 Ns \0or Cd F1 Function key 11. Add one for each function key up to .Cd kf19 and .Cd F9 , respectively. .El .Pp Some terminals support key-modifier combination extensions, e.g., .Ql Alt+Shift+xy . For example, the delete key, .Cd kdch1 : in its shifted variant, the name is mutated to .Cd kDC , then a number is appended for the states .Ql Alt .Pf ( Cd kDC3 ) , .Ql Shift+Alt .Pf ( Cd kDC4 ) , .Ql Control .Pf ( Cd kDC5 ) , .Ql Shift+Control .Pf ( Cd kDC6 ) , .Ql Alt+Control .Pf ( Cd kDC7 ) , finally .Ql Shift+Alt+Control .Pf ( Cd kDC8 ) . The same for the left cursor key, .Cd kcub1 : .Cd KLFT , KLFT3 , KLFT4 , KLFT5 , KLFT6 , KLFT7 , KLFT8 . .Pp It is advisable to use an initial escape or other control character (e.g., .Ql \ecA ) for bindings which describe user key combinations (as opposed to purely terminal capability based ones), in order to avoid ambiguities whether input belongs to key sequences or not; it also reduces search time. Adjusting .Va bind-timeout may help shall keys and sequences be falsely recognized. .Mx .It Ic call \*(NQ Calls the given macro, which must have been created via .Ic define (see there for more), otherwise an .Va ^ERR Ns -NOENT error occurs. Calling macros recursively will at some time excess the stack size limit, causing a hard program abortion; if recursively calling a macro is the last command of the current macro, consider to use the command .Ic xcall , which will first release all resources of the current macro before replacing the current macro with the called one. .Mx .It Ic call_if Identical to .Ic call if the given macro has been created via .Ic define , but does not fail nor warn if the macro does not exist. .Mx .It Ic cd (ch) Change the working directory to .Ev HOME or the given argument. Synonym for .Ic chdir . .Mx .It Ic certsave \*(OP Only applicable to S/MIME signed messages. Takes an optional message list and a filename and saves the certificates contained within the message signatures to the named file in both human-readable and PEM format. The certificates can later be used to send encrypted messages to the respective message senders by setting .Va smime-encrypt-USER@HOST variables. .Mx .Mx .It Ic charsetalias , uncharsetalias \*(NQ Manage alias mappings for (conversion of) .Sx "Character sets" . Alias processing is not performed for .Sx "INTERNAL VARIABLES" , e.g., .Va charset-8bit , and mappings are ineffective if character set conversion is not available .Pf ( Va features does not announce .Ql +iconv ) . Expansion happens recursively for cases where aliases point to other aliases (builtin loop limit: 8). .Pp The latter command deletes all aliases given as arguments, or all at once when given the asterisk .Ql * . The former shows the list of all currently defined aliases if used without arguments, or the target of the given single argument; when given two arguments, hyphen-minus .Ql - being the first, the second is instead expanded recursively. In all other cases the given arguments are treated as pairs of character sets and their desired target alias name, creating new or updating already existing aliases. .Mx .It Ic chdir (ch) Change the working directory to .Ev HOME or the given argument. Synonym for .Ic cd . .Mx .Mx .It Ic collapse , uncollapse Only applicable to .Ql thread Ns ed .Ic sort mode. Takes a message list and makes all replies to these messages invisible in header summaries, except for .Ql new messages and the .Dq dot . Also when a message with collapsed replies is displayed, all of these are automatically uncollapsed. The latter command undoes collapsing. .Mx .Mx .It Ic colour , uncolour \*(OP\*(NQ Manage colour mappings of and for a .Sx "Coloured display" . The type of colour is given as the (case-insensitive) first argument, which must be one of .Ql 256 for 256-colour terminals, .Ql 8 , .Ql ansi or .Ql iso for the standard 8-colour ANSI / ISO 6429 colour palette and .Ql 1 or .Ql mono for monochrome terminals. Monochrome terminals cannot deal with colours, but only (some) font attributes. .Pp Without further arguments the list of all currently defined mappings for the given colour type is shown (as a special case giving .Ql all or .Ql * will show the mappings of all types). Otherwise the second argument defines the mappable slot, and the third argument a (comma-separated list of) colour and font attribute specification(s), and the optional fourth argument can be used to specify a precondition: if conditioned mappings exist they are tested in (creation) order unless a (case-insensitive) match has been found, and the default mapping (if any has been established) will only be chosen as a last resort. The types of precondition available depend on the mappable slot (see .Sx "Coloured display" for some examples), the following of which exist: .Pp Mappings prefixed with .Ql mle- are used for the \*(OPal built-in Mailx-Line-Editor (MLE, see .Sx "On terminal control and line editor" ) and do not support preconditions. .Pp .Bl -tag -compact -width view-partinfo .It Ar mle-position This mapping is used for the position indicator that is visible when a line cannot be fully displayed on the screen. .It Ar mle-prompt Used for the .Va prompt . .El .Pp Mappings prefixed with .Ql sum- are used in header summaries, and they all understand the preconditions .Ql dot (the current message) and .Ql older for elder messages (only honoured in conjunction with .Va datefield-markout-older ) . .Pp .Bl -tag -compact -width view-partinfo .It Ar sum-dotmark This mapping is used for the .Dq dotmark that can be created with the .Ql %> or .Ql %< formats of the variable .Va headline . .It Ar sum-header For the complete header summary line except the .Dq dotmark and the thread structure. .It Ar sum-thread For the thread structure which can be created with the .Ql %i format of the variable .Va headline . .El .Pp Mappings prefixed with .Ql view- are used when displaying messages. .Pp .Bl -tag -compact -width view-partinfo .It Ar view-from_ This mapping is used for so-called .Ql From_ lines, which are MBOX file format specific header lines (also see .Va mbox-rfc4155 ) . .It Ar view-header For header lines. A comma-separated list of headers to which the mapping applies may be given as a precondition; if the \*(OPal regular expression support is available then if any of the .Mx -sx .Sx "magic regular expression characters" is seen the precondition will be evaluated as (an extended) one. .It Ar view-msginfo For the introductional message info line. .It Ar view-partinfo For MIME part info lines. .El .Pp The following (case-insensitive) colour definitions and font attributes are understood, multiple of which can be specified in a comma-separated list: .Bl -tag -width ft= .It Ar ft= a font attribute: .Ql bold , .Ql reverse or .Ql underline . It is possible (and often applicable) to specify multiple font attributes for a single mapping. .It Ar fg= foreground colour attribute: .Ql black , .Ql blue , .Ql green , .Ql red , .Ql brown , .Ql magenta , .Ql cyan or .Ql white . To specify a 256-colour mode a decimal number colour specification in the range 0 to 255, inclusive, is supported, and interpreted as follows: .Pp .Bl -tag -compact -width "999 - 999" .It 0 - 7 the standard ISO 6429 colours, as above. .It 8 - 15 high intensity variants of the standard colours. .It 16 - 231 216 colours in tuples of 6. .It 232 - 255 grayscale from black to white in 24 steps. .El .Bd -literal -offset indent #!/bin/sh - fg() { printf "\e033[38;5;${1}m($1)"; } bg() { printf "\e033[48;5;${1}m($1)"; } i=0 while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done printf "\e033[0m\en" i=0 while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done printf "\e033[0m\en" .Ed .It Ar bg= background colour attribute (see .Cd fg= for possible values). .El .Pp The command .Ic \&uncolour will remove for the given colour type (the special type .Ql * selects all) the given mapping; if the optional precondition argument is given only the exact tuple of mapping and precondition is removed. The special name .Ql * will remove all mappings (no precondition allowed), thus .Ql uncolour * * will remove all established mappings. .Mx .Mx .It Ic commandalias , uncommandalias \*(NQ Define or list, and remove, respectively, command aliases. An (command)alias can be used everywhere a normal command can be used, but always takes precedence: any arguments that are given to the command alias are joined onto the alias expansion, and the resulting string forms the command line that is, in effect, executed. The latter command removes all given aliases, the special name asterisk .Ql * will remove all existing aliases. When used without arguments the former shows a list of all currently known aliases, with one argument only the expansion of the given one. .Pp With two or more arguments a command alias is defined or updated: the first argument is the name under which the remaining command line should be accessible, the content of which can be just about anything. An alias may itself expand to another alias, but to avoid expansion loops further expansion will be prevented if an alias refers to itself or if an expansion depth limit is reached. Explicit expansion prevention is available via reverse solidus .Cm \e , one of the .Sx "Command modifiers" . .Bd -literal -offset indent ? commandalias xx \*(uA: `commandalias': no such alias: xx ? commandalias xx echo hello, ? commandalias xx commandalias xx 'echo hello,' ? xx hello, ? xx world hello, world .Ed .Mx .It Ic Copy (C) Copy messages to files whose names are derived from the author of the respective message and do not mark them as being saved; otherwise identical to .Ic Save . .Mx .It Ic copy (c) Copy messages to the named file and do not mark them as being saved; otherwise identical to .Ic save . .Mx .It Ic csop \*(NQ A multiplexer command which provides C-style string operations on 8-bit bytes without a notion of locale settings and character sets, effectively assuming ASCII data. For numeric and other operations refer to .Ic vexpr . .Cm vput , one of the .Sx "Command modifiers" , is supported. The error result is .Ql -1 for usage errors and numeric results, the empty string otherwise; missing data errors, as for unsuccessful searches, result in the .Va \&! error number being set to .Va ^ERR Ns -NODATA . Where the question mark .Ql \&? modifier suffix is supported, a case-insensitive (ASCII mapping) operation mode is supported; the keyword .Ql case is optional, e.g., .Ql find? and .Ql find?case are identical. .Bl -hang -width ".It Cm length" .It Cm length Queries the length of the given argument. .It Cm hash , Cm hash32 Calculates a hash value of the given argument. The latter will return a 32-bit result regardless of host environment. .Ql \&? modifier suffix is supported. These use Chris Torek's hash algorithm, the resulting hash value is bit mixed as shown by Bret Mulvey. .It Cm find Search for the second in the first argument. Shows the resulting 0-based offset shall it have been found. .Ql \&? modifier suffix is supported. .It Cm substring Creates a substring of its first argument. The optional second argument is the 0-based starting offset, a negative one counts from the end; the optional third argument specifies the length of the desired result, a negative length leaves off the given number of bytes at the end of the original string; by default the entire string is used. This operation tries to work around faulty arguments (set .Va verbose for error logs), but reports them via the error number .Va \&! as .Va ^ERR Ns -OVERFLOW . .It Cm trim Trim away whitespace characters from both ends of the argument. .It Cm trim-front Trim away whitespace characters from the begin of the argument. .It Cm trim-end Trim away whitespace characters from the end of the argument. .El .Mx .It Ic cwd Show the name of the current working directory, as reported by .Xr getcwd 3 . Supports .Cm vput (see .Sx "Command modifiers" ) . The return status is tracked via .Va \&? . .Mx .It Ic Decrypt \*(OP For unencrypted messages this command is identical to .Ic Copy ; Encrypted messages are first decrypted, if possible, and then copied. .Mx .It Ic decrypt \*(OP For unencrypted messages this command is identical to .Ic copy ; Encrypted messages are first decrypted, if possible, and then copied. .Mx .Mx .It Ic define , undefine The latter command deletes the given macro, the special name .Ql * will discard all existing macros. Deletion of (a) macro(s) can be performed from within running (a) macro(s), including self-deletion. Without arguments the former command prints the current list of macros, including their content, otherwise it defines a macro, replacing an existing one of the same name as applicable. .Pp A defined macro can be invoked explicitly by using the .Ic call , .Ic call_if and .Ic xcall commands, or implicitly if a macro hook is triggered, e.g., a .Va folder-hook . Execution of a macro body can be stopped from within by calling .Ic return . .Pp Temporary macro block-scope variables can be created or deleted with the .Cm local command modifier in conjunction with the commands .Ic set and .Ic unset , respectively. To enforce unrolling of changes made to (global) .Sx "INTERNAL VARIABLES" the command .Ic localopts can be used instead; its covered scope depends on how (i.e., .Dq as what : normal macro, folder hook, hook, .Ic account switch) the macro is invoked. .Pp Inside a .Ic call Ns ed macro, the given positional parameters are implicitly local to the macro's scope, and may be accessed via the variables .Va * , .Va @ , .Va # and .Va 1 and any other positive unsigned decimal number less than or equal to .Va # . Positional parameters can be .Ic shift Ns ed, or become completely replaced, removed etc. via .Ic vpospar . A helpful command for numeric computation and string evaluations is .Ic vexpr , .Ic csop offers C-style byte string operations. .Bd -literal -offset indent define name { command1 command2 ... commandN } # E.g. define exmac { echo Parameter 1 of ${#} is ${1}, all: ${*} / ${@} return 1000 0 } call exmac Hello macro exmac! echo ${?}/${!}/${^ERRNAME} .Ed .Mx .Mx .It Ic delete , undelete (d, u) Marks the given message list as being or not being .Ql deleted , respectively; if no argument has been specified then the usual search for a visible message is performed, as documented for .Sx "Message list arguments" , showing only the next input prompt if the search fails. Deleted messages will neither be saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX nor will they be available for most other commands. If the .Va autoprint variable is set, the new .Dq dot or the last message restored, respectively, is automatically .Ic type Ns d; also see .Ic dp , .Ic dt . .Mx .It Ic digmsg \*(NQ Digging (information out of) messages is possible through .Ic \&\&digmsg objects, which can be .Cm create Ns d for the given message number; in compose mode the hyphen-minus .Ql - will instead open the message that is being composed. If a hyphen-minus is given as the optional third argument then output will be generated on the standard output channel instead of being subject to consumation by the .Ic read or .Ic readall commands. .Pp The objects may be .Cm remove Ns d again by giving the same identifier used for creation; this step could be omitted: objects will be automatically closed when the active mailbox or the compose mode is left, respectively. In all other use cases the second argument is an object identifier, and the third and all following arguments are interpreted as via .Ic ~^ (see .Sx "COMMAND ESCAPES" ) : .Bd -literal -offset indent ? vput = msgno; digmsg create $msgno ? digmsg $msgno header list; readall x; echon $x 210 Subject From To Message-ID References In-Reply-To Status ? digmsg $msgno header show Status;readall x;echon $x 212 Status RO ? digmsg remove $msgno .Ed .Mx .It Ic discard (di) Identical to .Ic ignore . Superseded by the multiplexer .Ic headerpick . .Mx .Mx .It Ic dp , dt Delete the given messages and automatically .Ic type the new .Dq dot if one exists, regardless of the setting of .Va autoprint . .Mx .It Ic dotmove Move the .Dq dot up or down by one message when given .Ql + or .Ql - argument, respectively. .Mx .Mx .It Ic draft , undraft Take message lists and mark each given message as being draft, or not being draft, respectively, as documented in the section .Sx "Message states" . .Mx .It Ic echo \*(NQ (ec) Echoes arguments to standard output and writes a trailing newline, whereas the otherwise identical .Ic echon does not. .Sx "Shell-style argument quoting" is used, .Sx "Filename transformations" are applied to the expanded arguments. This command also supports .Cm vput as documented in .Sx "Command modifiers" , and manages the error number .Va \&! : if data is stored in a variable then the return value reflects the length of the result string in case of success and is .Ql -1 on error. .Mx .It Ic echoerr \*(NQ Identical to .Ic echo except that is echoes to standard error. Also see .Ic echoerrn . In interactive sessions the \*(OPal message ring queue for .Ic errors will be used instead, if available and .Cm vput was not used. .Mx .It Ic echon \*(NQ Identical to .Ic echo , but does not write or store a trailing newline. .Mx .It Ic echoerrn \*(NQ Identical to .Ic echoerr , but does not write or store a trailing newline. .Mx .It Ic edit (e) Point the text .Ev EDITOR at each message from the given list in turn. Modified contents are discarded unless the .Va writebackedited variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status. .Ic visual can be used instead for a more display oriented editor. .Mx .It Ic elif Part of the .Ic if (see there for more), .Ic elif , else , endif conditional \(em if the condition of a preceding .Ic if was false, check the following condition and execute the following block if it evaluates true. .Mx .It Ic else (el) Part of the .Ic if (see there for more), .Ic elif , else , endif conditional \(em if none of the conditions of the preceding .Ic if and .Ic elif commands was true, the .Ic else block is executed. .Mx .It Ic endif (en) Marks the end of an .Ic if (see there for more), .Ic elif , else , endif conditional execution block. .Mx .It Ic environ \*(NQ \*(UA has a strict notion about which variables are .Sx "INTERNAL VARIABLES" and which are managed in the program .Sx ENVIRONMENT . Since some of the latter are a vivid part of \*(UAs functioning, however, they are transparently integrated into the normal handling of internal variables via .Ic set and .Ic unset . To integrate other environment variables of choice into this transparent handling, and also to export internal variables into the process environment where they normally are not, a .Ql link needs to become established with this command, as in, e.g., .Pp .Dl environ link PERL5LIB TZ .Pp Afterwards changing such variables with .Ic set will cause automatic updates of the program environment, and therefore be inherited by newly created child processes. Sufficient system support provided (it was in BSD as early as 1987, and is standardized since Y2K) removing such variables with .Ic unset will remove them also from the program environment, but in any way the knowledge they ever have been .Ql link Ns ed will be lost. Note that this implies that .Ic localopts may cause loss of such links. .Pp The command .Ql unlink will remove an existing link, but leaves the variables as such intact. Additionally the subcommands .Ql set and .Ql unset are provided, which work exactly the same as the documented commands .Ic set and .Ic unset , but (additionally un)link the variable(s) with the program environment and thus immediately export them to, or remove them from (if possible), respectively, the program environment. .Mx .It Ic errors \*(OP Since \*(UA uses the console as a user interface it can happen that messages scroll by too fast to become recognized. Therefore an error log queue is available which can be managed by .Ic errors : .Ar show or no argument will display and clear the queue, .Ar clear will only clear the queue. The queue is finite: if its maximum size is reached any new message replaces the eldest. There are also the variables .Va ^ERRQUEUE-COUNT and .Va ^ERRQUEUE-EXISTS . .Mx .It Ic eval \*(NQ Construct a command by concatenating the arguments, separated with a single space character, and then evaluate the result. This command passes through the exit status .Va \&? and error number .Va \&! of the evaluated command; also see .Ic call . .Bd -literal -offset indent define xxx { echo "xxx arg <$1>" shift if [ $# -gt 0 ] \excall xxx "$@" endif } define yyy { eval "$@ ' ball" } call yyy '\ecall xxx' "b\e$'\et'u ' " call xxx arg call xxx arg < > call xxx arg .Ed .Mx .It Ic exit (ex or x) Exit from \*(UA without changing the active mailbox and skip any saving of messages in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX , as well as a possibly tracked line editor .Va history-file . The optional status number argument will be passed through to .Xr exit 3 . \*(ID For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status. .Mx .It Ic File (Fi) Like .Ic file , but open the mailbox read-only. .Mx .It Ic file (fi) The file command switches to a new mailbox. Without arguments it shows status information of the current mailbox. If an argument is given, it will write out changes (such as deletions) the user has made, open a new mailbox, update the internal variables .Va mailbox-resolved and .Va mailbox-display , execute an according .Va folder-hook , if one is installed, and optionally display a summary of .Ic headers if the variable .Va header is set. .Pp .Sx "Filename transformations" will be applied to the .Ar name argument, and .Ql protocol:// prefixes are, i.e., URL syntax is understood, e.g., .Ql mbox:///tmp/mdirbox : if a protocol prefix is used the mailbox type is fixated and neither the auto-detection (read on) nor the .Va newfolders mechanisms apply. \*(OPally URLs can also be used to access network resources, which may be accessed securely via .Sx "Encrypted network communication" if so supported. Network communication socket timeouts are configurable, e.g., .Va socket-connect-timeout . All generated network traffic may be proxied over the SOCKS5 server given in .Va socks-proxy . .Pp .Dl \*(IN protocol://[user[:password]@]host[:port][/path] .Dl \*(OU protocol://[user@]host[:port][/path] .Pp \*(OPally supported network protocols are .Ar pop3 (POP3) and .Ar pop3s (POP3 with TLS encrypted transport), .Ar imap and .Ar imaps . The .Ar [/path] part is valid only for IMAP; there it defaults to .Ar INBOX . Network URLs require a special encoding as documented in the section .Sx "On URL syntax and credential lookup" . .Pp If the resulting file protocol (MBOX database) .Ar name is located on a local filesystem then the list of all registered .Ic filetype Ns s is traversed in order to see whether a transparent intermediate conversion step is necessary to handle the given mailbox, in which case \*(UA will use the found hook to load and save data into and from a temporary file, respectively. Changing hooks will not affect already opened mailboxes. For example, the following creates hooks for the .Xr gzip 1 compression tool and a combined compressed and encrypted format: .Bd -literal -offset indent ? filetype \e gzip 'gzip -dc' 'gzip -c' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' .Ed .Pp .Ic filetype Ns s also provide limited (case-sensitive) auto-completion capabilities. For example .Ql mbox.gz will be found for .Ql \&? file mbox provided that a corresponding handler is installed. It will neither find .Ql mbox.GZ nor .Ql mbox.Gz however, on the other hand doing an explicit .Ql \&? file mbox.GZ will find and use the handler for .Ql gz . .Pp MBOX databases will always be protected via file-region locks .Pf ( Xr fcntl 2 ) during file operations in order to avoid inconsistencies due to concurrent modifications. .Mx -ix "dotlock files" \*(OP In addition mailbox files treated as the system .Va inbox .Pf ( Ev MAIL ) , as well as .Mx -sx .Sx "primary system mailbox" Ns es in general will also be protected by so-called dotlock files, the traditional way of mail spool file locking: for any file .Ql x a lock file .Ql x.lock will be created for the duration of the synchronization \(em as necessary an external privileged dotlock helper will be used to create the dotlock file in the same directory and with the same user and group identities as the file of interest. .Va dotlock-disable can be used to turn off additional dotlock files, shall the need arise. There is also a related entry in the .Sx FAQ : .Sx "Howto handle stale dotlock files" . .Pp \*(UA by default uses tolerant POSIX rules when reading MBOX database files, but it will detect invalid message boundaries in this mode and complain (even more with .Va debug ) if any is seen: in this case .Va mbox-rfc4155 can be used to create a valid MBOX database from the invalid input. .Pp \*(OP If no protocol has been fixated, and .Ar name refers to a directory with the subdirectories .Ql tmp , .Ql new and .Ql cur , then it is treated as a folder in .Dq Maildir format. The maildir format stores each message in its own file, and has been designed so that file locking is not necessary when reading or writing files. .Pp \*(ID If no protocol has been fixated and no existing file has been found, the variable .Va newfolders controls the format of mailboxes yet to be created. .Mx .Mx .It Ic filetype , unfiletype \*(NQ Define, list, and remove, respectively, file handler hooks, which provide (shell) commands that enable \*(UA to load and save MBOX files from and to files with the registered file extensions, as shown and described for .Ic file . The extensions are used case-insensitively, yet the auto-completion feature of, e.g., .Ic file will only work case-sensitively. An intermediate temporary file will be used to store the expanded data. The latter command will remove hooks for all given extensions, asterisk .Ql * will remove all existing handlers. .Pp When used without arguments the former shows a list of all currently defined file hooks, with one argument the expansion of the given alias. Otherwise three arguments are expected, the first specifying the file extension for which the hook is meant, and the second and third defining the load- and save commands to deal with the file type, respectively, both of which must read from standard input and write to standard output. Changing hooks will not affect already opened mailboxes (\*(ID except below). \*(ID For now too much work is done, and files are oftened read in twice where once would be sufficient: this can cause problems if a filetype is changed while such a file is opened; this was already so with the built-in support of .gz etc. in Heirloom, and will vanish in v15. \*(ID For now all handler strings are passed to the .Ev SHELL for evaluation purposes; in the future a .Ql \&! prefix to load and save commands may mean to bypass this shell instance: placing a leading space will avoid any possible misinterpretations. .Bd -literal -offset indent ? filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e gz 'gzip -dc' 'gzip -c' xz 'xz -dc' 'xz -zc' \e zst 'zstd -dc' 'zstd -19 -zc' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' ? set record=+sent.zst.pgp .Ed .Mx .Mx .It Ic flag , unflag Take message lists and mark the messages as being flagged, or not being flagged, respectively, for urgent/special attention. See the section .Sx "Message states" . .Mx .It Ic folder (fold) The same as .Ic file . .Mx .It Ic folders With no arguments, list the names of the folders in the folder directory. With an existing folder as an argument, lists the names of folders below the named folder. .Mx .It Ic Followup (F) Similar to .Ic Respond , but saves the message in a file named after the local part of the first recipient's address (instead of in .Va record Ns ). .Mx .It Ic followup (fo) Similar to .Ic respond , but saves the message in a file named after the local part of the first recipient's address (instead of in .Va record Ns ). .Mx .It Ic followupall Similar to .Ic followup , but responds to all recipients regardless of the .Va flipr variable. .Mx .It Ic followupsender Similar to .Ic Followup , but responds to the sender only regardless of the .Va flipr variable. .Mx .It Ic Forward Similar to .Ic forward , but saves the message in a file named after the local part of the recipient's address (instead of in .Va record Ns ). .Mx .It Ic forward Takes a message and the address of a recipient and forwards the message to him. The text of the original message is included in the new one, with the value of the .Va forward-inject-head variable preceding, and the value of .Va forward-inject-tail succeeding it. To filter the included header fields to the desired subset use the .Ql forward slot of the white- and blacklisting command .Ic headerpick . Only the first part of a multipart message is included unless .Va forward-as-attachment , and recipient addresses will be stripped from comments, names etc. unless the internal variable .Va fullnames is set. .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -NODATA if no applicable messages have been given, .Va ^ERR Ns -NOTSUP if multiple messages have been specified, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. .Mx .It Ic from (f) Takes a list of message specifications and displays a summary of their message headers, exactly as via .Ic headers , making the first message of the result the new .Dq dot (the last message if .Va showlast is set). An alias of this command is .Ic search . Also see .Sx "Specifying messages" . .It Ic Fwd \*(OB Alias for .Ic Forward . .It Ic fwd \*(OB Alias for .Ic forward . .It Ic fwdignore \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic fwdretain \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic ghost , unghost \*(OB Replaced by .Ic commandalias , .Ic uncommandalias . .Mx .Mx .It Ic headerpick , unheaderpick \*(NQ Multiplexer command to manage white- and blacklisting selections of header fields for a variety of applications. Without arguments the set of contexts that have settings is displayed. When given arguments, the first argument is the context to which the command applies, one of (case-insensitive) .Ql type for display purposes (via, e.g., .Ic type ) , .Ql save for selecting which headers shall be stored persistently when .Ic save , .Ic copy , .Ic move or even .Ic decrypt Ns ing messages (note that MIME related etc. header fields should not be ignored in order to not destroy usability of the message in this case), .Ql forward for stripping down messages when .Ic forward Ns ing message (has no effect if .Va forward-as-attachment is set), and .Ql top for defining user-defined set of fields for the command .Ic top . .Pp The current settings of the given context are displayed if it is the only argument. A second argument denotes the type of restriction that is to be chosen, it may be (a case-insensitive prefix of) .Ql retain or .Ql ignore for white- and blacklisting purposes, respectively. Establishing a whitelist suppresses inspection of the corresponding blacklist. .Pp If no further argument is given the current settings of the given type will be displayed, otherwise the remaining arguments specify header fields, which \*(OPally may be given as regular expressions, to be added to the given type. The special wildcard field (asterisk, .Ql * ) will establish a (fast) shorthand setting which covers all fields. .Pp The latter command always takes three or more arguments and can be used to remove selections, i.e., from the given context, the given type of list, all the given headers will be removed, the special argument .Ql * will remove all headers. .Mx .It Ic headers (h) Show the current group of headers, the size of which depends on the variable .Va screen in interactive mode, and the format of which can be defined with .Va headline . If a message-specification is given the group of headers containing the first message therein is shown and the message at the top of the screen becomes the new .Dq dot ; the last message is targeted if .Va showlast is set. .Mx .It Ic help (hel) A synonym for .Ic \&? . .Mx .It Ic history \*(OP Without arguments or when given .Cm show all history entries are shown (this mode also supports a more .Va verbose output). .Cm load will replace the list of entries with the content of .Va history-file , and .Cm save will dump the current list to said file, replacing former content. .Cm clear will delete all history entries. The argument can also be a signed decimal .Ar NUMBER , which will select and evaluate the respective history entry, and move it to the top of the history; a negative number is used as an offset to the current command, e.g., .Ql -1 will select the last command, the history top. Please see .Sx "On terminal control and line editor" for more on this topic. .Mx .It Ic hold (ho, also .Ic preserve ) Takes a message list and marks each message therein to be saved in the user's system .Va inbox instead of in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX . Does not override the .Ic delete command. \*(UA deviates from the POSIX standard with this command, because a .Ic next command issued after .Ic hold will display the following message, not the current one. .Mx .It Ic if (i) Part of the .Ic \&\&if , Ic elif , else , endif conditional execution construct \(em if the given condition is true then the encapsulated block is executed. The POSIX standard only supports the (case-insensitive) conditions .Ql r Ns eceive and .Ql s Ns end, the remaining are non-portable extensions. \*(ID In conjunction with the .Cm wysh command prefix(es) .Sx "Shell-style argument quoting" and more test operators are available. .Bd -literal -offset indent if receive commands ... else commands ... endif .Ed .Pp Further (case-insensitive) one-argument conditions are .Ql t Ns erminal which evaluates to true in interactive (terminal) sessions, as well as any boolean value (see .Sx "INTERNAL VARIABLES" for textual boolean representations) to mark an enwrapped block as .Dq never execute or .Dq always execute . (Remarks: condition syntax errors skip all branches until .Ic endif . ) .Pp \*(OU and without .Cm wysh : It is possible to check .Sx "INTERNAL VARIABLES" as well as .Sx ENVIRONMENT variables for existence or compare their expansion against a user given value or another variable by using the .Ql $ .Pf ( Dq variable next ) conditional trigger character; a variable on the right hand side may be signalled using the same mechanism. Variable names may be enclosed in a pair of matching braces. When this mode has been triggered, several operators are available (\*(IN and .Cm wysh : they are always available, and there is no trigger: variables will have been expanded by the shell-compatible parser before the .Ic if etc. command sees them). .Pp \*(IN Two argument conditions. Variables can be tested for existence and expansion: .Ql -N will test whether the given variable exists, e.g., .Ql -N editalong will evaluate to true when .Va editalong is set, whereas .Ql -Z editalong will if it is not. .Ql -n """$editalong""" will be true if the variable is set and expands to a non-empty string, .Ql -z $'\e$editalong' only if the expansion is empty, whether the variable exists or not. The remaining conditions take three arguments. .Pp Integer operators treat the arguments on the left and right hand side of the operator as integral numbers and compare them arithmetically. It is an error if any of the operands is not a valid integer, an empty argument (which implies it had been quoted) is treated as if it were 0. Via the question mark .Ql \&? modifier suffix a saturated operation mode is available where numbers will linger at the minimum or maximum possible value, instead of overflowing (or trapping), the keyword .Ql saturated is optional, e.g., .Ql ==? , .Ql ==?satu and .Ql ==?saturated are identical. Available operators are .Ql -lt (less than), .Ql -le (less than or equal to), .Ql -eq (equal), .Ql -ne (not equal), .Ql -ge (greater than or equal to), and .Ql -gt (greater than). .Pp String and regular expression data operators compare the left and right hand side according to their textual content. Unset variables are treated as the empty string. Via the question mark .Ql \&? modifier suffix a case-insensitive operation mode is available, the keyword .Ql case is optional, e.g., .Ql ==? and .Ql ==?case are identical. .Pp Available string operators are .Ql < (less than), .Ql <= (less than or equal to), .Ql == (equal), .Ql != (not equal), .Ql >= (greater than or equal to), .Ql > (greater than), .Ql =% (is substring of) and .Ql !% (is not substring of). By default these operators work on bytes and (therefore) do not take into account character set specifics. If the case-insensitivity modifier has been used, case is ignored according to the rules of the US-ASCII encoding, i.e., bytes are still compared. .Pp When the \*(OPal regular expression support is available, the additional string operators .Ql =~ and .Ql !~ can be used. They treat the right hand side as an extended regular expression that is matched according to the active locale (see .Sx "Character sets" ) , i.e., character sets should be honoured correctly. .Pp Conditions can be joined via AND-OR lists (where the AND operator is .Ql && and the OR operator is .Ql || ) , which have equal precedence and will be evaluated with left associativity, thus using the same syntax that is known for the .Xr sh 1 . It is also possible to form groups of conditions and lists by enclosing them in pairs of brackets .Ql [\ \&.\&.\&.\ ] , which may be interlocked within each other, and also be joined via AND-OR lists. .Pp The results of individual conditions and entire groups may be modified via unary operators: the unary operator .Ql \&! will reverse the result. .Bd -literal -offset indent wysh set v15-compat=yes # with value: automatic "wysh"! if -N debug;echo *debug* set;else;echo not;endif if [ "$ttycharset" == UTF-8 ] || \e [ "$ttycharset" ==?case UTF8 ] echo *ttycharset* is UTF-8, the former case-sensitive! endif set t1=one t2=one if [ "${t1}" == "${t2}" ] echo These two variables are equal endif if "$features" =% +regex && "$TERM" =~?case "^xterm\&.*" echo ..in an X terminal endif if [ [ true ] && [ [ "${debug}" != '' ] || \e [ "$verbose" != '' ] ] ] echo Noisy, noisy endif if true && [ -n "$debug" || -n "${verbose}" ] echo Left associativity, as is known from the shell endif .Ed .Mx .It Ic ignore (ig) Identical to .Ic discard . Superseded by the multiplexer .Ic headerpick . .Mx .It Ic list Shows the names of all available commands, alphabetically sorted. If given any non-whitespace argument the list will be shown in the order in which command prefixes are searched. \*(OP In conjunction with a set variable .Va verbose additional information will be provided for each command: the argument type will be indicated, the documentation string will be shown, and the set of command flags will show up: .Pp .Bl -tag -compact -width ".It Ql NEEDS_BOX" .It Ql "`local'" command supports the command modifier .Cm local . .It Ql "`vput'" command supports the command modifier .Cm vput . .It Ql "*!*" the error number is tracked in .Va \&! . .It Ql needs-box whether the command needs an active mailbox, a .Ic file . .It Ql ok: indicators whether command is \&.\h'.3m'.\h'.3m'. .Bl -tag -compact -width ".It Ql SUBPROCESS" .It Ql batch/interactive usable in interactive or batch mode .Pf ( Fl # ) . .It Ql send-mode usable in send mode. .It Ql subprocess allowed to be used when running in a subprocess instance, e.g., from within a macro that is called via .Va on-compose-splice . .El .It Ql not ok: indicators whether command is not \&.\h'.3m'.\h'.3m'. .Bl -tag -compact -width ".It Ql COMPOSE_MODE" .It Ql compose-mode available in compose mode. .It Ql startup available during program startup, e.g., in .Sx "Resource files" . .El .It Ql "gabby" The command produces .Va history-gabby .Ic history entries. .El .Mx .It Ic localopts Enforce change localization of .Ic environ (linked) .Sx ENVIRONMENT as well as (global) .Sx "INTERNAL VARIABLES" , meaning that their state will be reverted to the former one once the .Dq covered scope is left. Just like the command modifier .Cm local , which provides block-scope localization for some commands (instead), it can only be used inside of macro definition blocks introduced by .Ic account or .Ic define . The covered scope of an .Ic account is left once a different account is activated, and some macros, notably .Va folder-hook Ns s , use their own specific notion of covered scope, here it will be extended until the folder is left again. .Pp This setting stacks up: i.e., if .Ql macro1 enables change localization and calls .Ql macro2 , which explicitly resets localization, then any value changes within .Ql macro2 will still be reverted when the scope of .Ql macro1 is left. (Caveats: if in this example .Ql macro2 changes to a different .Ic account which sets some variables that are already covered by localizations, their scope will be extended, and in fact leaving the .Ic account will (thus) restore settings in (likely) global scope which actually were defined in a local, macro private context!) .Pp This command takes one or two arguments, the optional first one specifies an attribute that may be one of .Cm \&\&scope , which refers to the current scope and is thus the default, .Cm call , which causes any macro that is being .Ic call Ns ed to be started with localization enabled by default, as well as .Cm call-fixate , which (if enabled) disallows any called macro to turn off localization: like this it can be ensured that once the current scope regains control, any changes made in deeper levels have been reverted. The latter two are mutually exclusive, and neither affects .Ic xcall . The (second) argument is interpreted as a boolean (string, see .Sx "INTERNAL VARIABLES" ) and states whether the given attribute shall be turned on or off. .Bd -literal -offset indent define temporary_settings { set possibly_global_option1 localopts on set localized_option1 set localized_option2 localopts scope off set possibly_global_option2 } .Ed .Mx .It Ic Lreply Reply to messages that come in via known .Pf ( Ic mlist ) or subscribed .Pf ( Ic mlsubscribe ) mailing lists, or pretend to do so (see .Sx "Mailing lists" ) : on top of the usual .Ic reply functionality this will actively resort and even remove message recipients in order to generate a message that is supposed to be sent to a mailing list. For example it will also implicitly generate a .Ql Mail-Followup-To: header if that seems useful, regardless of the setting of the variable .Va followup-to . For more documentation please refer to .Sx "On sending mail, and non-interactive mode" . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -NODATA if no applicable messages have been given, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. Occurrence of some of the errors depend on the value of .Va expandaddr . Any error stops processing of further messages. .Mx .It Ic Mail Similar to .Ic mail , but saves the message in a file named after the local part of the first recipient's address (instead of in .Va record Ns ). .Mx .It Ic mail (m) Takes a (list of) recipient address(es) as (an) argument(s), or asks on standard input if none were given; then collects the remaining mail content and sends it out. Unless the internal variable .Va fullnames is set recipient addresses will be stripped from comments, names etc. For more documentation please refer to .Sx "On sending mail, and non-interactive mode" . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -NODATA if no applicable messages have been given, .Va ^ERR Ns -NOTSUP if multiple messages have been specified, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. Occurrence of some of the errors depend on the value of .Va expandaddr . .Mx .It Ic mbox (mb) The given message list is to be sent to the .Mx -sx .Sx "secondary mailbox" .Ev MBOX when \*(UA is quit; this is the default action unless the variable .Va hold is set. \*(ID This command can only be used in a .Mx -sx .Sx "primary system mailbox" . .Mx .Mx .It Ic mimetype , unmimetype \*(NQ Without arguments the content of the MIME type cache will displayed; a more verbose listing will be produced if either of .Va debug or .Va verbose are set. When given arguments they will be joined, interpreted as shown in .Sx "The mime.types files" (also see .Sx "HTML mail and MIME attachments" ) , and the resulting entry will be added (prepended) to the cache. In any event MIME type sources are loaded first as necessary \(en .Va mimetypes-load-control can be used to fine-tune which sources are actually loaded. .Pp The latter command deletes all specifications of the given MIME type, thus .Ql \&? unmimetype text/plain will remove all registered specifications for the MIME type .Ql text/plain . The special name .Ql * will discard all existing MIME types, just as will .Ql reset , but which also reenables cache initialization via .Va mimetypes-load-control . .Mx .It Ic mimeview \*(ID Only available in interactive mode, this command allows one to display MIME parts which require external MIME handler programs to run which do not integrate in \*(UAs normal .Ic type output (see .Sx "HTML mail and MIME attachments" ) . (\*(ID No syntax to directly address parts, this restriction may vanish.) The user will be asked for each non-text part of the given message in turn whether the registered handler shall be used to display the part. .Mx .Mx .It Ic mlist , unmlist \*(NQ Manage the list of known .Sx "Mailing lists" ; subscriptions are controlled via .Ic mlsubscribe . The latter command deletes all given arguments, or all at once when given the asterisk .Ql * . The former shows the list of all currently known lists if used without arguments, otherwise the given arguments will become known. \*(OP In the latter case, arguments which contain any of the .Mx -sx .Sx "magic regular expression characters" will be interpreted as one, possibly matching many addresses; these will be sequentially matched via linked lists instead of being looked up in a dictionary. .Mx .Mx .It Ic mlsubscribe , unmlsubscribe Building upon the command pair .Ic mlist , unmlist , but only managing the subscription attribute of mailing lists. (The former will also create not yet existing mailing lists.) .Mx .It Ic Move Similar to .Ic move , but moves the messages to a file named after the local part of the sender address of the first message (instead of in .Va record Ns ). .Mx .It Ic move Acts like .Ic copy but marks the messages for deletion if they were transferred successfully. .Mx .It Ic More Like .Ic more , but also displays header fields which would not pass the .Ic headerpick selection, and all MIME parts. Identical to .Ic Page . .Mx .It Ic more Invokes the .Ev PAGER on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to .Ic page . .Mx .It Ic netrc \*(OP When used without arguments or if .Ar show has been given the content of the .Pa \*(VN cache is shown, loading it first as necessary. If the argument is .Ar load then the cache will only be initialized and .Ar clear will remove its contents. Note that \*(UA will try to load the file only once, use .Ql Ic \&\&netrc Ns \:\0\:clear to unlock further attempts. See .Va netrc-lookup , .Va netrc-pipe and the section .Sx "On URL syntax and credential lookup" ; the section .Sx "The .netrc file" documents the file format in detail. .Mx .It Ic newmail Checks for new mail in the current folder without committing any changes before. If new mail is present, a message is shown. If the .Va header variable is set, the headers of each new message are also shown. This command is not available for all mailbox types. .Mx .It Ic next (n) (like .Ql + or .Dq ENTER ) Goes to the next message in sequence and types it. With an argument list, types the next matching message. .Mx .It Ic New Same as .Ic Unread . .Mx .It Ic new Same as .Ic unread . .Mx .It Ic noop If the current folder is accessed via a network connection, a .Dq NOOP command is sent, otherwise no operation is performed. .Mx .It Ic Page Like .Ic page , but also displays header fields which would not pass the .Ic headerpick selection, and all MIME parts. Identical to .Ic More . .Mx .It Ic page Invokes the .Ev PAGER on the given messages, even in non-interactive mode and as long as the standard output is a terminal. Identical to .Ic more . .Mx .It Ic Pipe Like .Ic pipe but also pipes header fields which would not pass the .Ic headerpick selection, and all parts of MIME .Ql multipart/alternative messages. .Mx .It Ic pipe (pi) Takes an optional message list and shell command (that defaults to .Va cmd ) , and pipes the messages through the command. If the .Va page variable is set, every message is followed by a formfeed character. .Mx .It Ic preserve (pre) A synonym for .Ic hold . .Mx .It Ic Print (P) Alias for .Ic Type . .Mx .It Ic print (p) Research .Ux equivalent of .Ic type . .Mx .It Ic quit (q) Terminates the session, saving all undeleted, unsaved messages in the current .Mx -sx .Sx "secondary mailbox" .Ev MBOX , preserving all messages marked with .Ic hold or .Ic preserve or never referenced in the system .Va inbox , and removing all other messages from the .Mx -sx .Sx "primary system mailbox" . If new mail has arrived during the session, the message .Dq You have new mail will be shown. If given while editing a mailbox file with the command line option .Fl f , 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. The optional status number argument will be passed through to .Xr exit 3 . \*(ID For now it can happen that the given status will be overwritten, later this will only occur if a later error needs to be reported onto an otherwise success indicating status. .Mx .It Ic read \*(NQ Read a line from standard input, or the channel set active via .Ic readctl , and assign the data, which will be split as indicated by .Va ifs , to the given variables. The variable names are checked by the same rules as documented for .Cm vput , and the same error codes will be seen in .Va \&! ; the exit status .Va \&? indicates the number of bytes read, it will be .Ql -1 with the error number .Va \&! set to .Va ^ERR Ns -BADF in case of I/O errors, or .Va ^ERR Ns -NONE upon End-Of-File. If there are more fields than variables, assigns successive fields to the last given variable. If there are less fields than variables, assigns the empty string to the remains. .Bd -literal -offset indent ? read a b c H e l l o ? echo "<$a> <$b> <$c>" ? wysh set ifs=:; read a b c;unset ifs hey2.0,:"'you ",:world!:mars.: ? echo $?/$^ERRNAME / <$a><$b><$c> 0/NONE / <"'you ",><><> .Ed .Mx .It Ic readall \*(NQ Read anything from standard input, or the channel set active via .Ic readctl , and assign the data to the given variable. The variable name is checked by the same rules as documented for .Cm vput , and the same error codes will be seen in .Va \&! ; the exit status .Va \&? indicates the number of bytes read, it will be .Ql -1 with the error number .Va \&! set to .Va ^ERR Ns -BADF in case of I/O errors, or .Va ^ERR Ns -NONE upon End-Of-File. \*(ID The input data length is restricted to 31-bits. .Mx .It Ic readctl \*(NQ Manages input channels for .Ic read and .Ic readall , to be used to avoid complicated or impracticable code, like calling .Ic \&\&read from within a macro in non-interactive mode. Without arguments, or when the first argument is .Cm show , a listing of all known channels is printed. Channels can otherwise be .Cm create Ns d, and existing channels can be .Cm set active and .Cm remove Ns d by giving the string used for creation. .Pp The channel name is expected to be a file descriptor number, or, if parsing the numeric fails, an input file name that undergoes .Sx "Filename transformations" . E.g. (this example requires a modern shell): .Bd -literal -offset indent $ LC_ALL=C printf 'echon "hey, "\enread a\enyou\enecho $a' |\e LC_ALL=C \*(uA -R# hey, you $ LC_ALL=C printf 'echon "hey, "\enread a\enecho $a' |\e LC_ALL=C 6<<< 'you' \*(uA -R#X'readctl create 6' hey, you .Ed .Mx .It Ic remove Removes the named files or directories. .Sx "Filename transformations" including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) are performed on the arguments. If a name refer to a mailbox, e.g., a Maildir mailbox, then a mailbox type specific removal will be performed, deleting the complete mailbox. The user is asked for confirmation in interactive mode. .Mx .It Ic rename Takes the name of an existing folder and the name for the new folder and renames the first to the second one. .Sx "Filename transformations" including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) are performed on both arguments. Both folders must be of the same type. .Mx .It Ic Reply (R) Identical to .Ic reply except that it replies to only the sender of each message of the given list, by using the first message as the template to quote, for the .Ql Subject: etc.; setting .Va flipr will exchange this command with .Ic reply . .Mx .It Ic reply (r) Take a message and group-responds to it by addressing the sender and all recipients, subject to .Ic alternates processing. .Va followup-to , .Va followup-to-honour , .Va reply-to-honour as well as .Va recipients-in-cc influence response behaviour. Unless the internal variable .Va fullnames is set recipient addresses will be stripped from comments, names etc. .Va quote as well as .Va quote-as-attachment configure whether responded-to message shall be quoted etc.; setting .Va flipr will exchange this command with .Ic Reply . The command .Ic Lreply offers special support for replying to mailing lists. For more documentation please refer to .Sx "On sending mail, and non-interactive mode" . .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -NODATA if no applicable messages have been given, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. Occurrence of some of the errors depend on the value of .Va expandaddr . Any error stops processing of further messages. .Mx .It Ic replyall Similar to .Ic reply , but initiates a group-reply regardless of the value of .Va flipr . .Mx .It Ic replysender Similar to .Ic Reply , but responds to the sender only regardless of the value of .Va flipr . .Mx .It Ic Resend Like .Ic resend , but does not add any header lines. This is not a way to hide the sender's identity, but useful for sending a message again to the same recipients. .Mx .It Ic resend Takes a list of messages and a user name and sends each message to the named user. .Ql Resent-From: and related header fields are prepended to the new copy of the message. Saving in .Va record is only performed if .Va record-resent is set. .Pp This may generate the errors .Va ^ERR Ns -DESTADDRREQ if no receiver has been specified, .Va ^ERR Ns -PERM if some addressees where rejected by .Va expandaddr , .Va ^ERR Ns -NODATA if no applicable messages have been given, .Va ^ERR Ns -IO if an I/O error occurs, .Va ^ERR Ns -NOTSUP if a necessary character set conversion fails, and .Va ^ERR Ns -INVAL for other errors. Occurrence of some of the errors depend on the value of .Va expandaddr . Any error stops processing of further messages. .Mx .It Ic Respond Same as .Ic Reply . .Mx .It Ic respond Same as .Ic reply . .Mx .It Ic respondall Same as .Ic replyall . .Mx .It Ic respondsender Same as .Ic replysender . .Mx .It Ic retain (ret) Superseded by the multiplexer .Ic headerpick . .Mx .It Ic return Only available inside the scope of a .Ic define Ns d macro or an .Ic account , this will stop evaluation of any further macro content, and return execution control to the caller. The two optional parameters must be specified as positive decimal numbers and default to the value 0: the first argument specifies the signed 32-bit return value (stored in .Va \&? \*(ID and later extended to signed 64-bit), the second the signed 32-bit error number (stored in .Va \&! ) . As documented for .Va \&? a non-0 exit status may cause the program to exit. .Mx .It Ic Save (S) Similar to .Ic save, but saves the messages in a file named after the local part of the sender of the first message instead of (in .Va record and) taking a filename argument; the variable .Va outfolder is inspected to decide on the actual storage location. .Mx .It Ic save (s) Takes a message list and a filename and appends each message in turn to the end of the file. .Sx "Filename transformations" including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) is performed on the filename. If no filename is given, the .Mx -sx .Sx "secondary mailbox" .Ev MBOX is used. The filename in quotes, followed by the generated character count is echoed on the user's terminal. If editing a .Mx -sx .Sx "primary system mailbox" the messages are marked for deletion. .Sx "Filename transformations" will be applied. To filter the saved header fields to the desired subset use the .Ql save slot of the white- and blacklisting command .Ic headerpick . .It Ic savediscard \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic saveignore \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic saveretain \*(OB Superseded by the multiplexer .Ic headerpick . .Mx .It Ic search Takes a message specification (list) and displays a header summary of all matching messages, as via .Ic headers . This command is an alias of .Ic from . Also see .Sx "Specifying messages" . .Mx .It Ic seen Takes a message list and marks all messages as having been read. .Mx .Mx .It Ic set , unset (se, \*(NQ uns) The latter command will delete all given global variables, or only block-scope local ones if the .Cm local command modifier has been used. The former, when used without arguments, will show all currently known variables, being more verbose if either of .Va debug or .Va verbose is set. Remarks: this list mode will not automatically link-in known .Sx ENVIRONMENT variables, but only explicit addressing will, e.g., via .Ic varshow , using a variable in an .Ic if condition or a string passed to .Ic echo , explicit .Ic \&\&set Ns ting, as well as some program-internal use cases. .Pp Otherwise the given variables (and arguments) are set or adjusted. Arguments are of the form .Ql name=value (no space before or after .Ql = ) , or plain .Ql name if there is no value, i.e., a boolean variable. If a name begins with .Ql no , as in .Ql set nosave , the effect is the same as invoking the .Ic \&\&unset command with the remaining part of the variable .Pf ( Ql unset save ) . \*(ID In conjunction with the .Cm wysh .Pf (or\0 Cm local ) command prefix(es) .Sx "Shell-style argument quoting" can be used to quote arguments as necessary. \*(ID Otherwise quotation marks may be placed around any part of the assignment statement to quote blanks or tabs. .Pp When operating in global scope any .Ql name that is known to map to an environment variable will automatically cause updates in the program environment (unsetting a variable in the environment requires corresponding system support) \(em use the command .Ic environ for further environmental control. If the command modifier .Cm local has been used to alter the command to work in block-scope all variables have values (may they be empty), and creation of names which shadow .Sx "INTERNAL VARIABLES" is actively prevented (\*(ID shadowing of linked .Sx ENVIRONMENT variables and free-form versions of variable chains is not yet detected). Also see .Ic varshow and the sections .Sx "INTERNAL VARIABLES" and .Sx ENVIRONMENT . .Bd -literal -offset indent ? wysh set indentprefix=' -> ' ? wysh set atab=$'\t' aspace=' ' zero=0 .Ed .Mx .It Ic shcodec Apply shell quoting rules to the given raw-data arguments. Supports .Cm vput (see .Sx "Command modifiers" ) . The first argument specifies the operation: .Ar [+]e[ncode] or .Ar d[ecode] cause shell quoting to be applied to the remains of the line, and expanded away thereof, respectively. If the former is prefixed with a plus-sign, the quoted result will not be roundtrip enabled, and thus can be decoded only in the very same environment that was used to perform the encode; also see .Cd mle-quote-rndtrip . If the coding operation fails the error number .Va \&! is set to .Va ^ERR Ns -CANCELED , and the unmodified input is used as the result; the error number may change again due to output or result storage errors. .Mx .It Ic shell \*(NQ (sh) Invokes an interactive version of the shell, and returns its exit status. .Mx .Mx .It Ic shortcut , unshortcut \*(NQ Manage the file- or pathname shortcuts as documented for .Ic file . The latter command deletes all shortcuts given as arguments, or all at once when given the asterisk .Ql * . The former shows the list of all currently defined shortcuts if used without arguments, the target of the given with a single argument. Otherwise arguments are treated as pairs of shortcuts and their desired expansion, creating new or updating already existing ones. .Mx .It Ic shift \*(NQ Shift the positional parameter stack (starting at .Va 1 ) by the given number (which must be a positive decimal), or 1 if no argument has been given. It is an error if the value exceeds the number of positional parameters. If the given number is 0, no action is performed, successfully. The stack as such can be managed via .Ic vpospar . Note this command will fail in .Ic account and hook macros unless the positional parameter stack has been explicitly created in the current context via .Ic vpospar . .Mx .It Ic show Like .Ic type , but performs neither MIME decoding nor decryption, so that the raw message text is shown. .Mx .It Ic size (si) Shows the size in characters of each message of the given message-list. .Mx .It Ic sleep \*(NQ Sleep for the specified number of seconds (and optionally milliseconds), by default interruptable. If a third argument is given the sleep will be uninterruptible, otherwise the error number .Va \&! will be set to .Va ^ERR Ns -INTR if the sleep has been interrupted. The command will fail and the error number will be .Va ^ERR Ns -OVERFLOW if the given duration(s) overflow the time datatype, and .Va ^ERR Ns -INVAL if the given durations are no valid integers. .Mx .Mx .It Ic sort , unsort The latter command disables sorted or threaded mode, returns to normal message order and, if the .Va header variable is set, displays a header summary. The former command shows the current sorting criterion when used without an argument, but creates a sorted representation of the current folder otherwise, and changes the .Ic next command and the addressing modes such that they refer to messages in the sorted order. Message numbers are the same as in regular mode. If the .Va header variable is set, a header summary in the new order is also displayed. Automatic folder sorting can be enabled by setting the .Va autosort variable, as in, e.g., .Ql set autosort=thread . Possible sorting criterions are: .Pp .Bl -tag -compact -width "subject" .It Ar date Sort the messages by their .Ql Date: field, that is by the time they were sent. .It Ar from Sort messages by the value of their .Ql From: field, that is by the address of the sender. If the .Va showname variable is set, the sender's real name (if any) is used. .It Ar size Sort the messages by their size. .It spam \*(OP Sort the message by their spam score, as has been classified by .Ic spamrate . .It Ar status Sort the messages by their message status. .It Ar subject Sort the messages by their subject. .It Ar thread Create a threaded display. .It Ar to Sort messages by the value of their .Ql To: field, that is by the address of the recipient. If the .Va showname variable is set, the recipient's real name (if any) is used. .El .Mx .It Ic source \*(NQ (so) The source command reads commands from the given file. .Sx "Filename transformations" will be applied. If the given expanded argument ends with a vertical bar .Ql | then the argument will instead be interpreted as a shell command and \*(UA will read the output generated by it. Dependent on the settings of .Va posix and .Va errexit , and also dependent on whether the command modifier .Cm ignerr had been used, encountering errors will stop sourcing of the given input. \*(ID Note that .Ic \&\&source cannot be used from within macros that execute as .Va folder-hook Ns s or .Ic account Ns s , i.e., it can only be called from macros that were .Ic call Ns ed . .Mx .It Ic source_if \*(NQ The difference to .Ic source (beside not supporting pipe syntax aka shell command input) is that this command will not generate an error nor warn if the given file argument cannot be opened successfully. .Mx .It Ic spamclear \*(OP Takes a list of messages and clears their .Ql is-spam flag. .Mx .It Ic spamforget \*(OP Takes a list of messages and causes the .Va spam-interface to forget it has ever used them to train its Bayesian filter. Unless otherwise noted the .Ql is-spam flag of the message is inspected to chose whether a message shall be forgotten to be .Dq ham or .Dq spam . .Mx .It Ic spamham \*(OP Takes a list of messages and informs the Bayesian filter of the .Va spam-interface that they are .Dq ham . This also clears the .Ql is-spam flag of the messages in question. .Mx .It Ic spamrate \*(OP Takes a list of messages and rates them using the configured .Va spam-interface , without modifying the messages, but setting their .Ql is-spam flag as appropriate; because the spam rating headers are lost the rate will be forgotten once the mailbox is left. Refer to the manual section .Sx "Handling spam" for the complete picture of spam handling in \*(UA. .Mx .It Ic spamset \*(OP Takes a list of messages and sets their .Ql is-spam flag. .Mx .It Ic spamspam \*(OP Takes a list of messages and informs the Bayesian filter of the .Va spam-interface that they are .Dq spam . This also sets the .Ql is-spam flag of the messages in question. .It Ic thread \*(OB The same as .Ql sort thread (consider using a .Ql commandalias as necessary). .Mx .It Ic tls \*(NQ TLS information and management command multiplexer to aid in .Sx "Encrypted network communication" . Commands support .Cm vput if so documented (see .Sx "Command modifiers" ) . The result that is shown in case of errors is always the empty string, errors can be identified via the error number .Va \&! . For example, string length overflows are caught and set .Va \&! to .Va ^ERR Ns -OVERFLOW . Note this command of course honours the overall TLS configuration. .Bd -literal -offset indent ? vput tls result fingerprint pop3s://ex.am.ple ? echo $?/$!/$^ERRNAME: $result .Ed .Bl -hang -width ".It Cm random" .It Cm fingerprint Show the .Va tls-fingerprint-digest Ns ed fingerprint of the certificate of the given HOST .Pf ( Ql server:port , where the port defaults to the HTTPS port, 443). .Va tls-fingerprint is actively ignored for the runtime of this command. Only available if the term .Ql +sockets is included in .Va features . .El .Mx .It Ic Top Like .Ic top but always uses the .Ic headerpick .Ql type slot for white- and blacklisting header fields. .Mx .It Ic top (to) Takes a message list and types out the first .Va toplines lines of each message on the user's terminal. Unless a special selection has been established for the .Ql top slot of the .Ic headerpick command, the only header fields that are displayed are .Ql From: , .Ql To: , .Ql CC: , and .Ql Subject: . .Ic Top will always use the .Ql type .Ic headerpick selection instead. It is possible to apply compression to what is displayed by setting .Va topsqueeze . Messages are decrypted and converted to the terminal character set if necessary. .Mx .It Ic touch (tou) Takes a message list and marks the messages for saving in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX . \*(UA deviates from the POSIX standard with this command, as a following .Ic next command will display the following message instead of the current one. .Mx .It Ic Type (T) Like .Ic type but also displays header fields which would not pass the .Ic headerpick selection, and all visualizable parts of MIME .Ql multipart/alternative messages. .Mx .It Ic type (t) Takes a message list and types out each message on the user's terminal. The display of message headers is selectable via .Ic headerpick . For MIME multipart messages, all parts with a content type of .Ql text , all parts which have a registered MIME type handler (see .Sx "HTML mail and MIME attachments" ) which produces plain text output, and all .Ql message parts are shown, others are hidden except for their headers. Messages are decrypted and converted to the terminal character set if necessary. The command .Ic mimeview can be used to display parts which are not displayable as plain text. .It Ic unaccount See .Ic account . .It Ic unalias (una) See .Ic alias . .It Ic unanswered See .Ic answered . .It Ic unbind See .Ic bind . .It Ic uncollapse See .Ic collapse . .It Ic uncolour See .Ic colour . .It Ic undefine See .Ic define . .It Ic undelete See .Ic delete . .It Ic undraft See .Ic draft . .It Ic unflag See .Ic flag . .It Ic unfwdignore \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic unfwdretain \*(OB Superseded by the multiplexer .Ic headerpick . .Mx .It Ic unignore Superseded by the multiplexer .Ic headerpick . .It Ic unmimetype See .Ic mimetype . .It Ic unmlist See .Ic mlist . .It Ic unmlsubscribe See .Ic mlsubscribe . .Mx .It Ic Unread Same as .Ic unread . .Mx .It Ic unread Takes a message list and marks each message as not having been read. .Mx .It Ic unretain Superseded by the multiplexer .Ic headerpick . .It Ic unsaveignore \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic unsaveretain \*(OB Superseded by the multiplexer .Ic headerpick . .It Ic unset \*(NQ (uns) See .Ic set . .It Ic unshortcut See .Ic shortcut . .It Ic unsort See .Ic short . .It Ic unthread \*(OB Same as .Ic unsort . .Mx .It Ic urlcodec Perform URL percent codec operations on the raw-data argument, rather according to RFC 3986. Supports .Cm vput (see .Sx "Command modifiers" ) , and manages the error number .Va \&! . This is a character set agnostic and thus locale dependent operation, and it may decode bytes which are invalid in the current .Va ttycharset . \*(ID This command does not know about URLs beside that. .Pp The first argument specifies the operation: .Ar e[ncode] or .Ar d[ecode] perform plain URL percent en- and decoding, respectively. .Ar p[ath]enc[ode] and .Ar p[ath]dec[ode] perform a slightly modified operation which should be better for pathnames: it does not allow a tilde .Ql ~ , and will neither accept hyphen-minus .Ql - nor dot .Ql . as an initial character. The remains of the line form the URL data which is to be converted. If the coding operation fails the error number .Va \&! is set to .Va ^ERR Ns -CANCELED , and the unmodified input is used as the result; the error number may change again due to output or result storage errors. .Mx .It Ic varshow \*(NQ This command produces the same output as the listing mode of .Ic set , including .Va verbose Ns ity adjustments, but only for the given variables. .Mx .It Ic verify \*(OP Takes a message list and verifies each message. If a message is not a S/MIME signed message, verification will fail for it. The verification process checks if the message was signed using a valid certificate, if the message sender's email address matches one of those contained within the certificate, and if the message content has been altered. .Mx .It Ic version Shows the .Va version and .Va features of \*(UA, optionally in a more .Va verbose form which also includes the build and running system environment. This command supports .Cm vput (see .Sx "Command modifiers" ) . .Mx .It Ic vexpr \*(NQ A multiplexer command which offers signed 64-bit numeric calculations, as well as other, mostly string-based operations. C-style byte string operations are available via .Ic csop . The first argument defines the number, type, and meaning of the remaining arguments. An empty number argument is treated as 0. Supports .Cm vput (see .Sx "Command modifiers" ) . The result shown in case of errors is .Ql -1 for usage errors and numeric operations, the empty string otherwise; .Dq soft errors, like when a search operation failed, will also set the .Va \&! error number to .Va ^ERR Ns -NODATA . Except when otherwise noted numeric arguments are parsed as signed 64-bit numbers, and errors will be reported in the error number .Va \&! as the numeric error .Va ^ERR Ns -RANGE . .Pp Numeric operations work on one or two signed 64-bit integers. Numbers prefixed with .Ql 0x or .Ql 0X are interpreted as hexadecimal (base 16) numbers, whereas .Ql 0 indicates octal (base 8), and .Ql 0b as well as .Ql 0B denote binary (base 2) numbers. It is possible to use any base in between 2 and 36, inclusive, with the .Ql BASE#number notation, where the base is given as an unsigned decimal number, e.g., .Ql 16#AFFE is a different way of specifying a hexadecimal number. Unsigned interpretation of a number can be enforced by prefixing an .Ql u (case-insensitively), e.g., .Ql u-110 ; this is not necessary for power-of-two bases (2, 4, 8, 16 and 32), which will be interpreted as unsigned by default, but it still makes a difference regarding overflow detection and overflow constant. It is possible to enforce signed interpretation by (instead) prefixing a .Ql s (case-insensitively). The number sign notation uses a permissive parse mode and as such supports complicated conditions out of the box: .Bd -literal -offset indent ? wysh set ifs=:;read i;unset ifs;echo $i;vexpr pb 2 10#$i -009 < -009> 0b1001 .Ed .Pp One integer is expected by assignment (equals sign .Ql = ) , which does nothing but parsing the argument, thus detecting validity and possible overflow conditions, unary not (tilde .Ql ~ ) , which creates the bitwise complement, and unary plus and minus. Two integers are used by addition (plus sign .Ql + ) , subtraction (hyphen-minus .Ql - ) , multiplication (asterisk .Ql * ) , division (solidus .Ql / ) and modulo (percent sign .Ql % ) , as well as for the bitwise operators logical or (vertical bar .Ql | , to be quoted) , bitwise and (ampersand .Ql \&& , to be quoted) , bitwise xor (circumflex .Ql ^ ) , the bitwise signed left- and right shifts .Pf ( Ql << , .Ql >> ) , as well as for the unsigned right shift .Ql >>> . .Pp Another numeric operation is .Cm pbase , which takes a number base in between 2 and 36, inclusive, and will act on the second number given just the same as what equals sign .Ql = does, but the number result will be formatted in the base given, as a signed 64-bit number unless unsigned interpretation of the input number had been forced (with an u prefix). .Pp Numeric operations support a saturated mode via the question mark .Ql \&? modifier suffix; the keyword .Ql saturated is optional, e.g., .Ql +? , .Ql +?satu , and .Ql +?saturated are identical. In saturated mode overflow errors and division and modulo by zero are no longer reported via the exit status, but the result will linger at the minimum or maximum possible value, instead of overflowing (or trapping). This is true also for the argument parse step. For the bitwise shifts, the saturated maximum is 63. Any caught overflow will be reported via the error number .Va \&! as .Va ^ERR Ns -OVERFLOW . .Bd -literal -offset indent ? vput vexpr res -? +1 -9223372036854775808 ? echo $?/$!/$^ERRNAME:$res 0/75/OVERFLOW:-9223372036854775808 .Ed .Pp Character set agnostic string functions have no notion of locale settings and character sets. .Bl -hang -width ".It Cm random" .It Cm file-expand Performs the usual .Sx "Filename transformations" on its argument. .It Cm file-stat , file-lstat Perform the usual .Sx "Filename transformations" on the argument, then call .Xr stat 2 and .Xr lstat 2 , respectively, in order to echo some stat fields such that .Ql vput vexpr v file-stat FILE; eval wysh set $v creates accessible variables. .It Cm random Generates a random string of the given length, or of .Dv \&\&PATH_MAX bytes (a constant from .Pa /usr/include ) if the value 0 is given; the random string will be base64url encoded according to RFC 4648, and thus be usable as a (portable) filename. .El .Pp String operations work, sufficient support provided, according to the active user's locale encoding and character set (see .Sx "Character sets" ) . Where the question mark .Ql \&? modifier suffix is supported, a case-insensitive operation mode is available; the keyword .Ql case is optional, e.g., .Ql regex? and .Ql regex?case are identical. .Bl -hang -width ".It Cm regex" .It Cm makeprint (One-way) Converts the argument to something safely printable on the terminal. .It Cm regex \*(OP A string operation that will try to match the first argument with the regular expression given as the second argument. .Ql \&? modifier suffix is supported. If the optional third argument has been given then instead of showing the match offset a replacement operation is performed: the third argument is treated as if specified within dollar-single-quote (see .Sx "Shell-style argument quoting" ) , and any occurrence of a positional parameter, e.g., .Va \&0 , 1 etc. is replaced with the according match group of the regular expression: .Bd -literal -offset indent ? vput vexpr res regex bananarama \e (.*)NanA(.*) '\e${1}au\e$2' ? echo $?/$!/$^ERRNAME:$res: 1/61/NODATA:: ? vput vexpr res regex?case bananarama \e (.*)NanA(.*) '\e${1}uauf\e$2' ? echo $?/$!/$^ERRNAME:$res: 0/0/NONE:baauf: .Ed .El .Mx .It Ic vpospar \*(NQ Manage the positional parameter stack (see .Va 1 , # , * , @ as well as .Ic shift ) . If the first argument is .Ql clear , then the positional parameter stack of the current context, or the global one, if there is none, is cleared. If it is .Ql set , then the remaining arguments will be used to (re)create the stack, if the parameter stack size limit is excessed an .Va ^ERR Ns -OVERFLOW error will occur. .Pp If the first argument is .Ql quote , a round-trip capable representation of the stack contents is created, with each quoted parameter separated from each other with the first character of .Va ifs , and followed by the first character of .Va if-ws , if that is not empty and not identical to the first. If that results in no separation at all a .Cm space character is used. This mode supports .Cm vput (see .Sx "Command modifiers" ) . I.e., the subcommands .Ql set and .Ql quote can be used (in conjunction with .Ic eval ) to (re)create an argument stack from and to a single variable losslessly. .Bd -literal -offset indent ? vpospar set hey, "'you ", world! ? echo $#: <${1}><${2}><${3}> ? vput vpospar x quote ? vpospar clear ? echo $#: <${1}><${2}><${3}> ? eval vpospar set ${x} ? echo $#: <${1}><${2}><${3}> .Ed .Mx .It Ic visual (v) Takes a message list and invokes the .Ev VISUAL display editor on each message. Modified contents are discarded unless the .Va writebackedited variable is set, and are not used unless the mailbox can be written to and the editor returns a successful exit status. .Ic edit can be used instead for a less display oriented editor. .Mx .It Ic write (w) For conventional messages the body without all headers is written. The original message is never marked for deletion in the originating mail folder. The output is decrypted and converted to its native format as necessary. If the output file exists, the text is appended. If a message is in MIME multipart format its first part is written to the specified file as for conventional messages, handling of the remains depends on the execution mode. No special handling of compressed files is performed. .Pp In interactive mode the user is consecutively asked for the filenames of the processed parts. For convience saving of each part may be skipped by giving an empty value, the same result as writing it to .Pa /dev/null . Shell piping the part content by specifying a leading vertical bar .Ql | character for the filename is supported. Other user input undergoes the usual .Sx "Filename transformations" , including shell pathname wildcard pattern expansions .Pf ( Xr glob 7 ) and shell variable expansion for the message as such, not the individual parts, and contents of the destination file are overwritten if the file previously existed. .Pp \*(ID In non-interactive mode any part which does not specify a filename is ignored, and suspicious parts of filenames of the remaining parts are URL percent encoded (as via .Ic urlcodec ) to prevent injection of malicious character sequences, resulting in a filename that will be written into the current directory. Existing files will not be overwritten, instead the part number or a dot are appended after a number sign .Ql # to the name until file creation succeeds (or fails due to other reasons). .Mx .It Ic xcall \*(NQ The sole difference to .Ic call is that the new macro is executed in place of the current one, which will not regain control: all resources of the current macro will be released first. This implies that any setting covered by .Ic localopts will be forgotten and covered variables will become cleaned up. If this command is not used from within a .Ic call Ns ed macro it will silently be (a more expensive variant of) .Ic call . .Mx .It Ic xit (x) A synonym for .Ic exit . .Mx .It Ic z \*(NQ \*(UA presents message headers in .Va screen Ns fuls as described under the .Ic headers command. Without arguments this command scrolls to the next window of messages, likewise if the argument is .Ql + . An argument of .Ql - scrolls to the last, .Ql ^ scrolls to the first, and .Ql $ to the last .Va \&\&screen of messages. A number argument prefixed by .Ql + or .Ql \- indicates that the window is calculated in relation to the current position, and a number without a prefix specifies an absolute position. .Mx .It Ic Z \*(NQ Similar to .Ic z , but scrolls to the next or previous window that contains at least one .Ql new or .Ic flag Ns ged message. .El .Sh "COMMAND ESCAPES" Command escapes are available in compose mode, and are used to perform special functions when composing messages. Command escapes are only recognized at the beginning of lines, and consist of a trigger (escape), and a command character. The actual escape character can be set via the internal variable .Va escape , it defaults to the tilde .Ql ~ . Otherwise ignored whitespace characters following the escape character will prevent a possible addition of the command line to the \*(OPal history. .Pp Unless otherwise noted all compose mode command escapes ensure proper updates of the variables which represent the error number .Va \&! and the exit status .Va \&? . If the variable .Va errexit is set they will, unless stated otherwise, error out message compose mode and cause a program exit if an operation fails; an effect equivalent to the command modifier .Cm ignerr can however be achieved by placing a hyphen-minus .Ql - after (possible whitespace following) the escape character. If the \*(OPal key bindings are available it is possible to create .Ic bind Ns ings specifically for the compose mode. .Bl -tag -width ".It Ic BaNg" .Mx .It Ic ~~ Ar string Insert the string of text in the message prefaced by a single .Ql ~ . (If the escape character has been changed, that character must be doubled instead.) .Mx .It Ic ~! Ar command Execute the indicated shell .Ar command which follows, replacing unescaped exclamation marks with the previously executed command if the internal variable .Va bang is set, then return to the message. .Mx .It Ic ~. End compose mode and send the message. The hooks .Va on-compose-splice-shell and .Va on-compose-splice , in order, will be called when set, after which, in interactive mode .Va askatend (leading to .Va askcc , askbcc ) and .Va askattach will be checked as well as .Va asksend , after which a set .Va on-compose-leave hook will be called, .Va autocc and .Va autobcc will be joined in if set, finally a given .Va message-inject-tail will be incorporated, after which the compose mode is left. .Mx .It Ic ~: Ar \*(UA-command Ns \0or Ic ~_ Ar \*(UA-command Execute the given \*(UA command. Not all commands, however, are allowed. .Mx .It Ic ~< Ar filename Identical to .Ic ~r . .Mx .It Ic ~ . Non-network addresses use the first field to indicate the type (hyphen-minus .Ql - for files, vertical bar .Ql | for pipes, and number sign .Ql # for names which will undergo .Ic alias processing) instead, the actual value will be in the second field. .It Ql 212 Status ok; the rest of the line is optionally used for more status. What follows are lines of furtherly unspecified string content, terminated by an empty line. All the input, including the empty line, must be consumed before further commands can be issued. .It Ql 500 Syntax error; invalid command. .It Ql 501 Syntax error in parameters or arguments. .It Ql 505 Error: an argument fails verification. For example an invalid address has been specified (also see .Va expandaddr ) , or an attempt was made to modify anything in \*(UA's own namespace, or a modifying subcommand has been used on a read-only message. .It Ql 506 Error: an otherwise valid argument is rendered invalid due to context. For example, a second address is added to a header which may consist of a single address only. .El .Pp If a command indicates failure then the message will have remained unmodified. Most commands can fail with .Ql 500 if required arguments are missing (false command usage). The following (case-insensitive) commands are supported: .Bl -hang -width ".It Cm version" .It Cm version This command will print the protocol version via 210. .It Cm header This command allows listing, inspection, and editing of message headers. Header name case is not normalized, and case-insensitive comparison should be used when matching names. The second argument specifies the subcommand to apply, one of: .Bl -hang -width ".It Cm remove" .It Cm list Without a third argument a list of all yet existing headers is given via .Ql 210 ; this command is the default command of .Cm header if no second argument has been given. A third argument restricts output to the given header only, which may fail with .Ql 501 if no such field is defined. .It Cm show Shows the content of the header given as the third argument. Dependent on the header type this may respond with .Ql 211 or .Ql 212 ; any failure results in .Ql 501 . .It Cm remove This will remove all instances of the header given as the third argument, reporting .Ql 210 upon success, .Ql 501 if no such header can be found, and .Ql 505 on \*(UA namespace violations. .It Cm remove-at This will remove from the header given as the third argument the instance at the list position (counting from one!) given with the fourth argument, reporting .Ql 210 upon success or .Ql 505 if the list position argument is not a number or on \*(UA namespace violations, and .Ql 501 if no such header instance exists. .It Cm insert Create a new or an additional instance of the header given in the third argument, with the header body content as given in the fourth argument (the remains of the line). It may return .Ql 501 if the third argument specifies a free-form header field name that is invalid, or if body content extraction fails to succeed, .Ql 505 if any extracted address does not pass syntax and/or security checks or on \*(UA namespace violations, and .Ql 506 to indicate prevention of excessing a single-instance header \(em note that .Ql Subject: can be appended to (a space separator will be added automatically first). .Ql To: , .Ql Cc: or .Ql Bcc: support the .Ql ?single modifier to enforce treatment as a single addressee, e.g., .Ql header insert To?single: exa, ; the word .Ql single is optional. .Pp .Ql 210 is returned upon success, followed by the name of the header and the list position of the newly inserted instance. The list position is always 1 for single-instance header fields. All free-form header fields are managed in a single list. .El .Pp In compose-mode read-only access to optional pseudo headers in the \*(UA private namespace is available: .Pp .Bl -tag -compact -width ".It Va BaNg" .It Ql Mailx-Command: The name of the command that generates the message, one of .Ql forward , .Ql Lreply , .Ql mail , .Ql Reply , .Ql reply , .Ql resend . This pseudo header always exists (in compose-mode). .It Ql Mailx-Raw-To: .It Ql Mailx-Raw-Cc: .It Ql Mailx-Raw-Bcc: Represent the frozen initial state of these headers before any transformation (e.g., .Ic alias , .Ic alternates , .Va recipients-in-cc etc.) took place. .It Ql Mailx-Orig-From: .It Ql Mailx-Orig-To: .It Ql Mailx-Orig-Cc: .It Ql Mailx-Orig-Bcc: The values of said headers of the original message which has been addressed by any of .Ic reply , forward , resend . .El .It Cm attachment This command allows listing, removal and addition of message attachments. The second argument specifies the subcommand to apply, one of: .Bl -hang -width ".It Cm remove" .It Cm list List all attachments via .Ql 212 , or report .Ql 501 if no attachments exist. This command is the default command of .Cm attachment if no second argument has been given. .It Cm remove This will remove the attachment given as the third argument, and report .Ql 210 upon success or .Ql 501 if no such attachment can be found. If there exists any path component in the given argument, then an exact match of the path which has been used to create the attachment is used directly, but if only the basename of that path matches then all attachments are traversed to find an exact match first, and the removal occurs afterwards; if multiple basenames match, a .Ql 506 error occurs. Message attachments are treated as absolute pathnames. .Pp If no path component exists in the given argument, then all attachments will be searched for .Ql filename= parameter matches as well as for matches of the basename of the path which has been used when the attachment has been created; multiple matches result in a .Ql 506 . .It Cm remove-at This will interpret the third argument as a number and remove the attachment at that list position (counting from one!), reporting .Ql 210 upon success or .Ql 505 if the argument is not a number or .Ql 501 if no such attachment exists. .It Cm insert Adds the attachment given as the third argument, specified exactly as documented for the command line option .Fl a , and supporting the message number extension as documented for .Ic ~@ . This reports .Ql 210 upon success, with the index of the new attachment following, .Ql 505 if the given file cannot be opened, .Ql 506 if an on-the-fly performed character set conversion fails, otherwise .Ql 501 is reported; this is also reported if character set conversion is requested but not available. .It Cm attribute This uses the same search mechanism as described for .Cm remove and prints any known attributes of the first found attachment via .Ql 212 upon success or .Ql 501 if no such attachment can be found. The attributes are written as lines of keyword and value tuples, the keyword being separated from the rest of the line with an ASCII SP space character. .It Cm attribute-at This uses the same search mechanism as described for .Cm remove-at and is otherwise identical to .Cm attribute . .It Cm attribute-set This uses the same search mechanism as described for .Cm remove , and will assign the attribute given as the fourth argument, which is expected to be a value tuple of keyword and other data, separated by a ASCII SP space or TAB tabulator character. If the value part is empty, then the given attribute is removed, or reset to a default value if existence of the attribute is crucial. .Pp It returns via .Ql 210 upon success, with the index of the found attachment following, .Ql 505 for message attachments or if the given keyword is invalid, and .Ql 501 if no such attachment can be found. The following keywords may be used (case-insensitively): .Pp .Bl -hang -compact -width ".It Ql filename" .It Ql filename Sets the filename of the MIME part, i.e., the name that is used for display and when (suggesting a name for) saving (purposes). .It Ql content-description Associate some descriptive information to the attachment's content, used in favour of the plain filename by some MUAs. .It Ql content-id May be used for uniquely identifying MIME entities in several contexts; this expects a special reference address format as defined in RFC 2045 and generates a .Ql 505 upon address content verification failure. .It Ql content-type Defines the media type/subtype of the part, which is managed automatically, but can be overwritten. .It Ql content-disposition Automatically set to the string .Ql attachment . .El .It Cm attribute-set-at This uses the same search mechanism as described for .Cm remove-at and is otherwise identical to .Cm attribute-set . .El .El .Mx .It Ic ~A The same as .Ql Ic ~i Ns \| Va Sign . .Mx .It Ic ~a The same as .Ql Ic ~i Ns \| Va sign . .Mx .It Ic ~b Ar name ... Add the given names to the list of blind carbon copy recipients. .Mx .It Ic ~c Ar name ... Add the given names to the list of carbon copy recipients. .Mx .It Ic ~d Read the file specified by the .Ev DEAD variable into the message. .Mx .It Ic ~e Invoke the text .Ev EDITOR on the message collected so far, then return to compose mode. .Ic ~v can be used for a more display oriented editor, and .Ic ~| Ns | offers a pipe-based editing approach. .Mx .It Ic ~F Ar messages Read the named messages into the message being sent, including all message headers and MIME parts. If no messages are specified, read in the current message, the .Dq dot . .Mx .It Ic ~f Ar messages Read the named messages into the message being sent. If no messages are specified, read in the current message, the .Dq dot . Strips down the list of header fields according to the .Ql type white- and blacklist selection of .Ic headerpick . For MIME multipart messages, only the first displayable part is included. .Mx .It Ic ~H Edit the message header fields .Ql From: , .Ql Reply-To: and .Ql Sender: by typing each one in turn and allowing the user to edit the field. The default values for these fields originate from the .Va from , reply-to and .Va sender variables. .Mx .It Ic ~h Edit the message header fields .Ql To: , .Ql Cc: , .Ql Bcc: and .Ql Subject: by typing each one in turn and allowing the user to edit the field. .Mx .It Ic ~I Ar variable Insert the value of the specified variable into the message. The message remains unaltered if the variable is unset or empty. Any embedded character sequences .Ql \et horizontal tabulator and .Ql \en line feed are expanded in .Va posix mode; otherwise the expansion should occur at .Ic set time (\*(ID by using the command modifier .Va wysh ) . .Mx .It Ic ~i Ar variable Like .Ic ~I , but appends a newline character. .Mx .It Ic ~M Ar messages Read the named messages into the message being sent, indented by .Va indentprefix . If no messages are specified, read the current message, the .Dq dot . .Mx .It Ic ~m Ar messages Read the named messages into the message being sent, indented by .Va indentprefix . If no messages are specified, read the current message, the .Dq dot . Strips down the list of header fields according to the .Ql type white- and blacklist selection of .Ic headerpick . For MIME multipart messages, only the first displayable part is included. .Mx .It Ic ~p Display the message collected so far, prefaced by the message header fields and followed by the attachment list, if any. .Mx .It Ic ~Q Read in the given / current message(s) according to the algorithm of .Va quote . .Mx .It Ic ~q Abort the message being sent, copying it to the file specified by the .Ev DEAD variable if .Va save is set. .Mx .It Ic ~R Ar filename Identical to .Ic ~r , but indent each line that has been read by .Va indentprefix . .Mx .It Ic ~r Ar filename Op Ar HERE-delimiter Read the named file, object to the usual .Sx "Filename transformations" , into the message; if (the expanded) .Ar filename is the hyphen-minus .Ql - then standard input is used, e.g., for pasting purposes. Only in this latter mode .Ar HERE-delimiter may be given: if it is data will be read in until the given .Ar HERE-delimiter is seen on a line by itself, and encountering EOF is an error; the .Ar HERE-delimiter is a required argument in non-interactive mode; if it is single-quote quoted then the pasted content will not be expanded, \*(ID otherwise a future version of \*(UA may perform shell-style expansion on the content. .Mx .It Ic ~s Ar string Cause the named string to become the current subject field. Newline (NL) and carriage-return (CR) bytes are invalid and will be normalized to space (SP) characters. .Mx .It Ic ~t Ar name ... Add the given name(s) to the direct recipient list. .Mx .It Ic ~U Ar messages Read in the given / current message(s) excluding all headers, indented by .Va indentprefix . .Mx .It Ic ~u Ar messages Read in the given / current message(s), excluding all headers. .Mx .It Ic ~v Invoke the .Ev VISUAL editor on the message collected so far, then return to compose mode. .Ic ~e can be used for a less display oriented editor, and .Ic ~| Ns | offers a pipe-based editing approach. .Mx .It Ic ~w Ar filename Write the message onto the named file, which is object to the usual .Sx "Filename transformations" . If the file exists, the message is appended to it. .Mx .It Ic ~x Same as .Ic ~q , except that the message is not saved at all. .El .Sh "INTERNAL VARIABLES" Internal \*(UA variables are controlled via the .Ic set and .Ic unset commands; prefixing a variable name with the string .Ql no and calling .Ic set has the same effect as using .Ic unset : .Ql unset crt and .Ql set nocrt do the same thing. .Ic varshow will give more insight on the given variable(s), and .Ic set , when called without arguments, will show a listing of all variables. Both commands support a more .Va verbose listing mode. Some well-known variables will also become inherited from the program .Sx ENVIRONMENT implicitly, others can be imported explicitly with the command .Ic environ and henceforth share said properties. .Pp Two different kinds of internal variables exist, and both of which can also form chains. There are boolean variables, which can only be in one of the two states .Dq set and .Dq unset , and value variables with a(n optional) string value. For the latter proper quoting is necessary upon assignment time, the introduction of the section .Sx COMMANDS documents the supported quoting rules. .Bd -literal -offset indent ? wysh set one=val\e 1 two="val 2" \e three='val "3"' four=$'val \e'4\e''; \e varshow one two three four; \e unset one two three four .Ed .Pp Dependent upon the actual option string values may become interpreted as colour names, command specifications, normal text, etc. They may be treated as numbers, in which case decimal values are expected if so documented, but otherwise any numeric format and base that is valid and understood by the .Ic vexpr command may be used, too. .Pp There also exists a special kind of string value, the .Dq boolean string , which must either be a decimal integer (in which case .Ql 0 is false and .Ql 1 and any other value is true) or any of the (case-insensitive) strings .Ql off , .Ql no , .Ql n and .Ql false for a false boolean and .Ql on , .Ql yes , .Ql y and .Ql true for a true boolean; a special kind of boolean string is the .Dq quadoption , which is a boolean string that can optionally be prefixed with the (case-insensitive) term .Ql ask- , as in .Ql ask-yes , which causes prompting of the user in interactive mode, with the given boolean as the default value. .Pp Variable chains extend a plain .Ql variable with .Ql variable-HOST and .Ql variable-USER@HOST variants. Here .Ql HOST will be converted to all lowercase when looked up (but not when the variable is set or unset!), \*(OPally IDNA converted, and indeed means .Ql server:port if a .Ql port had been specified in the contextual Uniform Resource Locator URL, see .Sx "On URL syntax and credential lookup" . Even though this mechanism is based on URLs no URL percent encoding may be applied to neither of .Ql USER nor .Ql HOST , variable chains need to be specified using raw data; the mentioned section contains examples. Variables which support chains are explicitly documented as such, and \*(UA treats the base name of any such variable special, meaning that users should not create custom names like .Ql variable-xyz in order to avoid false classifications and treatment of such variables. .Ss "Initial settings" The standard POSIX 2008/Cor 2-2016 mandates the following initial variable settings: .Pf no Va allnet , .Pf no Va append , .Va asksub , .Pf no Va askbcc , .Pf no Va autoprint , .Pf no Va bang , .Pf no Va cmd , .Pf no Va crt , .Pf no Va debug , .Pf no Va dot , .Va escape set to .Ql ~ , .Pf no Va flipr , .Pf no Va folder , .Va header , .Pf no Va hold , .Pf no Va ignore , .Pf no Va ignoreeof , .Pf no Va keep , .Pf no Va keepsave , .Pf no Va metoo , .Pf no Va outfolder , .Pf no Va page , .Va prompt set to .Ql \&?\0 , .Pf no Va quiet , .Pf no Va record , .Va save , .Pf no Va sendwait , .Pf no Va showto , .Pf no Va Sign , .Pf no Va sign , .Va toplines set to .Ql 5 . .Pp Notes: \*(UA does not support the .Pf no Va onehop variable \(en use command line options or .Va mta-arguments to pass options through to a .Va mta . And the default global .Pa \*(UR file, which is loaded unless the .Fl \&: (with according argument) or .Fl n command line options have been used, or the .Ev MAILX_NO_SYSTEM_RC environment variable is set (see .Sx "Resource files" ) bends those initial settings a bit, e.g., it sets the variables .Va hold , .Va keepsave and .Va keep , to name a few, establishes a default .Ic headerpick selection etc., and should thus be taken into account. .Ss "Variables" .Bl -tag -width ".It Va BaNg" .Mx .It Va \&? \*(RO The exit status of the last command, or the .Ic return value of the macro .Ic call Ns ed last. This status has a meaning in the state machine: in conjunction with .Va errexit any non-0 exit status will cause a program exit, and in .Va posix mode any error while loading (any of the) resource files will have the same effect. .Cm ignerr , one of the .Sx "Command modifiers" , can be used to instruct the state machine to ignore errors. .Mx .It Va \&! \*(RO The current error number .Pf ( Xr errno 3 ) , which is set after an error occurred; it is also available via .Va ^ERR , and the error name and documentation string can be queried via .Va ^ERRNAME and .Va ^ERRDOC . \*(ID This machinery is new and the error number is only really usable if a command explicitly states that it manages the variable .Va \&! , for others errno will be used in case of errors, or .Va ^ERR Ns -INVAL if that is 0: it thus may or may not reflect the real error. The error number may be set with the command .Ic return . .Mx .It Va ^ \*(RO This is a multiplexer variable which performs dynamic expansion of the requested state or condition, of which there are: .Pp .Bl -tag -compact -width ".It Va BaNg" .Mx .Mx .Mx .It Va ^ERR , ^ERRDOC , ^ERRNAME The number, documentation, and name of the current .Xr errno 3 , respectively, which is usually set after an error occurred. The documentation is an \*(OP, the name is used if not available. \*(ID This machinery is new and is usually reliable only if a command explicitly states that it manages the variable .Va \&! , which is effectively identical to .Va \&\&^ERR . Each of those variables can be suffixed with a hyphen minus followed by a name or number, in which case the expansion refers to the given error. Note this is a direct mapping of (a subset of) the system error values: .Bd -literal -offset indent define work { eval echo \e$1: \e$^ERR-$1:\e \e$^ERRNAME-$1: \e$^ERRDOC-$1 vput vexpr i + "$1" 1 if [ $i -lt 16 ] \excall work $i end } call work 0 .Ed .Mx .Mx .It Va ^ERRQUEUE-COUNT , ^ERRQUEUE-EXISTS The number of messages present in the \*(OPal log queue of .Ic errors , and a boolean which indicates whether the queue is not empty, respectively; both are always 0 unless .Va features indicates .Ql +errors . .El .Mx .It Va * \*(RO Expands all positional parameters (see .Va 1 ) , separated by the first character of the value of .Va ifs . \*(ID The special semantics of the equally named special parameter of the .Xr sh 1 are not yet supported. .Mx .It Va @ \*(RO Expands all positional parameters (see .Va 1 ) , separated by a space character. If placed in double quotation marks, each positional parameter is properly quoted to expand to a single parameter again. .Mx .It Va # \*(RO Expands to the number of positional parameters, i.e., the size of the positional parameter stack in decimal. .Mx .It Va \&0 \*(RO Inside the scope of a .Ic define Ns d and .Ic call Ns ed macro this expands to the name of the calling macro, or to the empty string if the macro is running from top-level. For the \*(OPal regular expression search and replace operator of .Ic vexpr this expands to the entire matching expression. It represents the program name in global context. .Mx .It Va 1 \*(RO Access of the positional parameter stack. All further parameters can be accessed with this syntax, too, e.g., .Ql 2 , .Ql 3 etc.; positional parameters can be shifted off the stack by calling .Ic shift . The parameter stack contains, e.g., the arguments of a .Ic call Ns ed .Ic define Ns d macro, the matching groups of the \*(OPal regular expression search and replace expression of .Ic vexpr , and can be explicitly created or overwritten with the command .Ic vpospar . .Mx .It Va account \*(RO Is set to the active .Ic account . .Mx .It Va add-file-recipients \*(BO When file or pipe recipients have been specified, mention them in the corresponding address fields of the message instead of silently stripping them from their recipient list. By default such addressees are not mentioned. .Mx .It Va allnet \*(BO Causes only the local part to be evaluated when comparing addresses. .Mx .It Va append \*(BO Causes messages saved in the .Mx -sx .Sx "secondary mailbox" .Ev MBOX to be appended to the end rather than prepended. This should always be set. .Mx .It Va askatend \*(BO Causes the prompts for .Ql Cc: and .Ql Bcc: lists to appear after the message has been edited. .Mx .It Va askattach \*(BO If set, \*(UA asks an interactive user for files to attach at the end of each message; An empty line finalizes the list. .Mx .It Va askcc \*(BO Causes the interactive user to be prompted for carbon copy recipients (at the end of each message if .Va askatend or .Va bsdcompat are set). .Mx .It Va askbcc \*(BO Causes the interactive user to be prompted for blind carbon copy recipients (at the end of each message if .Va askatend or .Va bsdcompat are set). .Mx .It Va asksend \*(BO Causes the interactive user to be prompted for confirmation to send the message or reenter compose mode after having been shown an envelope summary. This is by default enabled. .Mx .It Va asksign \*(BO\*(OP Causes the interactive user to be prompted if the message is to be signed at the end of each message. The .Va smime-sign variable is ignored when this variable is set. .Mx .It Va asksub \*(BO Causes \*(UA to prompt the interactive user for the subject upon entering compose mode unless a subject already exists. .Mx .It Va attrlist A sequence of characters to display in the .Ql attribute column of the .Va headline as shown in the display of .Ic headers ; each for one type of messages (see .Sx "Message states" ) , with the default being .Ql NUROSPMFAT+\-$~ or .Ql NU\ \ *HMFAT+\-$~ if the .Va bsdflags variable is set, in the following order: .Pp .Bl -tag -compact -width ".It Ql _" .It Ql N new. .It Ql U unread but old. .It Ql R new but read. .It Ql O read and old. .It Ql S saved. .It Ql P preserved. .It Ql M mboxed. .It Ql F flagged. .It Ql A answered. .It Ql T draft. .It Ql + \*(ID start of a (collapsed) thread in threaded mode (see .Va autosort , .Ic thread ) ; .It Ql - \*(ID an uncollapsed thread in threaded mode; only used in conjunction with .Fl L . .It Ql $ classified as spam. .It Ql ~ classified as possible spam. .El .Mx .It Va autobcc Specifies a list of recipients to which a blind carbon copy of each outgoing message will be sent automatically. .Mx .It Va autocc Specifies a list of recipients to which a carbon copy of each outgoing message will be sent automatically. .Mx .It Va autocollapse \*(BO Causes threads to be collapsed automatically when .Ql thread Ns ed .Ic sort mode is entered (see the .Ic collapse command). .Mx .It Va autoprint \*(BO Enable automatic .Ic type Ns ing of a(n existing) .Dq successive message after .Ic delete and .Ic undelete commands, e.g., the message that becomes the new .Dq dot is shown automatically, as via .Ic dp or .Ic dt . .Mx .It Va autosort Causes sorted mode (see the .Ic sort command) to be entered automatically with the value of this variable as sorting method when a folder is opened, e.g., .Ql set autosort=thread . .Mx .It Va bang \*(BO Enables the substitution of all not (reverse-solidus) escaped exclamation mark .Ql \&! characters by the contents of the last executed command for the .Ic \&! shell escape command and .Ic ~! , one of the compose mode .Sx "COMMAND ESCAPES" . If this variable is not set no reverse solidus stripping is performed. .Mx .It Va bind-timeout \*(OP Terminals generate multi-byte sequences for certain forms of input, for example for function and other special keys. Some terminals however do not write these multi-byte sequences as a whole, but byte-by-byte, and the latter is what \*(UA actually reads. This variable specifies the timeout in milliseconds that the MLE (see .Sx "On terminal control and line editor" ) waits for more bytes to arrive unless it considers a sequence .Dq complete . The default is 200. .Mx .It Va bsdcompat \*(BO Sets some cosmetical features to traditional BSD style; has the same affect as setting .Va askatend and all other variables prefixed with .Ql bsd ; it also changes the behaviour of .Va emptystart (which does not exist in BSD). .Mx .It Va bsdflags \*(BO Changes the letters shown in the first column of a header summary to traditional BSD style. .Mx .It Va bsdheadline \*(BO Changes the display of columns in a header summary to traditional BSD style. .Mx .It Va bsdmsgs \*(BO Changes some informational messages to traditional BSD style. .Mx .It Va bsdorder \*(BO Causes the .Ql Subject: field to appear immediately after the .Ql To: field in message headers and with the .Ic ~h .Sx "COMMAND ESCAPES" . .Mx .Mx .Mx .Mx .It Va build-cc , build-ld , build-os , build-rest \*(RO The build environment, including the compiler, the linker, the operating system \*(UA has been build for, usually taken from .Xr uname 1 via .Ql uname -s , and then lowercased, as well as all the possibly interesting rest of the configuration and build environment. This information is also available in the .Va verbose output of the command .Ic version . .Mx .It Va charset-7bit The value that should appear in the .Ql charset= parameter of .Ql Content-Type: MIME header fields when no character set conversion of the message data was performed. This defaults to US-ASCII, and the chosen character set should be US-ASCII compatible. .Mx .It Va charset-8bit \*(OP The default 8-bit character set that is used as an implicit last member of the variable .Va sendcharsets . This defaults to UTF-8 if character set conversion capabilities are available, and to ISO-8859-1 otherwise (unless the operating system environment is known to always and exclusively support UTF-8 locales), in which case the only supported character set is .Va ttycharset and this variable is effectively ignored. .Mx .It Va charset-unknown-8bit \*(OP RFC 1428 specifies conditions when internet mail gateways shall .Dq upgrade the content of a mail message by using a character set with the name .Ql unknown-8bit . Because of the unclassified nature of this character set \*(UA will not be capable to convert this character set to any other character set. If this variable is set any message part which uses the character set .Ql unknown-8bit is assumed to really be in the character set given in the value, otherwise the (final) value of .Va charset-8bit is used for this purpose. .Pp This variable will also be taken into account if a MIME type (see .Sx "The mime.types files" ) of a MIME message part that uses the .Ql binary character set is forcefully treated as text. .Mx .It Va cmd The default value for the .Ic pipe command. .Mx .It Va colour-disable \*(BO\*(OP Forcefully disable usage of colours. Also see the section .Sx "Coloured display" . .Mx .It Va colour-pager \*(BO\*(OP Whether colour shall be used for output that is paged through .Ev PAGER . Note that pagers may need special command line options, e.g., .Xr less 1 requires the option .Fl \&\&R and .Xr lv 1 the option .Fl \&\&c in order to support colours. Often doing manual adjustments is unnecessary since \*(UA may perform adjustments dependent on the value of the environment variable .Ev PAGER (see there for more). .Mx .Mx .It Va contact-mail , contact-web \*(RO Addresses for contact per email and web, respectively, e.g., for bug reports, suggestions, or help regarding \*(UA. The former can be used directly: .Ql \&? Ns \| Ic eval Ns \| Ic mail Ns \| $contact-mail . .Mx .It Va crt In a(n interactive) terminal session, then if this valued variable is set it will be used as a threshold to determine how many lines the given output has to span before it will be displayed via the configured .Ev PAGER ; Usage of the .Ev PAGER can be forced by setting this to the value .Ql 0 , setting it without a value will deduce the current height of the terminal screen to compute the threshold (see .Ev LINES , .Va screen and .Xr stty 1 ) . \*(ID At the moment this uses the count of lines of the message in wire format, which, dependent on the .Va mime-encoding of the message, is unrelated to the number of display lines. (The software is old and historically the relation was a given thing.) .Mx .It Va customhdr Define a set of custom headers to be injected into newly composed or forwarded messages. A custom header consists of the field name followed by a colon .Ql \&: and the field content body. Standard header field names cannot be overwritten by a custom header. Different to the command line option .Fl C the variable value is interpreted as a comma-separated list of custom headers: to include commas in header bodies they need to become escaped with reverse solidus .Ql \e . Headers can be managed more freely in compose mode via .Ic ~^ . .Pp .Dl ? set customhdr='Hdr1: Body1-1\e, Body1-2, Hdr2: Body2' .Mx .It Va datefield Controls the appearance of the .Ql %d date and time format specification of the .Va headline variable, that is used, for example, when viewing the summary of .Ic headers . If unset, then the local receiving date is used and displayed unformatted, otherwise the message sending .Ql Date: . It is possible to assign a .Xr strftime 3 format string and control formatting, but embedding newlines via the .Ql %n format is not supported, and will result in display errors. The default is .Ql %Y-%m-%d %H:%M , and also see .Va datefield-markout-older . .Mx .It Va datefield-markout-older Only used in conjunction with .Va datefield . Can be used to create a visible distinction of messages dated more than a day in the future, or older than six months, a concept comparable to the .Fl \&\&l option of the POSIX utility .Xr ls 1 . If set to the empty string, then the plain month, day and year of the .Ql Date: will be displayed, but a .Xr strftime 3 format string to control formatting can be assigned. The default is .Ql %Y-%m-%d . .Mx .It Va debug \*(BO Enables debug messages and obsoletion warnings, disables the actual delivery of messages and also implies .Pf no Va record as well as .Pf no Va save . .Mx .It Va disposition-notification-send \*(BO\*(OP Emit a .Ql Disposition-Notification-To: header (RFC 3798) with the message. This requires the .Va from variable to be set. .Mx .It Va dot \*(BO When dot is set, a period .Ql \&. on a line by itself during message input in (interactive or batch .Fl # ) compose mode will be treated as end-of-message (in addition to the normal end-of-file condition). This behaviour is implied in .Va posix mode with a set .Va ignoreeof . .Mx .It Va dotlock-disable \*(BO\*(OP Disable creation of .Mx -sx .Sx "dotlock files" for MBOX databases. .It Va dotlock-ignore-error \*(OB\*(BO\*(OP Ignore failures when creating .Mx -sx .Sx "dotlock files" . Please use .Va dotlock-disable instead. .Mx .It Va editalong If this variable is set then the editor is started automatically when a message is composed in interactive mode. If the value starts with the letter .Ql v then this acts as if .Ic ~v , otherwise as if .Ic ~e .Pf (see\0 Sx "COMMAND ESCAPES" ) had been specified. The .Va editheaders variable is implied for this automatically spawned editor session. .Mx .It Va editheaders \*(BO When a message is edited while being composed, its header is included in the editable text. .Mx .It Va emptystart \*(BO When entering interactive mode \*(UA normally writes .Dq \&No mail for user and exits immediately if a mailbox is empty or does not exist. If this variable is set \*(UA starts even with an empty or non-existent mailbox (the latter behaviour furtherly depends upon .Va bsdcompat , though). .Mx .It Va errexit \*(BO Let each command with a non-0 exit status, including every .Ic call Ns ed macro which .Ic return Ns s a non-0 status, cause a program exit unless prefixed by .Cm ignerr (see .Sx "Command modifiers" ) . This also affects .Sx "COMMAND ESCAPES" , but which use a different modifier for ignoring the error. Please refer to the variable .Va \&? for more on this topic. .Mx .It Va escape The first character of this value defines the escape character for .Sx "COMMAND ESCAPES" in compose mode. The default value is the character tilde .Ql ~ . If set to the empty string, command escapes are disabled. .Mx .It Va expandaddr If unset then file and command pipeline address targets are not allowed, and any such address will be filtered out, giving a warning message. If set then all possible recipient address specifications will be accepted, unless the optional value is more specific (also see .Sx "On sending mail, and non-interactive mode" ) . If the value contains .Ql restrict then behaviour equals the former unless in interactive mode, or when tilde commands were enabled explicitly via .Fl ~ or .Fl # , in which case it equals the latter, and thus allows all addressees. .Ql restrict really acts like .Ql restrict,\:-all,\:+name,\:+addr , so care for ordering issues must be taken. .Pp Indeed the value is interpreted as a comma-separated list of case-insensitive strings. Presence of forbidden address types is treated as a hard send error instead of only causing them to be filtered out if the list contains .Ql fail . Address targets can be added and subtracted with a plus sign .Ql + or hyphen-minus .Ql - prefix: the value .Ql all addresses all possible address specifications, .Ql fcc whitelists targets specified via .Ql Fcc: headers regardless of other settings, .Ql file file targets (it includes .Ql fcc ) , .Ql pipe command pipeline targets, .Ql name plain user names and (MTA) aliases and .Ql addr network addresses; Targets are interpreted in the given order, so that .Ql restrict,\:fail,\:+file,\:-all,\:+addr will cause hard errors for any non-network address recipient address unless running interactively or having been started with the option .Fl ~ or .Fl # ; in the latter case(s) any address may be used, then. .Pp Historically invalid network addressees were silently stripped off \(em shall they cause hard errors instead it must be ensured that .Ql failinvaddr is an entry of the list (it really acts like .Ql failinvaddr,\:+addr ) . Likewise, .Ql domaincheck .Pf (actually\0\: Ql domaincheck,\:+addr ) compares address domain names against a whitelist and strips off .Pf ( Ql fail for hard errors) addressees which fail this test; the domain name .Ql localhost and the non-empty value of .Va hostname (the real hostname otherwise) are always whitelisted, .Va expandaddr-domaincheck can be set to extend this list. Finally some address providers (for example .Fl b , c and all other command line recipients) will be evaluated as if specified within dollar-single-quotes (see .Sx "Shell-style argument quoting" ) if the value list contains the string .Ql shquote . .Mx .It Va expandaddr-domaincheck Can be set to a comma-separated list of domain names which should be whitelisted for the evaluation of the .Ql domaincheck mode of .Va expandaddr . IDNA encoding is not automatically performed, .Ic addrcodec can be used to prepare the domain (of an address). .Mx .It Va expandargv Unless this variable is set additional .Va mta (Mail-Transfer-Agent) arguments from the command line, as can be given after a .Fl \&\&- separator, results in a program termination with failure status. The same can be accomplished by using the special (case-insensitive) value .Ql fail . A lesser strict variant is the otherwise identical .Ql restrict , which does accept such arguments in interactive mode, or if tilde commands were enabled explicitly by using one of the command line options .Fl ~ or .Fl # . The empty value will allow unconditional usage. .Mx .It Va features \*(RO String giving a list of optional features. Features are preceded with a plus sign .Ql + if they are available, with a hyphen-minus .Ql - otherwise. The output of the command .Ic version will include this information in a more pleasant output. .Mx .It Va flipr \*(BO This setting reverses the meanings of a set of reply commands, turning the lowercase variants, which by default address all recipients included in the header of a message .Pf ( Ic reply , respond , followup ) into the uppercase variants, which by default address the sender only .Pf ( Ic Reply , Respond , Followup ) and vice versa. The commands .Ic replysender , respondsender , followupsender as well as .Ic replyall , respondall , followupall are not affected by the current setting of .Va flipr . .Mx .It Va folder The default path under which mailboxes are to be saved: filenames that begin with the plus sign .Ql + will have the plus sign replaced with the value of this variable if set, otherwise the plus sign will remain unchanged when doing .Sx "Filename transformations" ; also see .Ic file for more on this topic, and know about standard imposed implications of .Va outfolder . The value supports a subset of transformations itself, and if the non-empty value does not start with a solidus .Ql / , then the value of .Ev HOME will be prefixed automatically. Once the actual value is evaluated first, the internal variable .Va folder-resolved will be updated for caching purposes. .Mx Va folder-hook .It Va folder-hook-FOLDER , Va folder-hook Names a .Ic define Ns d macro which will be called whenever a .Ic file is opened. The macro will also be invoked when new mail arrives, but message lists for commands executed from the macro only include newly arrived messages then. .Ic localopts are activated by default in a folder hook, causing the covered settings to be reverted once the folder is left again. .Pp The specialized form will override the generic one if .Ql FOLDER matches the file that is opened. Unlike other folder specifications, the fully expanded name of a folder, without metacharacters, is used to avoid ambiguities. However, if the mailbox resides under .Va folder then the usual .Ql + specification is tried in addition, e.g., if .Va \&\&folder is .Dq mail (and thus relative to the user's home directory) then .Pa /home/usr1/mail/sent will be tried as .Ql folder-hook-/home/usr1/mail/sent first, but then followed by .Ql folder-hook-+sent . .Mx .It Va folder-resolved \*(RO Set to the fully resolved path of .Va folder once that evaluation has occurred; rather internal. .Mx .It Va followup-to \*(BO Controls whether a .Ql Mail-Followup-To: header is generated when sending messages to known mailing lists. Also see .Va followup-to-honour and the commands .Ic mlist , mlsubscribe , reply and .Ic Lreply . .Mx .It Va followup-to-honour Controls whether a .Ql Mail-Followup-To: header is honoured when group-replying to a message via .Ic reply or .Ic Lreply . This is a quadoption; if set without a value it defaults to .Dq yes . Also see .Va followup-to and the commands .Ic mlist and .Ic mlsubscribe . .Mx .It Va forward-as-attachment \*(BO Original messages are normally sent as inline text with the .Ic forward command, and only the first part of a multipart message is included. With this setting enabled messages are sent as unmodified MIME .Ql message/rfc822 attachments with all of their parts included. .Mx .Mx .It Va forward-inject-head , forward-inject-tail The strings to put before and after the text of a message with the .Ic forward command, respectively. The former defaults to .Ql -------- Original Message --------\en . Special format directives in these strings will be expanded if possible, and if so configured the output will be folded according to .Va quote-fold ; for more please refer to .Va quote-inject-head . These variables are ignored if the .Va forward-as-attachment variable is set. .Mx .It Va from The address (or a list of addresses) to put into the .Ql From: field of the message header, quoting RFC 5322: the author(s) of the message, that is, the mailbox(es) of the person(s) or system(s) responsible for the writing of the message. According to that RFC setting the .Va sender variable is required if .Va \&\&from contains more than one address. Dependent on the context these addresses are handled as if they were in the list of .Ic alternates . .Pp If a file-based MTA is used, then .Va \&\&from (or, if that contains multiple addresses, .Va sender ) can nonetheless be enforced to appear as the envelope sender address at the MTA protocol level (the RFC 5321 reverse-path), either by using the .Fl r command line option (with an empty argument; see there for the complete picture on this topic), or by setting the internal variable .Va r-option-implicit . .Pp If the machine's hostname is not valid at the Internet (for example at a dialup machine) then either this variable or .Va hostname (\*(IN a SMTP-based .Va mta adds even more fine-tuning capabilities with .Va smtp-hostname ) have to be set: if so the message and MIME part related unique ID fields .Ql Message-ID: and .Ql Content-ID: will be created (except when disallowed by .Va message-id-disable or .Va stealthmua ) . .Mx .It Va fullnames \*(BO Due to historical reasons comments and name parts of email addresses are removed by default when sending mail, replying to or forwarding a message. If this variable is set such stripping is not performed. .It Va fwdheading \*(OB Predecessor of .Va forward-inject-head . .Mx .It Va header \*(BO Causes the header summary to be written at startup and after commands that affect the number of messages or the order of messages in the current .Ic folder . Unless in .Va posix mode a header summary will also be displayed on folder changes. The command line option .Fl N can be used to set .Pf no Va header . .Mx .It Va headline A format string to use for the summary of .Ic headers . Format specifiers in the given string start with a percent sign .Ql % and may be followed by an optional decimal number indicating the field width \(em if that is negative, the field is to be left-aligned. Names and addresses are subject to modifications according to .Va showname and .Va showto . Valid format specifiers are: .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql %% A plain percent sign. .It Ql %> .Dq Dotmark : a space character but for the current message .Pf ( Dq dot ) , for which it expands to .Ql > (dependent on .Va headline-plain ) . .It Ql %< .Dq Dotmark : a space character but for the current message .Pf ( Dq dot ) , for which it expands to .Ql < (dependent on .Va headline-plain ) . .It Ql %$ \*(OP The spam score of the message, as has been classified via the command .Ic spamrate . Shows only a replacement character if there is no spam support. .It Ql %a Message attribute character (status flag); the actual content can be adjusted by setting .Va attrlist . .It Ql %d The date found in the .Ql Date: header of the message when .Va datefield is set (the default), otherwise the date when the message was received. Formatting can be controlled by assigning a .Xr strftime 3 format string to .Va datefield (and .Va datefield-markout-older ) . .It Ql %e The indenting level in .Ql thread Ns ed .Ic sort mode. .It Ql %f The address of the message sender. .It Ql %i The message thread tree structure. (Note that this format does not support a field width, and honours .Va headline-plain . ) .It Ql %L Mailing list status: is the addressee of the message a known .Pf ( Ic mlist ) or .Ic mlsubscribe Ns d mailing list? .It Ql %l The number of lines of the message, if available. .It Ql %m Message number. .It Ql %o The number of octets (bytes) in the message, if available. .It Ql %S Message subject (if any) in double quotes. .It Ql %s Message subject (if any). .It Ql %t The position in threaded/sorted order. .It Ql \&%U The value 0 except in an IMAP mailbox, where it expands to the UID of the message. .El .Pp The default is .Ql %>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s , or .Ql %>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S if .Va bsdcompat is set. Also see .Va attrlist , .Va headline-plain and .Va headline-bidi . .Mx .It Va headline-bidi Bidirectional text requires special treatment when displaying headers, because numbers (in dates or for file sizes etc.) will not affect the current text direction, in effect resulting in ugly line layouts when arabic or other right-to-left text is to be displayed. On the other hand only a minority of terminals is capable to correctly handle direction changes, so that user interaction is necessary for acceptable results. Note that extended host system support is required nonetheless, e.g., detection of the terminal character set is one precondition; and this feature only works in an Unicode (i.e., UTF-8) locale. .Pp In general setting this variable will cause \*(UA to encapsulate text fields that may occur when displaying .Va headline (and some other fields, like dynamic expansions in .Va prompt ) with special Unicode control sequences; it is possible to fine-tune the terminal support level by assigning a value: no value (or any value other than .Ql 1 , .Ql 2 and .Ql 3 ) will make \*(UA assume that the terminal is capable to properly deal with Unicode version 6.3, in which case text is embedded in a pair of U+2068 (FIRST STRONG ISOLATE) and U+2069 (POP DIRECTIONAL ISOLATE) characters. In addition no space on the line is reserved for these characters. .Pp Weaker support is chosen by using the value .Ql 1 (Unicode 6.3, but reserve the room of two spaces for writing the control sequences onto the line). The values .Ql 2 and .Ql 3 select Unicode 1.1 support (U+200E, LEFT-TO-RIGHT MARK); the latter again reserves room for two spaces in addition. .Mx .It Va headline-plain \*(BO On Unicode (UTF-8) aware terminals enhanced graphical symbols are used by default for certain entries of .Va headline . If this variable is set only basic US-ASCII symbols will be used. .Mx .It Va history-file \*(OP If a line editor is available then this can be set to name the (expandable) path of the location of a permanent .Ic history file; also see .Va history-size . .Mx .It Va history-gabby \*(BO\*(OP Add more entries to the .Ic history as is normally done. .Mx .It Va history-gabby-persist \*(BO\*(OP \*(UA's own MLE will not save the additional .Va history-gabby entries in persistent storage unless this variable is set. On the other hand it will not loose the knowledge of whether a persistent entry was gabby or not. Also see .Va history-file . .Mx .It Va history-size \*(OP Setting this variable imposes a limit on the number of concurrent .Ic history entries. If set to the value 0 then no further history entries will be added, and loading and incorporation of the .Va history-file upon program startup can also be suppressed by doing this. Runtime changes will not be reflected before the .Ic history is saved or loaded (again). .Mx .It Va hold \*(BO This setting controls whether messages are held in the system .Va inbox , and it is set by default. .Mx .It Va hostname Used instead of the value obtained from .Xr uname 3 and .Xr getaddrinfo 3 as the hostname when expanding local addresses, e.g., in .Ql From: (also see .Sx "On sending mail, and non-interactive mode" , e.g., for expansion of addresses that have a valid user-, but no domain name in angle brackets). If either of .Va from or this variable is set the message and MIME part related unique ID fields .Ql Message-ID: and .Ql Content-ID: will be created (except when disallowed by .Va message-id-disable or .Va stealthmua ) . If the \*(OPal IDNA support is available (see .Va idna-disable ) variable assignment is aborted when a necessary conversion fails. .Pp Setting it to the empty string will cause the normal hostname to be used, but nonetheless enables creation of said ID fields. \*(IN in conjunction with the built-in SMTP .Va mta .Va smtp-hostname also influences the results: one should produce some test messages with the desired combination of .Va \&\&hostname , and/or .Va from , .Va sender etc. first. .Mx .It Va idna-disable \*(BO\*(OP Can be used to turn off the automatic conversion of domain names according to the rules of IDNA (internationalized domain names for applications). Since the IDNA code assumes that domain names are specified with the .Va ttycharset character set, an UTF-8 locale charset is required to represent all possible international domain names (before conversion, that is). .Mx .It Va ifs The input field separator that is used (\*(ID by some functions) to determine where to split input data. .Pp .Bl -tag -compact -width ".It MMM" .It 1. Unsetting is treated as assigning the default value, .Ql \& \et\en . .It 2. If set to the empty value, no field splitting will be performed. .It 3. If set to a non-empty value, all whitespace characters are extracted and assigned to the variable .Va ifs-ws . .El .Pp .Bl -tag -compact -width ".It MMM" .It a. .Va \&\&ifs-ws will be ignored at the beginning and end of input. Diverging from POSIX shells default whitespace is removed in addition, which is owed to the entirely different line content extraction rules. .It b. Each occurrence of a character of .Va \&\&ifs will cause field-splitting, any adjacent .Va \&\&ifs-ws characters will be skipped. .El .Mx .It Va ifs-ws \*(RO Automatically deduced from the whitespace characters in .Va ifs . .Mx .It Va ignore \*(BO Ignore interrupt signals from the terminal while entering messages; instead echo them as .Ql @ characters and discard the current line. .Mx .It Va ignoreeof \*(BO Ignore end-of-file conditions .Pf ( Ql control-D ) in compose mode on message input and in interactive command input. If set an interactive command input session can only be left by explicitly using one of the commands .Ic exit and .Ic quit , and message input in compose mode can only be terminated by entering a period .Ql \&. on a line by itself or by using the .Ic ~. .Sx "COMMAND ESCAPES" ; Setting this implies the behaviour that .Va dot describes in .Va posix mode. .Mx .It Va inbox If this is set to a non-empty string it will specify the user's .Mx -sx .Sx "primary system mailbox" , overriding .Ev MAIL and the system-dependent default, and (thus) be used to replace .Ql % when doing .Sx "Filename transformations" ; also see .Ic file for more on this topic. The value supports a subset of transformations itself. .Mx .It Va indentprefix String used by the .Ic ~m , ~M and .Ic ~R .Sx "COMMAND ESCAPES" and by the .Va quote option for indenting messages, in place of the POSIX mandated default tabulator character .Ql \et . Also see .Va quote-chars . .Mx .It Va keep \*(BO If set, an empty .Mx -sx .Sx "primary system mailbox" file is not removed. Note that, in conjunction with .Va posix mode any empty file will be removed unless this variable is set. This may improve the interoperability with other mail user agents when using a common folder directory, and prevents malicious users from creating fake mailboxes in a world-writable spool directory. \*(ID Only local regular (MBOX) files are covered, Maildir and other mailbox types will never be removed, even if empty. .Mx .It Va keep-content-length \*(BO When (editing messages and) writing MBOX mailbox files \*(UA can be told to keep the .Ql Content-Length: and .Ql Lines: header fields that some MUAs generate by setting this variable. Since \*(UA does neither use nor update these non-standardized header fields (which in itself shows one of their conceptual problems), stripping them should increase interoperability in between MUAs that work with with same mailbox files. Note that, if this is not set but .Va writebackedited , as below, is, a possibly performed automatic stripping of these header fields already marks the message as being modified. \*(ID At some future time \*(UA will be capable to rewrite and apply an .Va mime-encoding to modified messages, and then those fields will be stripped silently. .Mx .It Va keepsave \*(BO When a message is saved it is usually discarded from the originating folder when \*(UA is quit. This setting causes all saved message to be retained. .Mx .It Va line-editor-disable \*(BO Turn off any enhanced line editing capabilities (see .Sx "On terminal control and line editor" for more). .Mx .It Va line-editor-no-defaults \*(BO\*(OP Do not establish any default key binding. .Mx .It Va log-prefix Error log message prefix string .Pf ( Ql "\*(uA: " ) . .Mx .It Va mailbox-display \*(RO The name of the current mailbox .Pf ( Ic file ) , possibly abbreviated for display purposes. .Mx .It Va mailbox-resolved \*(RO The fully resolved path of the current mailbox. .Mx .It Va mailx-extra-rc An additional startup file that is loaded as the last of the .Sx "Resource files" . Use this file for commands that are not understood by other POSIX .Xr mailx 1 implementations, i.e., mostly anything which is not covered by .Sx "Initial settings" . .Mx .It Va markanswered \*(BO When a message is replied to and this variable is set, it is marked as having been .Ic answered . See the section .Sx "Message states" . .Mx .It Va mbox-fcc-and-pcc \*(BO By default all file and pipe message receivers (see .Va expandaddr ) will be fed valid MBOX database entry message data (see .Ic file , .Va mbox-rfc4155 ) , and existing file targets will become extended in compliance to RFC 4155. If this variable is unset then a plain standalone RFC 5322 message will be written, and existing file targets will be overwritten. .Mx .It Va mbox-rfc4155 \*(BO When opening MBOX mailbox databases, and in order to achieve compatibility with old software, the very tolerant POSIX standard rules for detecting message boundaries (so-called .Ql From_ lines) are used instead of the stricter rules from the standard RFC 4155. This behaviour can be switched by setting this variable. .Pp This may temporarily be handy when \*(UA complains about invalid .Ql From_ lines when opening a MBOX: in this case setting this variable and re-opening the mailbox in question may correct the result. If so, copying the entire mailbox to some other file, as in .Ql copy * SOME-FILE , will perform proper, all-compatible .Ql From_ quoting for all detected messages, resulting in a valid MBOX mailbox. (\*(ID The better and non-destructive approach is to reencode invalid messages, as if it would be created anew, instead of mangling the .Ql From_ lines; this requires the structural code changes of the v15 rewrite.) Finally the variable can be unset again: .Bd -literal -offset indent define mboxfix { localopts yes; wysh set mbox-rfc4155;\e wysh File "${1}"; copy * "${2}" } call mboxfix /tmp/bad.mbox /tmp/good.mbox .Ed .Mx .It Va memdebug \*(BO Internal development variable. (Keeps memory debug enabled even if .Va debug is not set.) .Mx .It Va message-id-disable \*(BO By setting this variable the generation of .Ql Message-ID: and .Ql Content-ID: message and MIME part headers can be completely suppressed, effectively leaving this task up to the .Va mta (Mail-Transfer-Agent) or the SMTP server. Note that according to RFC 5321 a SMTP server is not required to add this field by itself, so it should be ensured that it accepts messages without .Ql Message-ID . .Mx .It Va message-inject-head A string to put at the beginning of each new message, followed by a newline. \*(OB The escape sequences tabulator .Ql \et and newline .Ql \en are understood (use the .Cm wysh prefix when .Ic set Ns ting the variable(s) instead). .Mx .It Va message-inject-tail A string to put at the end of each new message, followed by a newline. \*(OB The escape sequences tabulator .Ql \et and newline .Ql \en are understood (use the .Cm wysh prefix when .Ic set Ns ting the variable(s) instead). Also see .Va on-compose-leave . .Mx .It Va metoo \*(BO Usually, when an .Ic alias expansion contains the sender, the sender is removed from the expansion. Setting this option suppresses these removals. Note that a set .Va metoo also causes a .Ql -m option to be passed through to the .Va mta (Mail-Transfer-Agent); though most of the modern MTAs no longer document this flag, no MTA is known which does not support it (for historical compatibility). .Mx .It Va mime-allow-text-controls \*(BO When sending messages, each part of the message is MIME-inspected in order to classify the .Ql Content-Type: and .Ql Content-Transfer-Encoding: (see .Va mime-encoding ) that is required to send this part over mail transport, i.e., a computation rather similar to what the .Xr file 1 command produces when used with the .Ql --mime option. .Pp This classification however treats text files which are encoded in UTF-16 (seen for HTML files) and similar character sets as binary octet-streams, forcefully changing any .Ql text/plain or .Ql text/html specification to .Ql application/octet-stream : If that actually happens a yet unset charset MIME parameter is set to .Ql binary , effectively making it impossible for the receiving MUA to automatically interpret the contents of the part. .Pp If this variable is set, and the data was unambiguously identified as text data at first glance (by a .Ql .txt or .Ql .html file extension), then the original .Ql Content-Type: will not be overwritten. .Mx .It Va mime-alternative-favour-rich \*(BO If this variable is set then rich MIME alternative parts (e.g., HTML) will be preferred in favour of included plain text versions when displaying messages, provided that a handler exists which produces output that can be (re)integrated into \*(UA's normal visual display. (E.g., at the time of this writing some newsletters ship their full content only in the rich HTML part, whereas the plain text part only contains topic subjects.) .Mx .It Va mime-counter-evidence Normally the .Ql Content-Type: field is used to decide how to handle MIME parts. Some MUAs, however, do not use .Sx "The mime.types files" (also see .Sx "HTML mail and MIME attachments" ) or a similar mechanism to correctly classify content, but specify an unspecific MIME type .Pf ( Ql application/octet-stream ) even for plain text attachments. If this variable is set then \*(UA will try to re-classify such MIME message parts, if possible, for example via a possibly existing attachment filename. A non-empty value may also be given, in which case a number is expected, actually a carrier of bits, best specified as a binary value, e.g., .Ql 0b1111 . .Pp .Bl -bullet -compact .It If bit two is set (counting from 1, decimal 2) then the detected .Ic mimetype will be carried along with the message and be used for deciding which MIME handler is to be used, for example; when displaying such a MIME part the part-info will indicate the overridden content-type by showing a plus sign .Ql + . .It If bit three is set (decimal 4) then the counter-evidence is always produced and a positive result will be used as the MIME type, even forcefully overriding the parts given MIME type. .It If bit four is set (decimal 8) as a last resort the actual content of .Ql application/octet-stream parts will be inspected, so that data which looks like plain text can be treated as such. This mode is even more relaxed when data is to be displayed to the user or used as a message quote (data consumers which mangle data for display purposes, which includes masking of control characters, for example). .El .Mx .It Va mime-encoding The MIME .Ql Content-Transfer-Encoding to use in outgoing text messages and message parts, where applicable (7-bit clean text messages are without an encoding if possible): .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql 8bit .Pf (Or\0 Ql 8b . ) 8-bit transport effectively causes the raw data be passed through unchanged, but may cause problems when transferring mail messages over channels that are not ESMTP (RFC 1869) compliant. Also, several input data constructs are not allowed by the specifications and may cause a different transfer-encoding to be used. By established rules and popular demand occurrances of .Ql ^From_ (see .Va mbox-rfc4155 ) will be MBOXO quoted (prefixed with greater-than sign .Ql > ) instead of causing a non-destructive encoding like .Ql quoted-printable to be chosen, unless context (e.g., message signing) requires otherwise. .It Ql quoted-printable .Pf (Or\0 Ql qp . ) Quoted-printable encoding is 7-bit clean and has the property that ASCII characters are passed through unchanged, so that an english message can be read as-is; it is also acceptable for other single-byte locales that share many characters with ASCII, like, e.g., ISO-8859-1. The encoding will cause a large overhead for messages in other character sets: e.g., it will require up to twelve (12) bytes to encode a single UTF-8 character of four (4) bytes. It is the default encoding. .It Ql base64 .Pf (Or\0 Ql b64 . ) This encoding is 7-bit clean and will always be used for binary data. This encoding has a constant input:output ratio of 3:4, regardless of the character set of the input data it will encode three bytes of input to four bytes of output. This transfer-encoding is not human readable without performing a decoding step. .El .Mx .It Va mime-force-sendout \*(BO\*(OP Whenever it is not acceptable to fail sending out messages because of non-convertible character content this variable may be set. It will, as a last resort, classify the part content as .Ql application/octet-stream . Please refer to the section .Sx "Character sets" for the complete picture of character set conversion in \*(UA. .Mx .It Va mimetypes-load-control Can be used to control which of .Sx "The mime.types files" are loaded: if the letter .Ql u is part of the option value, then the user's personal .Pa \*(vU file will be loaded (if it exists); likewise the letter .Ql s controls loading of the system wide .Pa \*(vS ; directives found in the user file take precedence, letter matching is case-insensitive. If this variable is not set \*(UA will try to load both files. Incorporation of the \*(UA-built-in MIME types cannot be suppressed, but they will be matched last (the order can be listed via .Ic mimetype ) . .Pp More sources can be specified by using a different syntax: if the value string contains an equals sign .Ql = then it is instead parsed as a comma-separated list of the described letters plus .Ql f=FILENAME pairs; the given filenames will be expanded and loaded, and their content may use the extended syntax that is described in the section .Sx "The mime.types files" . Directives found in such files always take precedence (are prepended to the MIME type cache). .Mx .It Va mta To choose an alternate Mail-Transfer-Agent, set this option to either the full pathname of an executable (optionally prefixed with the protocol .Ql file:// ) , or \*(OPally a SMTP aka SUBMISSION protocol URL, e.g., \*(IN .Pp .Dl submissions://[user[:password]@]server[:port] .Pp (\*(OU: .Ql [smtp://]server[:port] . ) The default has been chosen at compile time. All supported data transfers are executed in child processes, which run asynchronously and without supervision unless either the .Va sendwait or the .Va verbose variable is set. If such a child receives a TERM signal, it will abort and .Va save the message to .Ev DEAD , if so configured. .Pp For a file-based MTA it may be necessary to set .Va mta-argv0 in in order to choose the right target of a modern .Xr mailwrapper 8 environment. It will be passed command line arguments from several possible sources: from the variable .Va mta-arguments if set, from the command line if given and the variable .Va expandargv allows their use. Argument processing of the MTA will be terminated with a .Fl \&\&- separator. .Pp The otherwise occurring implicit usage of the following MTA command line arguments can be disabled by setting the boolean variable .Va mta-no-default-arguments (which will also disable passing .Fl \&\&- to the MTA): .Fl \&\&i (for not treating a line with only a dot .Ql \&. character as the end of input), .Fl \&\&m (shall the variable .Va metoo be set) and .Fl \&\&v (if the .Va verbose variable is set); in conjunction with the .Fl r command line option \*(UA will also (not) pass .Fl \&\&f as well as possibly .Fl \&\&F . .Pp \*(OPally \*(UA can send mail over SMTP aka SUBMISSION network connections to a single defined smart host by setting this variable to a SMTP or SUBMISSION URL (see .Sx "On URL syntax and credential lookup" ) . An authentication scheme can be specified via the variable chain .Va smtp-auth . Encrypted network connections are \*(OPally available, the section .Sx "Encrypted network communication" should give an overview and provide links to more information on this. Note that with some mail providers it may be necessary to set the .Va smtp-hostname variable in order to use a specific combination of .Va from , .Va hostname and .Va mta . Network communication socket timeouts are configurable, e.g., .Va socket-connect-timeout . All generated network traffic may be proxied over the SOCKS5 server given in .Va socks-proxy . The following SMTP variants may be used: .Bl -bullet .It The plain SMTP protocol (RFC 5321) that normally lives on the server port 25 and requires setting the .Va smtp-use-starttls variable to enter a TLS encrypted session state. Assign a value like \*(IN .Ql smtp://[user[:password]@]server[:port] (\*(OU .Ql smtp://server[:port] ) to choose this protocol. .It The so-called SMTPS which is supposed to live on server port 465 and is automatically TLS secured. Unfortunately it never became a standardized protocol and may thus not be supported by your hosts network service database \(en in fact the port number has already been reassigned to other protocols! .Pp SMTPS is nonetheless a commonly offered protocol and thus can be chosen by assigning a value like \*(IN .Ql smtps://[user[:password]@]server[:port] (\*(OU .Ql smtps://server[:port] ) ; due to the mentioned problems it is usually necessary to explicitly specify the port as .Ql :465 , however. .It The SUBMISSION protocol (RFC 6409) lives on server port 587 and is identically to the SMTP protocol from \*(UA's point of view; it requires setting .Va smtp-use-starttls to enter a TLS secured session state; e.g., \*(IN .Ql submission://[user[:password]@]server[:port] . .It The SUBMISSIONS protocol (RFC 8314) that lives on server port 465 and is TLS secured by default. It can be chosen by assigning a value like \*(IN .Ql submissions://[user[:password]@]server[:port] . Due to the problems mentioned for SMTPS above and the fact that SUBMISSIONS is new and a successor that lives on the same port as the historical engineering mismanagement named SMTPS, it is usually necessary to explicitly specify the port as .Ql :465 . .El .Mx .It Va mta-arguments Arguments to pass through to a file-based .Va mta can be given via this variable, which is parsed according to .Sx "Shell-style argument quoting" into an array of arguments, and which will be joined onto MTA options from other sources, and then passed individually to the MTA: .Ql \&? wysh set mta-arguments='-t -X \&"/tmp/my log\&"' . .Mx .It Va mta-no-default-arguments \*(BO Unless this variable is set \*(UA will pass some well known standard command line options to a file-based .Va mta (Mail-Transfer-Agent), see there for more. .Mx .It Va mta-no-receiver-arguments \*(BO By default a file-based .Va mta will be passed all receiver addresses on the command line. This variable can be set to suppress any such argument. .Mx .It Va mta-argv0 Many systems use a so-called .Xr mailwrapper 8 environment to ensure compatibility with .Xr sendmail 1 . This works by inspecting the name that was used to invoke the mail delivery system. If this variable is set then the mailwrapper (the program that is actually executed when calling the file-based .Va mta ) will treat its contents as that name. .Mx Va netrc-lookup .It Va netrc-lookup-USER@HOST , netrc-lookup-HOST , netrc-lookup \*(BO\*(IN\*(OP Used to control usage of the user's .Pa \*(VN file for lookup of account credentials, as documented in the section .Sx "On URL syntax and credential lookup" and for the command .Ic netrc ; the section .Sx "The .netrc file" documents the file format. Also see .Va netrc-pipe . .Mx .It Va netrc-pipe \*(IN\*(OP When .Pa \*(VN is loaded (see .Ic netrc and .Va netrc-lookup ) then \*(UA will read the output of a shell pipe instead of the user's .Pa \*(VN file if this variable is set (to the desired shell command). This can be used to, e.g., store .Pa \*(VN in encrypted form: .Ql \&? set netrc-pipe='gpg -qd ~/.netrc.pgp' . .Mx .It Va newfolders \*(OP If this variable has the value .Ql maildir , newly created local folders will be in Maildir instead of MBOX format. .Mx .It Va newmail Checks for new mail in the current folder each time the prompt is shown. A Maildir folder must be re-scanned to determine if new mail has arrived. If this variable is set to the special value .Ql nopoll then a Maildir folder will not be rescanned completely, but only timestamp changes are detected. Maildir folders are \*(OPal. .Mx .It Va outfolder \*(BO Unless specified as absolute pathnames, causes the filename given in the .Va record variable and the sender-based filenames for the .Ic Copy and .Ic Save commands to be interpreted relative to the directory given in the .Va folder variable rather than relative to the current directory. .Mx Va on-account-cleanup .It Va on-account-cleanup-ACCOUNT , Va on-account-cleanup Macro hook which will be called once an .Ic account is left, as the very last step before unrolling per-account .Ic localopts . This hook is run even in case of fatal errors, and it is advisable to perform only absolutely necessary actions, like cleaning up .Ic alternates , for example. The specialized form is used in favour of the generic one if found. .Mx .It Va on-compose-cleanup Macro hook which will be called after the message has been sent (or not, in case of failures), as the very last step before unrolling compose mode .Ic localopts . This hook is run even in case of fatal errors, and it is advisable to perform only absolutely necessary actions, like cleaning up .Ic alternates , for example. .Pp For compose mode hooks that may affect the message content please see .Va on-compose-enter , on-compose-leave , on-compose-splice . \*(ID This hook exists because .Ic alias , alternates , commandalias , shortcut , to name a few, are neither covered by .Ic localopts nor by .Cm local : changes applied in compose mode will continue to be in effect thereafter. .Mx .Mx .It Va on-compose-enter , on-compose-leave Macro hooks which will be called once compose mode is entered, and after composing has been finished, respectively; the exact order of the steps taken is documented for .Ic ~. , one of the .Sx "COMMAND ESCAPES" . Context about the message being worked on can be queried via .Ic digmsg . .Ic localopts are enabled for these hooks, and changes on variables will be forgotten after the message has been sent. .Va on-compose-cleanup can be used to perform other necessary cleanup steps. .Pp Here is an example that injects a signature via .Va message-inject-tail ; instead using .Va on-compose-splice to simply inject the file of desire via .Ic ~< or .Ic ~'; read es;\e vput csop es substring "${es}" 0 1 if [ "$es" != 2 ] echoerr 'Cannot insert Cc: header'; echo '~x' # (no xit, macro finishs anyway) endif endif } set on-compose-splice=ocsm .Ed .Mx .It Va on-history-addition This hook will be called if an entry is about to be added to the .Ic history of the MLE, as is documented in .Sx "On terminal control and line editor" . It will be called with three arguments: the first is the name of the input context (see .Ic bind ) , the second whether the command relates to .Va history-gabby , and the third being the complete command line to be added. The entry will not be added to history if the hook uses a non-0 .Ic return . \*(ID A future version will give the expanded command name as the third argument, followed by the tokenized command line as parsed in the remaining arguments, the first of which is the original unexpanded command name; i.e., one may do .Ql Ic shift Ns \| 4 and will then be able to access the positional parameters as usual via .Va * , # , 1 etc. .Mx .It Va on-resend-cleanup \*(ID Identical to .Va on-compose-cleanup , but is only triggered by .Ic resend . .Mx .It Va on-resend-enter \*(ID Identical to .Va on-compose-enter , but is only triggered by .Ic resend ; currently there is no .Ic digmsg support, for example. .Mx .It Va page \*(BO If set, each message feed through the command given for .Ic pipe is followed by a formfeed character .Ql \ef . .Mx Va password .It Va password-USER@HOST , password-HOST , password \*(IN Variable chain that sets a password, which is used in case none has been given in the protocol and account-specific URL; as a last resort \*(UA will ask for a password on the user's terminal if the authentication method requires a password. Specifying passwords in a startup file is generally a security risk; the file should be readable by the invoking user only. .It Va password-USER@HOST \*(OU (see the chain above for \*(IN) Set the password for .Ql USER when connecting to .Ql HOST . If no such variable is defined for a host, the user will be asked for a password on standard input. Specifying passwords in a startup file is generally a security risk; the file should be readable by the invoking user only. .Mx .It Va piperaw \*(BO Send messages to the .Ic pipe command without performing MIME and character set conversions. .Mx .It Va pipe-TYPE/SUBTYPE When a MIME message part of type .Ql TYPE/SUBTYPE (case-insensitive) is displayed or quoted, its text is filtered through the value of this variable interpreted as a shell command. Note that only parts which can be displayed inline as plain text (see .Cd copiousoutput ) are displayed unless otherwise noted, other MIME parts will only be considered by and for the command .Ic mimeview . .Pp The special value question mark .Ql \&? forces interpretation of the message part as plain text, e.g., .Ql set pipe-application/xml=? will henceforth display XML .Dq as is . (The same could also be achieved by adding a MIME type marker with the .Ic mimetype command. And \*(OPally MIME type handlers may be defined via .Sx "The Mailcap files" \(em these directives, .Cd copiousoutput has already been used, should be referred to for further documentation. .Pp The question mark .Ql \&? can in fact be used as a trigger character to adjust usage and behaviour of a following shell command specification more thoroughly by appending more special characters which refer to further mailcap directives, e.g., the following hypothetical command specification could be used: .Bd -literal -offset indent ? set pipe-X/Y='?!++=? vim ${MAILX_FILENAME_TEMPORARY}' .Ed .Pp .Bl -tag -compact -width ".It Ql __" .It Ql * The command produces plain text to be integrated in \*(UAs output: .Cd copiousoutput . .It Ql # If set the handler will not be invoked when a message is to be quoted, but only when it will be displayed: .Cd x-mailx-noquote . .It Ql & Run the command asynchronously, i.e., without blocking \*(UA: .Cd x-mailx-async . .It Ql \&! The command must be run on an interactive terminal, \*(UA will temporarily release the terminal to it: .Cd needsterminal . .It Ql + Request creation of a zero-sized temporary file, the absolute pathname of which will be made accessible via the environment variable .Ev MAILX_FILENAME_TEMPORARY : .Cd x-mailx-tmpfile . If given twice then the file will be unlinked automatically by \*(UA when the command loop is entered again at latest: .Cd x-mailx-tmpfile-unlink . .It Ql = Normally the MIME part content is passed to the handler via standard input; if this flag is set then the data will instead be written into .Ev MAILX_FILENAME_TEMPORARY .Pf ( Cd x-mailx-tmpfile-fill ) , the creation of which is implied; note however that in order to cause deletion of the temporary file you still have to use two plus signs .Ql ++ explicitly! .It Ql \&? To avoid ambiguities with normal shell command content another question mark can be used to forcefully terminate interpretation of remaining characters. (Any character not in this list will have the same effect.) .El .Pp Some information about the MIME part to be displayed is embedded into the environment of the shell command: .Pp .Bl -tag -compact -width ".It Ev _AIL__ILENAME__ENERATED" .Mx .It Ev MAILX_CONTENT The MIME content-type of the part, if known, the empty string otherwise. .Mx .It Ev MAILX_CONTENT_EVIDENCE If .Va mime-counter-evidence includes the carry-around-bit (2), then this will be set to the detected MIME content-type; not only then identical to .Ev \&\&MAILX_CONTENT otherwise. .Mx .It Ev MAILX_EXTERNAL_BODY_URL MIME parts of type .Ql message/external-body access-type=url will store the access URL in this variable, it is empty otherwise. URL targets should not be activated automatically, without supervision. .Mx .It Ev MAILX_FILENAME The filename, if any is set, the empty string otherwise. .Mx .It Ev MAILX_FILENAME_GENERATED A random string. .Mx .It Ev MAILX_FILENAME_TEMPORARY If temporary file creation has been requested through the command prefix this variable will be set and contain the absolute pathname of the temporary file. .El .Mx .It Va pipe-EXTENSION This is identical to .Va pipe-TYPE/SUBTYPE except that .Ql EXTENSION (normalized to lowercase using character mappings of the ASCII charset) names a file extension, e.g., .Ql xhtml . Handlers registered using this method take precedence. .Mx Va pop3-auth .It Va pop3-auth-USER@HOST , pop3-auth-HOST , pop3-auth \*(OP\*(IN Variable chain that sets the POP3 authentication method. The only possible value as of now is .Ql plain , which is thus the default. .Mx Va pop3-bulk-load .It Va pop3-bulk-load-USER@HOST , pop3-bulk-load-HOST , pop3-bulk-load \*(BO\*(OP When accessing a POP3 server \*(UA loads the headers of the messages, and only requests the message bodies on user request. For the POP3 protocol this means that the message headers will be downloaded twice. If this variable is set then \*(UA will download only complete messages from the given POP3 server(s) instead. .Mx Va pop3-keepalive .It Va pop3-keepalive-USER@HOST , pop3-keepalive-HOST , pop3-keepalive \*(OP POP3 servers close the connection after a period of inactivity; the standard requires this to be at least 10 minutes, but practical experience may vary. Setting this variable to a numeric value greater than .Ql 0 causes a .Ql NOOP command to be sent each value seconds if no other operation is performed. .Mx Va pop3-no-apop .It Va pop3-no-apop-USER@HOST , pop3-no-apop-HOST , pop3-no-apop \*(BO\*(OP Unless this variable is set the .Ql APOP authentication method will be used when connecting to a POP3 server that advertises support. The advantage of .Ql APOP is that the password is not sent in clear text over the wire and that only a single packet is sent for the user/password tuple. Note that .Va pop3-no-apop-HOST requires \*(IN. .Mx Va pop3-use-starttls .It Va pop3-use-starttls-USER@HOST , pop3-use-starttls-HOST , pop3-use-starttls \*(BO\*(OP Causes \*(UA to issue a .Ql STLS command to make an unencrypted POP3 session TLS encrypted. This functionality is not supported by all servers, and is not used if the session is already encrypted by the POP3S method. Note that .Va pop3-use-starttls-HOST requires \*(IN. .Mx .It Va posix \*(BO This flag enables POSIX mode, which changes behaviour of \*(UA where that deviates from standardized behaviour. It will be set implicitly before the .Sx "Resource files" are loaded if the environment variable .Ev POSIXLY_CORRECT is set, and adjusting any of those two will be reflected by the other one implicitly. The following behaviour is covered and enforced by this mechanism: .Pp .Bl -bullet -compact .It In non-interactive mode, any error encountered while loading resource files during program startup will cause a program exit, whereas in interactive mode such errors will stop loading of the currently loaded (stack of) file(s, i.e., recursively). These exits can be circumvented on a per-command base by using .Cm ignerr , one of the .Sx "Command modifiers" , for each command which shall be allowed to fail. .It .Ic alternates will replace the list of alternate addresses instead of appending to it. In addition alternates will only be honoured for any sort of message .Ic reply , and for aliases. .It The variable inserting .Sx "COMMAND ESCAPES" .Ic ~A , .Ic ~a , .Ic ~I and .Ic ~i will expand embedded character sequences .Ql \et horizontal tabulator and .Ql \en line feed. \*(ID For compatibility reasons this step will always be performed. .It Upon changing the active .Ic file no summary of .Ic headers will be displayed even if .Va header is set. .It Setting .Va ignoreeof implies the behaviour described by .Va dot . .It The variable .Va keep is extended to cover any empty mailbox, not only empty .Mx -sx .Sx "primary system mailbox" Ns es: they will be removed when they are left in empty state otherwise. .El .Mx .It Va print-alternatives \*(BO When a MIME message part of type .Ql multipart/alternative is displayed and it contains a subpart of type .Ql text/plain , other parts are normally discarded. Setting this variable causes all subparts to be displayed, just as if the surrounding part was of type .Ql multipart/mixed . .Mx .It Va prompt The string used as a prompt in interactive mode. Whenever the variable is evaluated the value is treated as if specified within dollar-single-quotes (see .Sx "Shell-style argument quoting" ) . This (post-assignment, i.e., second) expansion can be used to embed status information, for example .Va \&? , .Va \&! , .Va account or .Va mailbox-display . .Pp In order to embed characters which should not be counted when calculating the visual width of the resulting string, enclose the characters of interest in a pair of reverse solidus escaped brackets: .Ql \e[\eE[0m\e] ; a slot for coloured prompts is also available with the \*(OPal command .Ic colour . Prompting may be prevented by setting this to the null string (aka\| .Ql set noprompt ) . .Mx .It Va prompt2 This string is used for secondary prompts, but is otherwise identical to .Va prompt . The default is .Ql ..\0 . .Mx .It Va quiet \*(BO Suppresses the printing of the version when first invoked. .Mx .It Va quote If set a .Ic reply message is started with the quoted original message, the lines of which are prefixed by the value of the variable .Va indentprefix , taking into account .Va quote-chars and .Va quote-fold . If set to the empty value, the quoted message will be preceded and followed by the expansions of the values of .Va quote-inject-head and .Va quote-inject-tail , respectively. None of the headers of the quoted message is included in the quote if the value equals .Ql noheading , and only the headers selected by the .Ql type .Ic headerpick selection are put above the message body for .Ql headers , whereas all headers and all MIME parts are included for .Ql allheaders . Also see .Va quote-as-attachment and .Ic ~Q , one of the .Sx "COMMAND ESCAPES" . .Mx .It Va quote-as-attachment \*(BO Add the original message in its entirety as a .Ql message/rfc822 MIME attachment when replying to a message. Note this works regardless of the setting of .Va quote . .Mx .It Va quote-chars Can be set to a string consisting of non-whitespace ASCII characters which shall be treated as quotation leaders, the default being .Ql >|}: . .Mx .It Va quote-fold \*(OP Can be set in addition to .Va indentprefix , and creates a more fancy quotation in that leading quotation characters .Pf ( Va quote-chars ) are compressed and overlong lines are folded. .Va \&\"e-fold can be set to either one, two or three (space separated) numeric values, which are interpreted as the maximum (goal) and the minimum line length, respectively, in a spirit rather equal to the .Xr fmt 1 program, but line- instead of paragraph-based. The third value is used as the maximum line length instead of the first if no better break point can be found; it is ignored unless it is larger than the minimum and smaller than the maximum. If not set explicitly the minimum will reflect the goal algorithmically. The goal cannot be smaller than the length of .Va indentprefix plus some additional pad; necessary adjustments take place silently. .Mx .Mx .It Va quote-inject-head , quote-inject-tail The strings to put before and after the text of a .Va quote Ns d message, respectively. The former defaults to .Ql %f wrote:\en\en . Special format directives will be expanded if possible, and if so configured the output will be folded according to .Va quote-fold . Format specifiers in the given strings start with a percent sign .Ql % and expand values of the original message, unless noted otherwise. Note that names and addresses are not subject to the setting of .Va showto . Valid format specifiers are: .Pp .Bl -tag -compact -width ".It Ql _%%_" .It Ql %% A plain percent sign. .It Ql %a The address(es) of the sender(s). .It Ql %d The date found in the .Ql Date: header of the message when .Va datefield is set (the default), otherwise the date when the message was received. Formatting can be controlled by assigning a .Xr strftime 3 format string to .Va datefield (and .Va datefield-markout-older ) . .It Ql %f The full name(s) (name and address, as given) of the sender(s). .It Ql %i The .Ql Message-ID: . .It Ql %n The real name(s) of the sender(s) if there is one and .Va showname allows usage, the address(es) otherwise. .It Ql %r The senders real name(s) if there is one, the address(es) otherwise. .El .Mx .It Va r-option-implicit \*(BO Setting this option evaluates the contents of .Va from (or, if that contains multiple addresses, .Va sender ) and passes the results onto the used (file-based) MTA as described for the .Fl r option (empty argument case). .Mx .It Va recipients-in-cc \*(BO When doing a .Ic reply , the original .Ql From: and .Ql To: are by default merged into the new .Ql To: . If this variable is set, only the original .Ql From: ends in the new .Ql To: , the rest is merged into .Ql Cc: . .Mx .It Va record Unless this variable is defined, no copies of outgoing mail will be saved. If defined it gives the pathname, subject to the usual .Sx "Filename transformations" , of a folder where all new, replied-to or forwarded messages are saved: when saving to this folder fails the message is not sent, but instead .Va save Ns d to .Ev DEAD . The standard defines that relative (fully expanded) paths are to be interpreted relative to the current directory .Pf ( Ic cwd ) , to force interpretation relative to .Va folder .Va outfolder needs to be set in addition. .Mx .It Va record-files \*(BO If this variable is set the meaning of .Va record will be extended to cover messages which target only file and pipe recipients (see .Va expandaddr ) . These address types will not appear in recipient lists unless .Va add-file-recipients is also set. .Mx .It Va record-resent \*(BO If this variable is set the meaning of .Va record will be extended to also cover the .Ic resend and .Ic Resend commands. .Mx .It Va reply-in-same-charset \*(BO If this variable is set \*(UA first tries to use the same character set of the original message for replies. If this fails, the mechanism described in .Sx "Character sets" is evaluated as usual. .Mx .It Va reply-strings Can be set to a comma-separated list of (case-insensitive according to ASCII rules) strings which shall be recognized in addition to the built-in strings as .Ql Subject: reply message indicators \(en built-in are .Ql Re: , which is mandated by RFC 5322, as well as the german .Ql Aw: , .Ql Antw: , and the .Ql Wg: which often has been seen in the wild; I.e., the separating colon has to be specified explicitly. .Mx .It Va reply-to A list of addresses to put into the .Ql Reply-To: field of the message header. Members of this list are handled as if they were in the .Ic alternates list. .It Va replyto \*(OB Variant of .Va reply-to . .Mx .It Va reply-to-honour Controls whether a .Ql Reply-To: header is honoured when replying to a message via .Ic reply or .Ic Lreply . This is a quadoption; if set without a value it defaults to .Dq yes . .Mx .It Va rfc822-body-from_ \*(BO This variable can be used to force displaying a so-called .Ql From_ line for messages that are embedded into an envelope mail via the .Ql message/rfc822 MIME mechanism, for more visual convenience, also see .Va mbox-rfc4155 . .Mx .It Va save \*(BO Enable saving of (partial) messages in .Ev DEAD upon interrupt or delivery error. .Mx .It Va screen The number of lines that represents a .Dq screenful of lines, used in .Ic headers summary display, .Ic from .Ic search Ns ing, message .Ic top Ns line display and scrolling via .Ic z . If this variable is not set \*(UA falls back to a calculation based upon the detected terminal window size and the baud rate: the faster the terminal, the more will be shown. Overall screen dimensions and pager usage is influenced by the environment variables .Ev COLUMNS and .Ev LINES and the variable .Va crt . .Mx .It Va searchheaders \*(BO Expand message-list specifiers in the form .Ql /x:y to all messages containing the substring .Dq y in the header field .Ql x . The string search is case insensitive. .Mx .It Va sendcharsets \*(OP A comma-separated list of character set names that can be used in outgoing internet mail. The value of the variable .Va charset-8bit is automatically appended to this list of character sets. If no character set conversion capabilities are compiled into \*(UA then the only supported charset is .Va ttycharset . Also see .Va sendcharsets-else-ttycharset and refer to the section .Sx "Character sets" for the complete picture of character set conversion in \*(UA. .Mx .It Va sendcharsets-else-ttycharset \*(BO\*(OP If this variable is set, but .Va sendcharsets is not, then \*(UA acts as if .Va sendcharsets had been set to the value of the variable .Va ttycharset . In effect this combination passes through the message data in the character set of the current locale encoding: therefore mail message text will be (assumed to be) in ISO-8859-1 encoding when send from within a ISO-8859-1 locale, and in UTF-8 encoding when send from within an UTF-8 locale. .Pp The 8-bit fallback .Va charset-8bit never comes into play as .Va ttycharset is implicitly assumed to be 8-bit and capable to represent all files the user may specify (as is the case when no character set conversion support is available in \*(UA and the only supported character set is .Va ttycharset , see .Sx "Character sets" ) . This might be a problem for scripts which use the suggested .Ql LC_ALL=C setting, since in this case the character set is US-ASCII by definition, so that it is better to also override .Va ttycharset , then; and/or do something like the following in the resource file: .Bd -literal -offset indent if [ "$LC_ALL" == C ] || [ "$LC_CTYPE" == C ] unset sendcharsets-else-ttycharset end .Ed .Mx .It Va sender An address that is put into the .Ql Sender: field of outgoing messages, quoting RFC 5322: the mailbox of the agent responsible for the actual transmission of the message. This field should normally not be used unless the .Va from field contains more than one address, on which case it is required. Dependent on the context this address is handled as if it were in the list of .Ic alternates . Also see .Fl r , .Va r-option-implicit . .It Va sendmail \*(OB Predecessor of .Va mta . .It Va sendmail-arguments \*(OB Predecessor of .Va mta-arguments . .It Va sendmail-no-default-arguments \*(OB\*(BO Predecessor of .Va mta-no-default-arguments . .It Va sendmail-progname \*(OB Predecessor of .Va mta-argv0 . .Mx .It Va sendwait \*(BO When sending a message wait until the .Va mta (including the built-in SMTP one) exits before accepting further commands. .Sy Only with this variable set errors reported by the MTA will be recognizable! If the MTA returns a non-zero exit status, the exit status of \*(UA will also be non-zero. .Mx .It Va showlast \*(BO This setting causes \*(UA to start at the last message instead of the first one when opening a mail folder, as well as with .Ic from and .Ic headers . .Mx .It Va showname \*(BO Causes \*(UA to use the sender's real name instead of the plain address in the header field summary and in message specifications. .Mx .It Va showto \*(BO Causes the recipient of the message to be shown in the header summary if the message was sent by the user. .Mx .It Va Sign The value backing .Ic ~A , one of the .Sx "COMMAND ESCAPES" . Also see .Va message-inject-tail , .Va on-compose-leave and .Va on-compose-splice . .Mx .It Va sign The value backing .Ic ~a , one of the .Sx "COMMAND ESCAPES" . Also see .Va message-inject-tail , .Va on-compose-leave and .Va on-compose-splice . .Mx .It Va signature \*(OB Please use .Va on-compose-splice or .Va on-compose-splice-shell or .Va on-compose-leave and (if necessary) .Va message-inject-tail instead! .Mx .It Va skipemptybody \*(BO If an outgoing message does not contain any text in its first or only message part, do not send it but discard it silently (see also the command line option .Fl E ) . .Mx .Mx .It Va smime-ca-dir , smime-ca-file \*(OP Specify the location of trusted CA certificates in PEM (Privacy Enhanced Mail) for the purpose of verification of S/MIME signed messages. .Va tls-ca-dir documents the necessary preparation steps to use the former. The set of CA certificates which are built into the TLS library can be explicitly turned off by setting .Va smime-ca-no-defaults , and further fine-tuning is possible via .Va smime-ca-flags . .Mx .It Va smime-ca-flags \*(OP Can be used to fine-tune behaviour of the X509 CA certificate storage, and the certificate verification that is used. The actual values and their meanings are documented for .Va tls-ca-flags . .Mx .It Va smime-ca-no-defaults \*(BO\*(OP Do not load the default CA locations that are built into the used to TLS library to verify S/MIME signed messages. .Mx Va smime-cipher .It Va smime-cipher-USER@HOST , smime-cipher \*(OP Specifies the cipher to use when generating S/MIME encrypted messages (for the specified account). RFC 5751 mandates a default of .Ql aes128 (AES-128 CBC). Possible values are (case-insensitive and) in decreasing cipher strength: .Ql aes256 (AES-256 CBC), .Ql aes192 (AES-192 CBC), .Ql aes128 (AES-128 CBC), .Ql des3 (DES EDE3 CBC, 168 bits; default if .Ql aes128 is not available) and .Ql des (DES CBC, 56 bits). .Pp The actually available cipher algorithms depend on the cryptographic library that \*(UA uses. \*(OP Support for more cipher algorithms may be available through dynamic loading via, e.g., .Xr EVP_get_cipherbyname 3 (OpenSSL) if \*(UA has been compiled to support this. .Mx .It Va smime-crl-dir \*(OP Specifies a directory that contains files with CRLs in PEM format to use when verifying S/MIME messages. .Mx .It Va smime-crl-file \*(OP Specifies a file that contains a CRL in PEM format to use when verifying S/MIME messages. .Mx .It Va smime-encrypt-USER@HOST \*(OP If this variable is set, messages send to the given receiver are encrypted before sending. The value of the variable must be set to the name of a file that contains a certificate in PEM format. .Pp If a message is sent to multiple recipients, each of them for whom a corresponding variable is set will receive an individually encrypted message; other recipients will continue to receive the message in plain text unless the .Va smime-force-encryption variable is set. It is recommended to sign encrypted messages, i.e., to also set the .Va smime-sign variable. .Mx .It Va smime-force-encryption \*(BO\*(OP Causes \*(UA to refuse sending unencrypted messages. .Mx .It Va smime-sign \*(BO\*(OP S/MIME sign outgoing messages with the user's private key and include the user's certificate as a MIME attachment. Signing a message enables a recipient to verify that the sender used a valid certificate, that the email addresses in the certificate match those in the message header and that the message content has not been altered. It does not change the message text, and people will be able to read the message as usual. Also see .Va smime-sign-cert , smime-sign-include-certs and .Va smime-sign-digest . .Mx Va smime-sign-cert .It Va smime-sign-cert-USER@HOST , smime-sign-cert \*(OP Points to a file in PEM format. For the purpose of signing and decryption this file needs to contain the user's private key, followed by his certificate. .Pp For message signing .Ql USER@HOST is always derived from the value of .Va from (or, if that contains multiple addresses, .Va sender ) . For the purpose of encryption the recipient's public encryption key (certificate) is expected; the command .Ic certsave can be used to save certificates of signed messages (the section .Sx "Signed and encrypted messages with S/MIME" gives some details). This mode of operation is usually driven by the specialized form. .Pp When decrypting messages the account is derived from the recipient fields .Pf ( Ql To: and .Ql Cc: ) of the message, which are searched for addresses for which such a variable is set. \*(UA always uses the first address that matches, so if the same message is sent to more than one of the user's addresses using different encryption keys, decryption might fail. .Pp For signing and decryption purposes it is possible to use encrypted keys, and the pseudo-host(s) .Ql USER@HOST.smime-cert-key for the private key (and .Ql USER@HOST.smime-cert-cert for the certificate stored in the same file) will be used for performing any necessary password lookup, therefore the lookup can be automated via the mechanisms described in .Sx "On URL syntax and credential lookup" . For example, the hypothetical address .Ql bob@exam.ple could be driven with a private key / certificate pair path defined in .Va \&\&smime-sign-cert-bob@exam.ple , and needed passwords would then be looked up via the pseudo hosts .Ql bob@exam.ple.smime-cert-key (and .Ql bob@exam.ple.smime-cert-cert ) . To include intermediate certificates, use .Va smime-sign-include-certs . .Mx Va smime-sign-digest .It Va smime-sign-digest-USER@HOST , smime-sign-digest \*(OP Specifies the message digestto use when signing S/MIME messages. Please remember that for this use case .Ql USER@HOST refers to the variable .Va from (or, if that contains multiple addresses, .Va sender ) . The available algorithms depend on the used cryptographic library, but at least one usable builtin algorithm is ensured as a default. If possible the standard RFC 5751 will be violated by using .Ql SHA512 instead of the mandated .Ql SHA1 due to security concerns. .Pp \*(UA will try to add built-in support for the following message digests, names are case-insensitive: .Ql BLAKE2b512 , .Ql BLAKE2s256 , .Ql SHA3-512 , .Ql SHA3-384 , .Ql SHA3-256 , .Ql SHA3-224 , as well as the widely available .Ql SHA512 , .Ql SHA384 , .Ql SHA256 , .Ql SHA224 , and the proposed insecure .Ql SHA1 and .Ql MD5 . More digests may \*(OPally be available through dynamic loading via, e.g., the OpenSSL function .Xr EVP_get_digestbyname 3 . .Mx Va smime-sign-include-certs .It Va smime-sign-include-certs-USER@HOST , smime-sign-include-certs \*(OP If used, this is supposed to a consist of a comma-separated list of files, each of which containing a single certificate in PEM format to be included in the S/MIME message in addition to the .Va smime-sign-cert certificate. This can be used to include intermediate certificates of the certificate authority, in order to allow the receiver's S/MIME implementation to perform a verification of the entire certificate chain, starting from a local root certificate, over the intermediate certificates, down to the .Va smime-sign-cert . Even though top level certificates may also be included in the chain, they will not be used for the verification on the receiver's side. .Pp For the purpose of the mechanisms involved here, .Ql USER@HOST refers to the content of the internal variable .Va from (or, if that contains multiple addresses, .Va sender ) . The pseudo-host .Ql USER@HOST.smime-include-certs will be used for performing password lookups for these certificates, shall they have been given one, therefore the lookup can be automated via the mechanisms described in .Sx "On URL syntax and credential lookup" . .It Va smime-sign-message-digest-USER@HOST , smime-sign-message-digest \*(OB\*(OP Predecessor(s) of .Va smime-sign-digest . .It Va smtp \*(OB\*(OP To use the built-in SMTP transport, specify a SMTP URL in .Va mta . \*(ID For compatibility reasons a set .Va smtp is used in preference of .Va mta . .Mx Va smtp-auth .It Va smtp-auth-USER@HOST , smtp-auth-HOST , smtp-auth \*(OP Variable chain that controls the SMTP .Va mta authentication method, possible values are .Ql none (\*(OU default), .Ql plain (\*(IN default), .Ql login as well as the \*(OPal methods .Ql cram-md5 and .Ql gssapi . The .Ql none method does not need any user credentials, .Ql gssapi requires a user name and all other methods require a user name and a password. See \*(IN .Va mta , .Va user and .Va password (\*(OU .Va smtp-auth-password and .Va smtp-auth-user ) . Note that .Va smtp-auth-HOST is \*(IN. \*(OU: Note for .Va smtp-auth-USER@HOST : may override dependent on sender address in the variable .Va from . .It Va smtp-auth-password \*(OP\*(OU Sets the global fallback password for SMTP authentication. If the authentication method requires a password, but neither .Va smtp-auth-password nor a matching .Va smtp-auth-password-USER@HOST can be found, \*(UA will ask for a password on the user's terminal. .It Va smtp-auth-password-USER@HOST \*(OU Overrides .Va smtp-auth-password for specific values of sender addresses, dependent upon the variable .Va from . .It Va smtp-auth-user \*(OP\*(OU Sets the global fallback user name for SMTP authentication. If the authentication method requires a user name, but neither .Va smtp-auth-user nor a matching .Va smtp-auth-user-USER@HOST can be found, \*(UA will ask for a user name on the user's terminal. .It Va smtp-auth-user-USER@HOST \*(OU Overrides .Va smtp-auth-user for specific values of sender addresses, dependent upon the variable .Va from . .Mx .It Va smtp-hostname \*(OP\*(IN Normally \*(UA uses the variable .Va from to derive the necessary .Ql USER@HOST information in order to issue a .Ql MAIL FROM:<> SMTP .Va mta command. Setting .Va smtp-hostname can be used to use the .Ql USER from the SMTP account .Pf ( Va mta or the .Va user variable chain) and the .Ql HOST from the content of this variable (or, if that is the empty string, .Va hostname or the local hostname as a last resort). This often allows using an address that is itself valid but hosted by a provider other than which (in .Va from ) is about to send the message. Setting this variable also influences generated .Ql Message-ID: and .Ql Content-ID: header fields. If the \*(OPal IDNA support is available (see .Va idna-disable ) variable assignment is aborted when a necessary conversion fails. .Mx Va smtp-use-starttls .It Va smtp-use-starttls-USER@HOST , smtp-use-starttls-HOST , smtp-use-starttls \*(BO\*(OP Causes \*(UA to issue a .Ql STARTTLS command to make an SMTP .Va mta session TLS encrypted, i.e., to enable transport layer security. .Mx .It Va socket-connect-timeout \*(OP A positive number that defines the timeout to wait for establishing a socket connection before forcing .Va ^ERR Ns -TIMEDOUT . .Mx Va socks-proxy .It Va socks-proxy-USER@HOST , socks-proxy-HOST , socks-proxy \*(OP If this is set to the hostname (SOCKS URL) of a SOCKS5 server then \*(UA will proxy all of its network activities through it. This can be used to proxy SMTP, POP3 etc. network traffic through the Tor anonymizer, for example. The following would create a local SOCKS proxy on port 10000 that forwards to the machine .Ql HOST , and from which the network traffic is actually instantiated: .Bd -literal -offset indent # Create local proxy server in terminal 1 forwarding to HOST $ ssh -D 10000 USER@HOST # Then, start a client that uses it in terminal 2 $ \*(uA -Ssocks-proxy-USER@HOST=localhost:10000 .Ed .Mx .It Va spam-interface \*(OP In order to use any of the spam-related commands (like, e.g., .Ic spamrate ) the desired spam interface must be defined by setting this variable. Please refer to the manual section .Sx "Handling spam" for the complete picture of spam handling in \*(UA. All or none of the following interfaces may be available: .Bl -tag -width ".It Ql _ilte_" .It Ql spamc Interaction with .Xr spamc 1 from the .Xr spamassassin 1 .Pf ( Lk http://spamassassin.apache.org SpamAssassin ) suite. Different to the generic filter interface \*(UA will automatically add the correct arguments for a given command and has the necessary knowledge to parse the program's output. A default value for .Va spamc-command will have been compiled into the \*(UA binary if .Xr spamc 1 has been found in .Ev PATH during compilation. Shall it be necessary to define a specific connection type (rather than using a configuration file for that), the variable .Va spamc-arguments can be used as in, e.g., .Ql -d server.example.com -p 783 . It is also possible to specify a per-user configuration via .Va spamc-user . Note that this interface does not inspect the .Ql is-spam flag of a message for the command .Ic spamforget . .It Ql filter generic spam filter support via freely configurable hooks. This interface is meant for programs like .Xr bogofilter 1 and requires according behaviour in respect to the hooks' exit status for at least the command .Ic spamrate .Pf ( Ql 0 meaning a message is spam, .Ql 1 for non-spam, .Ql 2 for unsure and any other return value indicating a hard error); since the hooks can include shell code snippets diverting behaviour can be intercepted as necessary. The hooks are .Va spamfilter-ham , spamfilter-noham , spamfilter-nospam , \ spamfilter-rate and .Va spamfilter-spam ; the manual section .Sx "Handling spam" contains examples for some programs. The process environment of the hooks will have the variable .Ev MAILX_FILENAME_GENERATED set. Note that spam score support for .Ic spamrate is not supported unless the \*(OPtional regular expression support is available and the .Va spamfilter-rate-scanscore variable is set. .El .Mx .It Va spam-maxsize \*(OP Messages that exceed this size will not be passed through to the configured .Va spam-interface . If unset or 0, the default of 420000 bytes is used. .Mx .It Va spamc-command \*(OP The path to the .Xr spamc 1 program for the .Ql spamc .Va spam-interface . Note that the path is not expanded, but used .Dq as is . A fallback path will have been compiled into the \*(UA binary if the executable had been found during compilation. .Mx .It Va spamc-arguments \*(OP Even though \*(UA deals with most arguments for the .Ql spamc .Va spam-interface automatically, it may at least sometimes be desirable to specify connection-related ones via this variable, e.g., .Ql -d server.example.com -p 783 . .Mx .It Va spamc-user \*(OP Specify a username for per-user configuration files for the .Ql spamc .Va spam-interface . If this is set to the empty string then \*(UA will use the name of the current .Va user . .Mx .Mx .Mx .Mx .Mx .It Va spamfilter-ham , spamfilter-noham , \ spamfilter-nospam , spamfilter-rate , spamfilter-spam \*(OP Command and argument hooks for the .Ql filter .Va spam-interface . The manual section .Sx "Handling spam" contains examples for some programs. .Mx .It Va spamfilter-rate-scanscore \*(OP Because of the generic nature of the .Ql filter .Va spam-interface spam scores are not supported for it by default, but if the \*(OPnal regular expression support is available then setting this variable can be used to overcome this restriction. It is interpreted as follows: first a number (digits) is parsed that must be followed by a semicolon .Ql \&; and an extended regular expression. Then the latter is used to parse the first output line of the .Va spamfilter-rate hook, and, in case the evaluation is successful, the group that has been specified via the number is interpreted as a floating point scan score. .It Va ssl-ca-dir-USER@HOST , ssl-ca-dir-HOST , ssl-ca-dir ,\ ssl-ca-file-USER@HOST , ssl-ca-file-HOST , ssl-ca-file \*(OB\*(OP Predecessors of .Va tls-ca-file , .Va tls-ca-dir . .It Va ssl-ca-flags-USER@HOST , ssl-ca-flags-HOST , ssl-ca-flags \*(OB\*(OP Predecessor of .Va tls-ca-flags . .It Va ssl-ca-no-defaults-USER@HOST , ssl-ca-no-defaults-HOST ,\ ssl-ca-no-defaults \*(OB\*(BO\*(OP Predecessor of .Va tls-ca-no-defaults . .It Va ssl-cert-USER@HOST , ssl-cert-HOST , ssl-cert \*(OB\*(OP Please use the .Cd Certificate slot of .Va tls-config-pairs . .It Va ssl-cipher-list-USER@HOST , ssl-cipher-list-HOST , ssl-cipher-list \*(OB\*(OP Please use the .Cd CipherString slot of .Va tls-config-pairs . .It Va ssl-config-file \*(OB\*(OP Predecessor of .Va tls-config-file . .It Va ssl-config-module-USER@HOST , ssl-config-module-HOST ,\ ssl-config-module \*(OB\*(OP Predecessor of .Va tls-config-module . .It Va ssl-config-pairs-USER@HOST , ssl-config-pairs-HOST , ssl-config-pairs \*(OB\*(OP Predecessor of .Va tls-config-pairs . .It Va ssl-crl-dir , ssl-crl-file \*(OB\*(OP Predecessors of .Va tls-crl-dir , .Va tls-crl-file . .It Va ssl-curves-USER@HOST , ssl-curves-HOST , ssl-curves \*(OB\*(OP Please use the .Cd Curves slot of .Va tls-config-pairs . .It Va ssl-features \*(OB\*(OP\*(RO Predecessor of .Va tls-features . .It Va ssl-key-USER@HOST , ssl-key-HOST , ssl-key \*(OB\*(OP Please use the .Cd PrivateKey slot of .Va tls-config-pairs . .It Va ssl-method-USER@HOST , ssl-method-HOST , ssl-method \*(OB\*(OP Please use the .Cd Protocol slot of .Va tls-config-pairs . .It Va ssl-protocol-USER@HOST , ssl-protocol-HOST , ssl-protocol \*(OB\*(OP Please use the .Cd Protocol slot of .Va tls-config-pairs . .It Va ssl-rand-file \*(OB\*(OP Predecessor of .Va tls-rand-file . .It Va ssl-verify-USER@HOST , ssl-verify-HOST , ssl-verify \*(OB\*(OP Predecessor of .Va tls-verify . .Mx .It Va stealthmua If only set without an assigned value, then this setting inhibits the generation of the .Ql Message-ID: , .Ql Content-ID: and .Ql User-Agent: header fields that include obvious references to \*(UA. There are two pitfalls associated with this: First, the message id of outgoing messages is not known anymore. Second, an expert may still use the remaining information in the header to track down the originating mail user agent. If set to the value .Ql noagent , then the mentioned .Ql Message-ID: and .Ql Content-ID: suppression does not occur. .Mx .It Va system-mailrc \*(RO The compiled in path of the system wide initialization file one of the .Sx "Resource files" : .Pa \*(UR . .Mx .It Va termcap (\*(OP) This specifies a comma-separated list of .Lb libterminfo and/or .Lb libtermcap capabilities (see .Sx "On terminal control and line editor" , escape commas with reverse solidus) to be used to overwrite or define entries. .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. .Pp String capabilities form .Ql cap=value pairs and are expected unless noted otherwise. Numerics have to be notated as .Ql cap#number where the number is expected in normal decimal notation. Finally, booleans do not have any value but indicate a true or false state simply by being defined or not; this indeed means that \*(UA does not support undefining an existing boolean. String capability values will undergo some expansions before use: for one notations like .Ql ^LETTER stand for .Ql control-LETTER , and for clarification purposes .Ql \eE can be used to specify .Ql escape (the control notation .Ql ^[ could lead to misreadings when a left bracket follows, which it does for the standard CSI sequence); finally three letter octal sequences, as in .Ql \e061 , are supported. To specify that a terminal supports 256-colours, and to define sequences that home the cursor and produce an audible bell, one might write: .Bd -literal -offset indent ? set termcap='Co#256,home=\eE[H,bel=^G' .Ed .Pp The following terminal capabilities are or may be meaningful for the operation of the built-in line editor or \*(UA in general: .Pp .Bl -tag -compact -width ".It Cd yay" .It Cd am .Cd auto_right_margin : boolean which indicates if the right margin needs special treatment; the .Cd xenl capability is related, for more see .Ev COLUMNS . .It Cd clear Ns \0or Cd cl .Cd clear_screen : clear the screen and home cursor. (Will be simulated via .Cd ho plus .Cd cd . ) .It Cd colors Ns \0or Cd Co .Cd max_colors : numeric capability specifying the maximum number of colours. Note that \*(UA does not actually care about the terminal beside that, but always emits ANSI / ISO 6429 escape sequences. .It Cd cr .Cd carriage_return : move to the first column in the current row. The default built-in fallback is .Ql \er . .It Cd cub1 Ns \0or Cd le .Cd cursor_left : move the cursor left one space (non-destructively). The default built-in fallback is .Ql \eb . .It Cd cuf1 Ns \0or Cd nd .Cd cursor_right : move the cursor right one space (non-destructively). The default built-in fallback is .Ql \eE[C , which is used by most terminals. Less often occur .Ql \eEC and .Ql \eEOC . .It Cd ed Ns \0or Cd cd .Cd clr_eos : clear the screen. .It Cd el Ns \0or Cd ce .Cd clr_eol : clear to the end of line. (Will be simulated via .Cd ch plus repetitions of space characters.) .It Cd home Ns \0or Cd ho .Cd cursor_home : home cursor. .It Cd hpa Ns \0or Cd ch .Cd column_address : move the cursor (to the given column parameter) in the current row. (Will be simulated via .Cd cr plus .Cd nd . ) .It Cd rmcup Ns \0or Cd te Ns \0/ Cd smcup Ns \0or Cd ti .Cd exit_ca_mode and .Cd enter_ca_mode , respectively: exit and enter the alternative screen ca-mode, effectively turning \*(UA into a fullscreen application. This must be enabled explicitly by setting .Va termcap-ca-mode . .It Cd smkx Ns \0or Cd ks Ns \0/ Cd rmkx Ns \0or Cd ke .Cd keypad_xmit and .Cd keypad_local , respectively: enable and disable the keypad. This is always enabled if available, because it seems even keyboards without keypads generate other key codes for, e.g., cursor keys in that case, and only if enabled we see the codes that we are interested in. .It Cd xenl Ns \0or Cd xn .Cd eat_newline_glitch : boolean which indicates whether a newline written in the last column of an .Cd auto_right_margin indicating terminal is ignored. With it the full terminal width is available even on autowrap terminals. .El .Pp Many more capabilities which describe key-sequences are documented for .Ic bind . .Mx .It Va termcap-ca-mode \*(OP Allow usage of the .Cd exit_ca_mode and .Cd enter_ca_mode terminal capabilities, see .Va termcap . .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. .Mx .It Va termcap-disable \*(OP Disable any interaction with a terminal control library. If set only some generic fallback built-ins and possibly the content of .Va termcap describe the terminal to \*(UA. .Sy Note this variable will only be queried once at program startup and can thus only be specified in resource files or on the command line. .Mx Va tls-ca-file .Mx Va tls-ca-dir .It Va tls-ca-dir-USER@HOST , tls-ca-dir-HOST , tls-ca-dir ,\ tls-ca-file-USER@HOST , tls-ca-file-HOST , tls-ca-file \*(OP Directory and file, respectively, for pools of trusted CA certificates in PEM (Privacy Enhanced Mail) format, for the purpose of verification of TLS server certificates. Concurrent use is possible, the file is loaded once needed first, the directory lookup is performed anew as a last resort whenever necessary. The CA certificate pool built into the TLS library can be disabled via .Va tls-ca-no-defaults , further fine-tuning is possible via .Va tls-ca-flags . Note the directory search variant requires the certificate files to adhere special filename conventions, please see .Xr SSL_CTX_load_verify_locations 3 and .Xr verify 1 (or .Xr c_rehash 1 ) . .Mx Va tls-ca-flags .It Va tls-ca-flags-USER@HOST , tls-ca-flags-HOST , tls-ca-flags \*(OP Can be used to fine-tune behaviour of the X509 CA certificate storage, and the certificate verification that is used (also see .Va tls-verify ) . The value is expected to consist of a comma-separated list of configuration directives, with any intervening whitespace being ignored. The directives directly map to flags that can be passed to .Xr X509_STORE_set_flags 3 , which are usually defined in a file .Pa openssl/x509_vfy.h , and the availability of which depends on the used TLS library version: a directive without mapping is ignored (error log subject to .Va debug ) . Directives currently understood (case-insensitively) include: .Pp .Bl -tag -compact -width ".It Cd BaNg" .It Cd no-alt-chains If the initial chain is not trusted, do not attempt to build an alternative chain. Setting this flag will make OpenSSL certificate verification match that of older OpenSSL versions, before automatic building and checking of alternative chains has been implemented; also see .Cd trusted-first . .It Cd no-check-time Do not check certificate/CRL validity against current time. .It Cd partial-chain By default partial, incomplete chains which cannot be verified up to the chain top, a self-signed root certificate, will not verify. With this flag set, a chain succeeds to verify if at least one signing certificate of the chain is in any of the configured trusted stores of CA certificates. The OpenSSL manual page .Xr SSL_CTX_load_verify_locations 3 gives some advise how to manage your own trusted store of CA certificates. .It Cd strict Disable workarounds for broken certificates. .It Cd trusted-first Try building a chain using issuers in the trusted store first to avoid problems with server-sent legacy intermediate certificates. Newer versions of OpenSSL support alternative chain checking and enable it by default, resulting in the same behaviour; also see .Cd no-alt-chains . .El .Mx Va tls-ca-no-defaults .It Va tls-ca-no-defaults-USER@HOST , tls-ca-no-defaults-HOST ,\ tls-ca-no-defaults \*(BO\*(OP Do not load the default CA locations that are built into the used to TLS library to verify TLS server certificates. .Mx .It Va tls-config-file \*(OP If this variable is set .Xr CONF_modules_load_file 3 (if announced via .Ql +modules-load-file in .Va tls-features ) is used to allow resource file based configuration of the TLS library. This happens once the library is used first, which may also be early during startup (logged with .Va verbose ) ! If a non-empty value is given then the given file, after performing .Sx "Filename transformations" , will be used instead of the TLS libraries global default, and it is an error if the file cannot be loaded. The application name will always be passed as .Ql \*(uA . Some TLS libraries support application-specific configuration via resource files loaded like this, please see .Va tls-config-module . .Mx Va tls-config-module .It Va tls-config-module-USER@HOST , tls-config-module-HOST ,\ tls-config-module \*(OP If file based application-specific configuration via .Va tls-config-file is available, announced as .Ql +ctx-config by .Va tls-features , indicating availability of .Xr SSL_CTX_config 3 , then, it becomes possible to use a central TLS configuration file for all programs, including \*(uA, e.g.: .Bd -literal -offset indent # Register a configuration section for \*(uA \*(uA = mailx_master # The top configuration section creates a relation # in between dynamic SSL configuration and an actual # program specific configuration section [mailx_master] ssl_conf = mailx_tls_config # Well that actual program specific configuration section # now can map individual tls-config-module names to sections, # e.g., tls-config-module=account_xy [mailx_tls_config] account_xy = mailx_account_xy account_yz = mailx_account_yz [mailx_account_xy] MinProtocol = TLSv1.2 Curves=P-521 [mailx_account_yz] CipherString = TLSv1.2:!aNULL:!eNULL: MinProtocol = TLSv1.1 Options = Bugs .Ed .Mx Va tls-config-pairs .It Va tls-config-pairs-USER@HOST , tls-config-pairs-HOST , tls-config-pairs \*(OP The value of this variable chain will be interpreted as a comma-separated list of directive/value pairs. Directives and values need to be separated by equals signs .Ql = , any whitespace surrounding pair members is removed. Keys are (usually) case-insensitive. Different to when placing these pairs in a .Va tls-config-module section of a .Va tls-config-file , commas .Ql \&, need to be escaped with a reverse solidus .Ql \e when included in pairs; also different: if the equals sign .Ql = is preceded with an asterisk .Ql * .Sx "Filename transformations" will be performed on the value; it is an error if these fail. Unless proper support is announced by .Va tls-features .Pf ( Ql +conf-ctx ) only the keys below are supported, otherwise the pairs will be used directly as arguments to the function .Xr SSL_CONF_cmd 3 . .Pp .Bl -tag -compact -width ".It Cd C_rtificate_" .It Cd Certificate Filename of a TLS client certificate (chain) required by some servers. Fallback support via .Xr SSL_CTX_use_certificate_chain_file 3 . .Sx "Filename transformations" are performed. .Sy Note: if you use this you need to specify the private key via .Cd PrivateKey , .Va tls-key will not be used! .It Cd CipherString A list of ciphers for TLS connections, see .Xr ciphers 1 . By default no list of ciphers is set, resulting in a .Cd Protocol Ns - Ns specific list of ciphers (the protocol standards define lists of acceptable ciphers; possibly cramped by the used TLS library). Fallback support via .Xr SSL_CTX_set_cipher_list 3 . .It Cd Ciphersuites A list of ciphers used for TLSv1.3 connections, see .Xr ciphers 1 . These will be joined onto the list of ciphers from .Cd CipherString . Available if .Va tls-features announces .Ql +ctx-set-ciphersuites , as necessary via .Xr SSL_CTX_set_ciphersuites 3 . .It Cd Curves A list of supported elliptic curves, if applicable. By default no curves are set. Fallback support via .Xr SSL_CTX_set1_curves_list 3 , if available. .It Cd MaxProtocol , MinProtocol The maximum and minimum supported TLS versions, respectively. Available if .Va tls-features announces .Ql +ctx-set-maxmin-proto , as necessary via .Xr SSL_CTX_set_max_proto_version 3 and .Xr SSL_CTX_set_min_proto_version 3 ; these fallbacks use an internal parser which understands the strings .Ql SSLv3 , .Ql TLSv1 , .Ql TLSv1.1 , .Ql TLSv1.2 , .Ql TLSv1.3 , and the special value .Ql None , which disables the given limit. .It Cd Options Various flags to set. Fallback via .Xr SSL_CTX_set_options 3 , in which case any other value but (exactly) .Ql Bugs results in an error. .It Cd PrivateKey Filename of the private key in PEM format of a TLS client certificate. If unset, the name of the certificate file is used. .Sx "Filename transformations" are performed. Fallback via .Xr SSL_CTX_use_PrivateKey_file 3 . .Sy Note: if you use this you need to specify the certificate (chain) via .Cd Certificate , .Va tls-cert will not be used! .It Cd Protocol The used TLS protocol. If .Va tls-features announces .Ql +conf-ctx or .Ql ctx-set-maxmin-proto then using .Cd MaxProtocol and .Cd MinProtocol is preferable. Fallback is .Xr SSL_CTX_set_options 3 , driven via an internal parser which understands the strings .Ql SSLv3 , .Ql TLSv1 , .Ql TLSv1.1 , .Ql TLSv1.2 , .Ql TLSv1.3 , and the special value .Ql ALL . Multiple protocols may be given as a comma-separated list, any whitespace is ignored, an optional plus sign .Ql + prefix enables, a hyphen-minus .Ql - prefix disables a protocol, so that .Ql -ALL, TLSv1.2 enables only the TLSv1.2 protocol. .El .Mx .Mx .It Va tls-crl-dir , tls-crl-file \*(OP Specify a directory / a file, respectively, that contains a CRL in PEM format to use when verifying TLS server certificates. .Mx .It Va tls-features \*(OP\*(RO This expands to a comma-separated list of the TLS library identity and optional features. Currently supported identities are .Ql libressl (LibreSSL) , .Ql libssl-0x10100 (OpenSSL v1.1.x series) and .Ql libssl-0x10000 (elder OpenSSL series, other clones). Optional features are preceded with a plus sign .Ql + when available, and with a hyphen-minus .Ql - otherwise. .Pp Currently known features are .Ql conf-ctx .Pf ( Va tls-config-pairs ) , .Ql ctx-config .Pf ( Va tls-config-module ) , .Ql ctx-set-ciphersuites .Pf ( Cd Ciphersuites slot of .Va tls-config-pairs ) , .Ql ctx-set-maxmin-proto .Pf ( Va tls-config-pairs ) , .Ql modules-load-file .Pf ( Va tls-config-file ) , and .Ql tls-rand-file .Pf ( Va tls-rand-file ) . .Mx Va tls-fingerprint .It Va tls-fingerprint-USER@HOST , tls-fingerprint-HOST , tls-fingerprint \*(OP It is possible to replace the verification of the connection peer certificate against the entire local pool of CAs (for more see .Sx "Encrypted network communication" ) with the comparison against a precalculated certificate message digest, the so-called fingerprint, to be specified as the used .Va tls-fingerprint-digest . This fingerprint can be calculated with, e.g., .Ql Ic tls Ns \:\0\:fingerprint HOST . .Mx Va tls-fingerprint-digest .It Va tls-fingerprint-digest-USER@HOST , tls-fingerprint-digest-HOST , \ tls-fingerprint-digest \*(OP The message digest to be used when creating TLS certificate fingerprints, the defaults, if available, in test order, being .Ql BLAKE2s256 , .Ql SHA256 . For the complete list of digest algorithms refer to .Va smime-sign-digest . .Mx .It Va tls-rand-file \*(OP If .Va tls-features announces .Ql +tls-rand-file then this will be queried to find a file with random entropy data which can be used to seed the P(seudo)R(andom)N(umber)G(enerator), see .Xr RAND_load_file 3 . The default filename .Pf ( Xr RAND_file_name 3 , normally .Pa ~/.rnd ) will be used if this variable is not set or empty, or if the .Sx "Filename transformations" fail. Shall seeding the PRNG have been successful, .Xr RAND_write_file 3 will be called to update the entropy. Remarks: libraries which do not announce this feature seed the PRNG by other means. .Mx Va tls-verify .It Va tls-verify-USER@HOST , tls-verify-HOST , tls-verify \*(OP Variable chain that sets the action to be performed if an error occurs during TLS server certificate validation against the specified or default trust stores .Va tls-ca-dir , .Va tls-ca-file , or the TLS library built-in defaults (unless usage disallowed via .Va tls-ca-no-defaults ) , and as fine-tuned via .Va tls-ca-flags . Valid (case-insensitive) values are .Ql strict (fail and close connection immediately), .Ql ask (ask whether to continue on standard input), .Ql warn (show a warning and continue), .Ql ignore (do not perform validation). The default is .Ql ask . .Mx .It Va toplines If defined, gives the number of lines of a message to be displayed with the command .Ic top ; if unset, the first five lines are printed, if set to 0 the variable .Va screen is inspected. If the value is negative then its absolute value will be used for unsigned right shifting (see .Ic vexpr ) the .Va screen height. .Mx .It Va topsqueeze \*(BO If set then the .Ic top command series will strip adjacent empty lines and quotations. .Mx .It Va ttycharset The character set of the terminal \*(UA operates on, and the one and only supported character set that \*(UA can use if no character set conversion capabilities have been compiled into it, in which case it defaults to ISO-8859-1. Otherwise it defaults to UTF-8. Sufficient locale support provided the default will be preferably deduced from the locale environment if that is set (e.g., .Ev LC_CTYPE , see there for more); runtime locale changes will be reflected by .Va \&\&ttycharset except during the program startup phase and if .Fl S had been used to freeze the given value. Refer to the section .Sx "Character sets" for the complete picture about character sets. .Mx .It Va typescript-mode \*(BO A special multiplex variable that disables all variables and settings which result in behaviour that interferes with running \*(UA in .Xr script 1 , e.g., it sets .Va colour-disable , .Va line-editor-disable and (before startup completed only) .Va termcap-disable . Unsetting it does not restore the former state of the covered settings. .Mx .It Va umask For a safe-by-default policy the process file mode creation mask .Xr umask 2 will be set to .Ql 0077 on program startup by default. Child processes inherit the file mode creation mask of their parent, and by setting this variable to an empty value no change will be applied, and the inherited value will be used. Otherwise the given value will be made the new file mode creation mask. .Mx Va user .It Va user-HOST , user \*(IN Variable chain that sets a global fallback user name, which is used in case none has been given in the protocol and account-specific URL. This variable defaults to the name of the user who runs \*(UA. .Mx .It Va v15-compat Enable upward compatibility with \*(UA version 15.0 in respect to which configuration options are available and how they are handled. If set to a non-empty value the command modifier .Cm wysh is implied and thus enforces .Sx "Shell-style argument quoting" over .Sx "Old-style argument quoting" for all commands which support both. This manual uses \*(IN and \*(OU to refer to the new and the old way of doing things, respectively. .Mx .It Va verbose \*(BO This setting, also controllable via the command line option .Fl v , causes \*(UA to be more verbose, e.g., it will display obsoletion warnings and TLS certificate chains. Even though marked \*(BO this option may be set twice in order to increase the level of verbosity even more, in which case even details of the actual message delivery and protocol conversations are shown. A single .Pf no Va verbose is sufficient to disable verbosity as such. .Mx .Mx .Mx .Mx .Mx .Mx .It Va version , version-date , \ version-hexnum , version-major , version-minor , version-update \*(RO \*(UA version information: the first variable is a string with the complete version identification, the second the release date in ISO 8601 notation without time. The third is a 32-bit hexadecimal number with the upper 8 bits storing the major, followed by the minor and update version numbers which occupy 12 bits each. The latter three variables contain only decimal digits: the major, minor and update version numbers. The output of the command .Ic version will include this information. .Mx .It Va writebackedited If this variable is set messages modified using the .Ic edit or .Ic visual commands are written back to the current folder when it is quit; it is only honoured for writable folders in MBOX format, though. Note that the editor will be pointed to the raw message content in that case, i.e., neither MIME decoding nor decryption will have been performed, and proper .Va mbox-rfc4155 .Ql From_ quoting of newly added or edited content is also left as an exercise to the user. .El .Sh ENVIRONMENT The term .Dq environment variable should be considered an indication that these variables are either standardized as vivid parts of process environments, or that they are commonly found in there. The process environment is inherited from the .Xr sh 1 once \*(UA is started, and unless otherwise explicitly noted handling of the following variables transparently integrates into that of the .Sx "INTERNAL VARIABLES" from \*(UA's point of view. This means that, e.g., they can be managed via .Ic set and .Ic unset , causing automatic program environment updates (to be inherited by newly created child processes). .Pp In order to integrate other environment variables equally they need to be imported (linked) with the command .Ic environ . This command can also be used to set and unset non-integrated environment variables from scratch, sufficient system support provided. The following example, applicable to a POSIX shell, sets the .Ev COLUMNS environment variable for \*(UA only, and beforehand exports the .Ev EDITOR in order to affect any further processing in the running shell: .Bd -literal -offset indent $ EDITOR="vim -u ${HOME}/.vimrc" $ export EDITOR $ COLUMNS=80 \*(uA -R .Ed .Bl -tag -width ".It Ev BaNg" .Mx .It Ev COLUMNS The user's preferred width in column positions for the terminal screen. Queried and used once on program startup in interactive or batch .Pf ( Fl \&# ) mode, actively managed for child processes and the MLE (see .Sx "On terminal control and line editor" ) in interactive mode thereafter. Non-interactive mode always uses, and the fallback default is a compile-time constant, by default 80 columns. If in batch mode .Ev \&\&COLUMNS and .Ev LINES are both set but not both are usable (empty, not a number, or 0) at program startup, then the real terminal screen size will be (tried to be) determined once. (Normally the .Xr sh 1 manages these variables, and unsets them for pipe specifications etc.) Dependent on terminal control support the used width may be one less than this value for compatibility reasons, refer to the .Cd am / xenl capabilities of .Va termcap for more. .Mx .It Ev DEAD The name of the (mailbox) .Ic file to use for saving aborted messages if .Va save is set; this defaults to .Pa \*(VD . If the variable .Va debug is set no output will be generated, otherwise the contents of the file will be replaced. .Mx .It Ev EDITOR Pathname of the text editor to use for the .Ic edit command and .Ic ~e .Pf (see\0 Sx "COMMAND ESCAPES" ) ; .Ev VISUAL is used for a more display oriented editor. .Mx .It Ev HOME The user's home directory. This variable is only used when it resides in the process environment. The calling user's home directory will be used instead if this directory does not exist, is not accessible or cannot be read; it will always be used for the root user. (No test for being writable is performed to allow usage by non-privileged users within read-only jails, but dependent on the variable settings this directory is a default write target, e.g. for .Ev DEAD , .Ev MBOX and more.) .Mx .Mx .Mx .It Ev LC_ALL , LC_CTYPE , LANG \*(OP The (names in lookup order of the) .Xr locale 7 (and / or see .Xr setlocale 3 ) which indicates the used .Sx "Character sets" . Runtime changes trigger automatic updates of the entire locale system, which includes updating .Va ttycharset (except during startup if the variable has been frozen via .Fl S ) . .Mx .It Ev LINES The user's preferred number of lines for the terminal screen. The behaviour is as described for .Ev COLUMNS , yet the compile-time constant used in non-interactive mode and as a fallback defaults to 24 (lines). .Mx .It Ev LISTER Pathname of the directory lister to use in the .Ic folders command when operating on local mailboxes. Default is .Xr ls 1 (path search through .Ev SHELL ) . .Mx .It Ev LOGNAME Upon startup \*(UA will actively ensure that this variable refers to the name of the user who runs \*(UA, in order to be able to pass a verified name to any newly created child process. .Mx .It Ev MAIL Is used as the user's .Mx -sx .Sx "primary system mailbox" unless .Va inbox is set. This is assumed to be an absolute pathname. If this environmental fallback is also not set, a built-in compile-time default is used. .Mx .It Ev MAILCAPS \*(OP Overrides the default path search for .Sx "The Mailcap files" , which is defined in the standard RFC 1524 as .Ql ~/.mailcap:\:/etc/mailcap:\:/usr/etc/mailcap:\:/usr/local/etc/mailcap . (\*(UA makes it a configuration option, however.) Note this is not a search path, but a path search. .Mx .It Ev MAILRC Is used as a startup file instead of .Pa \*(ur if set. In order to avoid side-effects from configuration files scripts should either set this variable to .Pa /dev/null or the .Fl \&: command line option should be used. .Mx .It Ev MAILX_NO_SYSTEM_RC If this variable is set then reading of .Pa \*(UR (aka\& .Va system-mailrc ) at startup is inhibited, i.e., the same effect is achieved as if \*(UA had been started up with the option .Fl \&: (and according argument) or .Fl n . This variable is only used when it resides in the process environment. .Mx .It Ev MBOX The name of the user's .Mx -sx .Sx "secondary mailbox" file. A logical subset of the special .Sx "Filename transformations" (also see .Ic file ) are supported. The default is .Pa \*(VM . Traditionally this MBOX is used as the file to save messages from the .Mx -sx .Sx "primary system mailbox" that have been read. Also see .Sx "Message states" . .Mx .It Ev NETRC \*(IN\*(OP This variable overrides the default location of the user's .Pa \*(VN file. .Mx .It Ev PAGER Pathname of the program to use for backing the command .Ic more , and when the .Va crt variable enforces usage of a pager for output. The default paginator is .Xr more 1 (path search through .Ev SHELL ) . .Pp \*(UA inspects the contents of this variable: if its contains the string .Dq less then a non-existing environment variable .Ev LESS will be set to .Ql Ri , likewise for .Dq lv .Ev LV will optionally be set to .Ql -c . Alse see .Va colour-pager . .Mx .It Ev PATH A colon-separated list of directories that is searched by the shell when looking for commands, e.g., .Ql /bin:/usr/bin:/usr/local/bin . .Mx .It Ev POSIXLY_CORRECT This variable is automatically looked for upon startup, see .Va posix for more. .Mx .It Ev SHELL The shell to use for the commands .Ic \&! , .Ic shell , the .Ic ~! .Sx "COMMAND ESCAPES" and when starting subprocesses. A default shell is used if this environment variable is not defined. .Mx .It Ev SOURCE_DATE_EPOCH Specifies a time in seconds since the Unix epoch (1970-01-01) to be used in place of the current time. This variable is looked up upon program startup, and its existence will switch \*(UA to a reproducible mode .Pf ( Lk https://reproducible-builds.org ) which uses deterministic random numbers, a special fixated pseudo .Ev LOGNAME and more. This operation mode is used for development and by software packagers. \*(ID Currently an invalid setting is only ignored, rather than causing a program abortion. .Pp .Dl $ SOURCE_DATE_EPOCH=`date +%s` \*(uA .Mx .It Ev TERM \*(OP The terminal type for which output is to be prepared. For extended colour and font control please refer to .Sx "Coloured display" , and for terminal management in general to .Sx "On terminal control and line editor" . .Mx .It Ev TMPDIR Except for the root user this variable defines the directory for temporary files to be used instead of .Pa \*(VT (or the given compile-time constant) if set, existent, accessible as well as read- and writable. This variable is only used when it resides in the process environment, but \*(UA will ensure at startup that this environment variable is updated to contain a usable temporary directory. .Mx .It Ev USER Identical to .Ev LOGNAME (see there), but this variable is not standardized, should therefore not be used, and is only corrected if already set. .Mx .It Ev VISUAL Pathname of the text editor to use for the .Ic visual command and .Ic ~v .Pf (see\0 Sx "COMMAND ESCAPES" ) ; .Ev EDITOR is used for a less display oriented editor. .El .Sh FILES .Bl -tag -width ".It Pa BaNg" .It Pa \*(ur User-specific file giving initial commands, one of the .Sx "Resource files" . The actual value is read from .Va MAILRC . .It Pa \*(UR System wide initialization file, one of the .Sx "Resource files" . The actual value is read from .Va system-mailrc . .Mx .It Pa ~/.mailcap \*(OP Personal MIME type handler definition file, see .Sx "The Mailcap files" . This location is part of the RFC 1524 standard search path, which is a configuration option and can be overridden via .Ev MAILCAPS . .Mx .It Pa /etc/mailcap \*(OP System wide MIME type handler definition file, see .Sx "The Mailcap files" . This location is part of the RFC 1524 standard search path, which is a configuration option and can be overridden via .Mx .It Pa \*(VM The default value for .Ev MBOX . .Mx .It Pa \*(vU Personal MIME types, see .Sx "The mime.types files" . .Mx .It Pa \*(vS System wide MIME types, see .Sx "The mime.types files" . .Mx .It Pa \*(VN \*(IN\*(OP The default location of the user's .Pa .netrc file \(en the section .Sx "The .netrc file" documents the file format. The actually used path can be overridden via .Ev NETRC . .Mx .It Pa /dev/null The data sink .Xr null 4 . .El .Ss "Resource files" Upon startup \*(UA reads in several resource files, in order: .Bl -tag -width ".It Pa BaNg" .Mx .It Pa \*(UR System wide initialization file .Pf ( Va system-mailrc ) . Reading of this file can be suppressed, either by using the .Fl \&: (and according argument) or .Fl n command line options, or by setting the .Sx ENVIRONMENT variable .Ev MAILX_NO_SYSTEM_RC . .Mx .It Pa \*(ur File giving initial commands. A different file can be chosen by setting the .Sx ENVIRONMENT variable .Ev MAILRC . Reading of this file can be suppressed with the .Fl \&: command line option. .It Va mailx-extra-rc Defines a startup file to be read after all other resource files. It can be used to specify settings that are not understood by other .Xr mailx 1 implementations, for example. This variable is only honoured when defined in a resource file, e.g., it is one of the .Sx "INTERNAL VARIABLES" . .El .Pp The content of these files is interpreted as follows: .Pp .Bl -bullet -compact .It The whitespace characters space, tabulator and newline, as well as those defined by the variable .Va ifs , are removed from the beginning and end of input lines. .It Empty lines are ignored. .It Any other line is interpreted as a command. It may be spread over multiple input lines if the newline character is .Dq escaped by placing a reverse solidus character .Ql \e as the last character of the line; whereas any leading whitespace of follow lines is ignored, trailing whitespace before a escaped newline remains in the input. .It If the line (content) starts with the number sign .Ql # then it is a comment-command and also ignored. (The comment-command is a real command, which does nothing, and therefore the usual follow lines mechanism applies!) .El .Pp Unless \*(UA is about to enter interactive mode syntax errors that occur while loading these files are treated as errors and cause program exit. More files with syntactically equal content can be .Ic source Ns ed . The following, saved in a file, would be an examplary content: .Bd -literal -offset indent # This line is a comment command. And y\e es, it is really continued here. set debug \e verbose set editheaders .Ed .Ss "The mime.types files" As stated in .Sx "HTML mail and MIME attachments" \*(UA needs to learn about MIME (Multipurpose Internet Mail Extensions) media types in order to classify message and attachment content. One source for them are .Pa mime.types files, the loading of which can be controlled by setting the variable .Va mimetypes-load-control . Another is the command .Ic mimetype , which also offers access to \*(UAs MIME type cache. .Pa mime.types files have the following syntax: .Bd -literal -offset indent type/subtype extension [extension ...] # E.g.: text/html html htm .Ed .Pp where .Ql type/subtype define the MIME media type, as standardized in RFC 2046: .Ql type is used to declare the general type of data, while the .Ql subtype specifies a specific format for that type of data. One or multiple filename .Ql extension Ns s, separated by whitespace, can be bound to the media type format. Comments may be introduced anywhere on a line with a number sign .Ql # , causing the remaining line to be discarded. \*(UA also supports an extended, non-portable syntax in especially crafted files, which can be loaded via the alternative value syntax of .Va mimetypes-load-control , and prepends an optional .Ql type-marker : .Pp .Dl [type-marker ]type/subtype extension [extension ...] .Pp The following type markers are supported: .Pp .Bl -tag -compact -width ".It Ar _n_u" .It Ar \&? Treat message parts with this content as plain text. .It Ar ?t The same as plain .Ar \&? . .It Ar ?h Treat message parts with this content as HTML tagsoup. If the \*(OPal HTML-tagsoup-to-text converter is not available treat the content as plain text instead. .It Ar ?H Likewise .Ar ?h , but instead of falling back to plain text require an explicit content handler to be defined. .It Ar ?q If no handler can be found a text message is displayed which says so. This can be annoying, for example signatures serve a contextual purpose, their content is of no use by itself. This marker will avoid displaying the text message. .El .Pp Further reading: for sending messages: .Ic mimetype , .Va mime-allow-text-controls , .Va mimetypes-load-control . For reading etc. messages: .Sx "HTML mail and MIME attachments" , .Sx "The Mailcap files" , .Ic mimetype , .Va mime-counter-evidence , .Va mimetypes-load-control , .Va pipe-TYPE/SUBTYPE , .Va pipe-EXTENSION . .Ss "The Mailcap files" .Sy This feature is not available in v14.9.0, sorry! RFC 1524 defines a .Dq User Agent Configuration Mechanism which \*(UA \*(OPally supports (see .Sx "HTML mail and MIME attachments" ) . It defines a file format to be used to inform mail user agent programs about the locally-installed facilities for handling various data formats, i.e., about commands and how they can be used to display, edit et cetera MIME part contents, as well as a default path search that includes multiple possible locations of .Dq mailcap files and the .Ev MAILCAPS environment variable that can be used to overwrite that (repeating here that it is not a search path, but instead a path search specification). Any existing files will be loaded in sequence, appending any content to the list of MIME type handler directives. .Pp .Dq Mailcap files consist of a set of newline separated entries. Comment lines start with a number sign .Ql # (in the first column!) and are ignored. Empty lines are also ignored. All other lines form individual entries that must adhere to the syntax described below. To extend a single entry (not comment) its line can be continued on follow lines if newline characters are .Dq escaped by preceding them with the reverse solidus character .Ql \e . The standard does not specify how leading whitespace of follow lines is to be treated, therefore \*(UA retains it. .Pp .Dq Mailcap entries consist of a number of semicolon .Ql \&; separated fields, and the reverse solidus .Ql \e character can be used to escape any following character including semicolon and itself. The first two fields are mandatory and must occur in the specified order, the remaining fields are optional and may appear in any order. Leading and trailing whitespace of content is ignored (removed). .Pp The first field defines the MIME .Ql TYPE/SUBTYPE the entry is about to handle (case-insensitively, and no reverse solidus escaping is possible in this field). If the subtype is specified as an asterisk .Ql * the entry is meant to match all subtypes of the named type, e.g., .Ql audio/* would match any audio type. The second field defines the shell command which shall be used to .Dq display MIME parts of the given type; it is implicitly called the .Cd view command. .Pp For data .Dq consuming shell commands message (MIME part) data is passed via standard input unless the given shell command includes one or more instances of the (unquoted) string .Ql %s , in which case these instances will be replaced with a temporary filename and the data will have been stored in the file that is being pointed to. Likewise, for data .Dq producing shell commands data is assumed to be generated on standard output unless the given command includes (one ore multiple) .Ql %s . In any case any given .Ql %s format is replaced with a(n already) properly quoted filename. Note that when a command makes use of a temporary file via .Ql %s then \*(UA will remove it again, as if the .Cd x-mailx-tmpfile , .Cd x-mailx-tmpfile-fill and .Cd x-mailx-tmpfile-unlink flags had been set; see below for more. .Pp The optional fields either define a shell command or an attribute (flag) value, the latter being a single word and the former being a keyword naming the field followed by an equals sign .Ql = succeeded by a shell command, and as usual for any .Dq Mailcap content any whitespace surrounding the equals sign will be removed, too. Optional fields include the following: .Bl -tag -width ".It Cd BaNg" .It Cd compose A program that can be used to compose a new body or body part in the given format. (Currently unused.) .It Cd composetyped Similar to the .Cd compose field, but is to be used when the composing program needs to specify the .Ql Content-type: header field to be applied to the composed data. (Currently unused.) .It Cd edit A program that can be used to edit a body or body part in the given format. (Currently unused.) .It Cd print A program that can be used to print a message or body part in the given format. (Currently unused.) .It Cd test Specifies a program to be run to test some condition, e.g., the machine architecture, or the window system in use, to determine whether or not this mailcap entry applies. If the test fails, a subsequent mailcap entry should be sought; also see .Cd x-mailx-test-once . .Mx .It Cd needsterminal This flag field indicates that the given shell command must be run on an interactive terminal. \*(UA will temporarily release the terminal to the given command in interactive mode, in non-interactive mode this entry will be entirely ignored; this flag implies .Cd x-mailx-noquote . .Mx .It Cd copiousoutput A flag field which indicates that the output of the .Cd view command will be an extended stream of textual output that can be (re)integrated into \*(UA's normal visual display. It is mutually exclusive with .Cd needsterminal . .It Cd textualnewlines A flag field which indicates that this type of data is line-oriented and that, if encoded in .Ql base64 , all newlines should be converted to canonical form (CRLF) before encoding, and will be in that form after decoding. (Currently unused.) .It Cd nametemplate This field gives a filename format, in which .Ql %s will be replaced by a random string, the joined combination of which will be used as the filename denoted by .Ev MAILX_FILENAME_TEMPORARY . One could specify that a GIF file being passed to an image viewer should have a name ending in .Ql .gif by using .Ql nametemplate=%s.gif . Note that \*(UA ignores the name template unless that solely specifies a filename suffix that consists of (ASCII) alphabetic and numeric characters, the underscore and dot only. .It Cd x11-bitmap Names a file, in X11 bitmap (xbm) format, which points to an appropriate icon to be used to visually denote the presence of this kind of data. This field is not used by \*(UA. .It Cd description A textual description that describes this type of data. .Mx .It Cd x-mailx-even-if-not-interactive An extension flag test field \(em by default handlers without .Cd copiousoutput are entirely ignored in non-interactive mode, but if this flag is set then their use will be considered. It is an error if this flag is set for commands that use the flag .Cd needsterminal . .Mx .It Cd x-mailx-noquote An extension flag field that indicates that even a .Cd copiousoutput .Cd view command shall not be used to generate message quotes (as it would be by default). .Mx .It Cd x-mailx-async Extension flag field that denotes that the given .Cd view command shall be executed asynchronously, without blocking \*(UA. Cannot be used in conjunction with .Cd needsterminal . .Mx .It Cd x-mailx-test-once Extension flag which denotes whether the given .Cd test command shall be evaluated once only and the (boolean) result be cached. This is handy if some global unchanging condition is to be queried, like .Dq running under the X Window System . .Mx .It Cd x-mailx-tmpfile Extension flag field that requests creation of a zero-sized temporary file, the name of which is to be placed in the environment variable .Ev MAILX_FILENAME_TEMPORARY . It is an error to use this flag with commands that include a .Ql %s format. .Mx .It Cd x-mailx-tmpfile-fill Normally the MIME part content is passed to the handler via standard input; if this flag is set then the data will instead be written into the implied .Cd x-mailx-tmpfile . In order to cause deletion of the temporary file you will have to set .Cd x-mailx-tmpfile-unlink explicitly! It is an error to use this flag with commands that include a .Ql %s format. .Mx .It Cd x-mailx-tmpfile-unlink Extension flag field that requests that the temporary file shall be deleted automatically when the command loop is entered again at latest. (Do not use this for asynchronous handlers.) It is an error to use this flag with commands that include a .Ql %s format, or in conjunction with .Cd x-mailx-async , or without also setting .Cd x-mailx-tmpfile or .Cd x-mailx-tmpfile-fill . .Mx .It Cd x-mailx-tmpfile-keep Using the string .Ql %s implies the three tmpfile related flags above, but if you want, e.g., .Cd x-mailx-async and deal with the temporary file yourself, you can add in this flag to forcefully ignore .Cd x-mailx-tmpfile-unlink . .El .Pp The standard includes the possibility to define any number of additional entry fields, prefixed by .Ql x- . Flag fields apply to the entire .Dq Mailcap entry \(em in some unusual cases, this may not be desirable, but differentiation can be accomplished via separate entries, taking advantage of the fact that subsequent entries are searched if an earlier one does not provide enough information. E.g., if a .Cd view command needs to specify the .Cd needsterminal flag, but the .Cd compose command shall not, the following will help out the latter (with enabled .Va debug or an increased .Va verbose level \*(UA will show information about handler evaluation): .Bd -literal -offset indent application/postscript; ps-to-terminal %s; needsterminal application/postscript; ps-to-terminal %s; compose=idraw %s .Ed .Pp In fields any occurrence of the format string .Ql %t will be replaced by the .Ql TYPE/SUBTYPE specification. Named parameters from the .Ql Content-type: field may be placed in the command execution line using .Ql %{ followed by the parameter name and a closing .Ql } character. The entire parameter should appear as a single command line argument, regardless of embedded spaces; thus: .Bd -literal -offset indent # Message Content-type: multipart/mixed; boundary=42 # Mailcap file multipart/*; /usr/local/bin/showmulti \e %t %{boundary} ; composetyped = /usr/local/bin/makemulti # Executed shell command /usr/local/bin/showmulti multipart/mixed 42 .Ed .Pp Note that \*(UA does not support handlers for multipart MIME parts as shown in this example (as of today). \*(UA does not support the additional formats .Ql %n and .Ql %F . An example file, also showing how to properly deal with the expansion of .Ql %s , which includes any quotes that are necessary to make it a valid shell argument by itself and thus will cause undesired behaviour when placed in additional user-provided quotes: .Bd -literal -offset indent # Comment line text/richtext; richtext %s; copiousoutput text/x-perl; perl -cWT %s application/pdf; \e infile=%s\e; \e trap "rm -f ${infile}" EXIT\e; \e trap "exit 75" INT QUIT TERM\e; \e mupdf %s; \e x-mailx-async; x-mailx-tmpfile-keep application/*; echo "This is \e"%t\e" but \e is 50 \e% Greek to me" \e; < %s head -c 1024 | cat -vet; \e copiousoutput; x-mailx-noquote .Ed .Pp Further reading: .Sx "HTML mail and MIME attachments" , .Sx "The mime.types files" , .Ic mimetype , .Ev MAILCAPS , .Va mime-counter-evidence , .Va pipe-TYPE/SUBTYPE , .Va pipe-EXTENSION . .Ss "The .netrc file" The .Pa .netrc file contains user credentials for machine accounts. The default location .Pa \*(VN may be overridden by the .Ev NETRC environment variable. It is possible to load encrypted .Pa .netrc files by using an appropriate value in .Va netrc-pipe . .Pp The file consists of space, tabulator or newline separated tokens. \*(UA implements a parser that supports a superset of the original BSD syntax, but users should nonetheless be aware of portability glitches of that file format, shall their .Pa .netrc be usable across multiple programs and platforms: .Pp .Bl -bullet -compact .It BSD does not support single, but only double quotation marks, e.g., .Ql password="pass with spaces" . .It BSD (only?) supports escaping of single characters via a reverse solidus (e.g., a space can be escaped via .Ql \e\0 ) , in- as well as outside of a quoted string. .It BSD does not require a final quotation mark of the last user input token. .It The original BSD (Berknet) parser also supported a format which allowed tokens to be separated with commas \(en whereas at least Hewlett-Packard still seems to support this syntax, \*(UA does not! .It As a non-portable extension some widely-used programs support shell-style comments: if an input line starts, after any amount of whitespace, with a number sign .Ql # , then the rest of the line is ignored. .It Whereas other programs may require that the .Pa .netrc file is accessible by only the user if it contains a .Cd password token for any other .Cd login than .Dq anonymous , \*(UA will always require these strict permissions. .El .Pp Of the following list of supported tokens \*(UA only uses (and caches) .Cd machine , .Cd login and .Cd password . At runtime the command .Ic netrc can be used to control \*(UA's .Pa .netrc cache. .Bl -tag -width ".It Cd BaNg" .It Cd machine Ar name The hostname of the entries' machine, lowercase-normalized by \*(UA before use. Any further file content, until either end-of-file or the occurrence of another .Cd machine or a .Cd default first-class token is bound (only related) to the machine .Ar name . .Pp As an extension that should not be the cause of any worries \*(UA supports a single wildcard prefix for .Ar name : .Bd -literal -offset indent machine *.example.com login USER password PASS machine pop3.example.com login USER password PASS machine smtp.example.com login USER password PASS .Ed .Pp which would match .Ql xy.example.com as well as .Ql pop3.example.com , but neither .Ql example.com nor .Ql local.smtp.example.com . Note that in the example neither .Ql pop3.example.com nor .Ql smtp.example.com will be matched by the wildcard, since the exact matches take precedence (it is however faster to specify it the other way around). .It Cd default This is the same as .Cd machine except that it is a fallback entry that is used shall none of the specified machines match; only one default token may be specified, and it must be the last first-class token. .It Cd login Ar name The user name on the remote machine. .It Cd password Ar string The user's password on the remote machine. .It Cd account Ar string Supply an additional account password. This is merely for FTP purposes. .It Cd macdef Ar name Define a macro. A macro is defined with the specified .Ar name ; it is formed from all lines beginning with the next line and continuing until a blank line is (consecutive newline characters are) encountered. (Note that .Cd macdef entries cannot be utilized by multiple machines, too, but must be defined following the .Ic machine they are intended to be used with.) If a macro named .Ar init exists, it is automatically run as the last step of the login process. This is merely for FTP purposes. .El .Sh EXAMPLES .Ss "An example configuration" .Bd -literal -offset indent # This example assumes v15.0 compatibility mode set v15-compat # Request strict TLL transport layer security checks set tls-verify=strict # Where are the up-to-date TLS certificates? # (Since we manage up-to-date ones explicitly, do not use any, # possibly outdated, default certificates shipped with OpenSSL) #set tls-ca-dir=/etc/ssl/certs set tls-ca-file=/etc/ssl/certs/ca-certificates.crt set tls-ca-no-defaults #set tls-ca-flags=partial-chain wysh set smime-ca-file="${tls-ca-file}" \e smime-ca-no-defaults #smime-ca-flags="${tls-ca-flags}" # This could be outsourced to a central configuration file via # tls-config-file plus tls-config-module if the used library allows. # CipherString: explicitly define the list of ciphers, which may # improve security, especially with protocols older than TLS v1.2. # See ciphers(1). Possibly best to only use tls-config-pairs-HOST # (or -USER@HOST), as necessary, again.. # Note that TLSv1.3 uses Ciphersuites= instead, which will join # with CipherString (if protocols older than v1.3 are allowed) # Curves: especially with TLSv1.3 curves selection may be desired. # MinProtocol,MaxProtocol: do not use protocols older than TLS v1.2. # Change this only when the remote server does not support it: # maybe use chain support via tls-config-pairs-HOST / -USER@HOST # to define such explicit exceptions, then, e.g., # MinProtocol=TLSv1.1 if [ "$tls-features" =% +ctx-set-maxmin-proto ] wysh set tls-config-pairs='\e CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e Curves=P-521:P-384:P-256,\e MinProtocol=TLSv1.1' else wysh set tls-config-pairs='\e CipherString=TLSv1.2:!aNULL:!eNULL:@STRENGTH,\e Curves=P-521:P-384:P-256,\e Protocol=-ALL\e,+TLSv1.1 \e, +TLSv1.2\e, +TLSv1.3' endif # Essential setting: select allowed character sets set sendcharsets=utf-8,iso-8859-1 # A very kind option: when replying to a message, first try to # use the same encoding that the original poster used herself! set reply-in-same-charset # When replying, do not merge From: and To: of the original message # into To:. Instead old From: -> new To:, old To: -> merge Cc:. set recipients-in-cc # When sending messages, wait until the Mail-Transfer-Agent finishs. # Only like this you will be able to see errors reported through the # exit status of the MTA (including the built-in SMTP one)! set sendwait # Only use built-in MIME types, no mime.types(5) files set mimetypes-load-control # Default directory where we act in (relative to $HOME) set folder=mail # A leading "+" (often) means: under *folder* # *record* is used to save copies of sent messages set MBOX=+mbox.mbox DEAD=+dead.txt \e record=+sent.mbox record-files record-resent # Make "file mymbox" and "file myrec" go to.. shortcut mymbox %:+mbox.mbox myrec +sent.mbox # Not really optional, e.g., for S/MIME set from='Your Name ' # It may be necessary to set hostname and/or smtp-hostname # if the "SERVER" of mta and "domain" of from do not match. # The `urlencode' command can be used to encode USER and PASS set mta=(smtps?|submissions?)://[USER[:PASS]@]SERVER[:PORT] \e smtp-auth=login/plain... \e smtp-use-starttls # Never refuse to start into interactive mode, and more set emptystart \e colour-pager crt= \e followup-to followup-to-honour=ask-yes fullnames \e history-file=+.\*(uAhist history-size=-1 history-gabby \e mime-counter-evidence=0b1111 \e prompt='?\e$?!\e$!/\e$^ERRNAME[\e$account#\e$mailbox-display]? ' \e reply-to-honour=ask-yes \e umask= # Only include the selected header fields when typing messages headerpick type retain from_ date from to cc subject \e message-id mail-followup-to reply-to # ...when forwarding messages headerpick forward retain subject date from to cc # ...when saving message, etc. #headerpick save ignore ^Original-.*$ ^X-.*$ # Some mailing lists mlist '@xyz-editor\e.xyz$' '@xyzf\e.xyz$' mlsubscribe '^xfans@xfans\e.xyz$' # Handle a few file extensions (to store MBOX databases) filetype bz2 'bzip2 -dc' 'bzip2 -zc' \e gz 'gzip -dc' 'gzip -c' xz 'xz -dc' 'xz -zc' \e zst 'zstd -dc' 'zstd -19 -zc' \e zst.pgp 'gpg -d | zstd -dc' 'zstd -19 -zc | gpg -e' # A real life example of a very huge free mail provider # Instead of directly placing content inside `account', # we `define' a macro: like that we can switch "accounts" # from within *on-compose-splice*, for example! define XooglX { set folder=~/spool/XooglX inbox=+syste.mbox sent=+sent set from='Your Name ' set pop3-no-apop-pop.gmXil.com shortcut pop %:pop3s://pop.gmXil.com shortcut imap %:imaps://imap.gmXil.com # Or, entirely IMAP based setup #set folder=imaps://imap.gmail.com record="+[Gmail]/Sent Mail" \e # imap-cache=~/spool/cache set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls # Alternatively: set mta=smtps://USER:PASS@smtp.gmail.com:465 } account XooglX { \ecall XooglX } # Here is a pretty large one which does not allow sending mails # if there is a domain name mismatch on the SMTP protocol level, # which would bite us if the value of from does not match, e.g., # for people who have a sXXXXeforge project and want to speak # with the mailing list under their project account (in from), # still sending the message through their normal mail provider define XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent set from='Your Name ' shortcut pop %:pop3s://pop.yaXXex.com shortcut imap %:imaps://imap.yaXXex.com set mta=smtps://USER:PASS@smtp.yaXXex.com:465 \e hostname=yaXXex.com smtp-hostname= } account XandeX { \ecall Xandex } # Create some new commands so that, e.g., `ls /tmp' will.. commandalias lls '!ls ${LS_COLOUR_FLAG} -aFlrS' commandalias llS '!ls ${LS_COLOUR_FLAG} -aFlS' set pipe-message/external-body='?* echo $MAILX_EXTERNAL_BODY_URL' # We do not support gpg(1) directly yet. But simple --clearsign'd # message parts can be dealt with as follows: define V { localopts yes wysh set pipe-text/plain=$'?*#++=?\e < "${MAILX_FILENAME_TEMPORARY}" awk \e -v TMPFILE="${MAILX_FILENAME_TEMPORARY}" \e'\e BEGIN{done=0}\e /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\e if(done++ != 0)\e next;\e print "--- GPG --verify ---";\e system("gpg --verify " TMPFILE " 2>&1");\e print "--- GPG --verify ---";\e print "";\e next;\e }\e /^-----BEGIN PGP SIGNATURE-----/,\e /^-----END PGP SIGNATURE-----/{\e next;\e }\e {print}\e \e'' print } commandalias V '\e'call V .Ed .Pp When storing passwords in .Pa \*(ur appropriate permissions should be set on this file with .Ql $ chmod 0600 \*(ur . If the \*(OPal .Va netrc-lookup is available user credentials can be stored in the central .Pa \*(VN file instead; e.g., here is a different version of the example account that sets up SMTP and POP3: .Bd -literal -offset indent define XandeX { set folder=~/spool/XandeX inbox=+syste.mbox sent=+sent set from='Your Name ' set netrc-lookup # Load an encrypted ~/.netrc by uncommenting the next line #set netrc-pipe='gpg -qd ~/.netrc.pgp' set mta=smtps://smtp.yXXXXx.ru:465 \e smtp-hostname= hostname=yXXXXx.com set pop3-keepalive=240 pop3-no-apop-pop.yXXXXx.ru commandalias xp fi pop3s://pop.yXXXXx.ru } account XandeX { \ecall XandeX } .Ed .Pp and, in the .Pa \*(VN file: .Bd -literal -offset indent machine *.yXXXXx.ru login USER password PASS .Ed .Pp This configuration should now work just fine: .Pp .Dl $ echo text | \*(uA -dvv -AXandeX -s Subject user@exam.ple .Ss "S/MIME step by step" \*(OP The first thing that is needed for .Sx "Signed and encrypted messages with S/MIME" is a personal certificate, and a private key. The certificate contains public information, in particular a name and email address(es), and the public key that can be used by others to encrypt messages for the certificate holder (the owner of the private key), and to .Ic verify signed messages generated with that certificate('s private key). Whereas the certificate is included in each signed message, the private key must be kept secret. It is used to decrypt messages that were previously encrypted with the public key, and to sign messages. .Pp For personal use it is recommended that get a S/MIME certificate from one of the major CAs on the Internet. Many CAs offer such certificates for free. Usually offered is a combined certificate and private key in PKCS#12 format which \*(UA does not accept directly. To convert it to PEM format, the following shell command can be used; please read on for how to use these PEM files. .Bd -literal -offset indent $ openssl pkcs12 -in cert.p12 -out certpem.pem -clcerts -nodes $ # Alternatively $ openssl pkcs12 -in cert.p12 -out cert.pem -clcerts -nokeys $ openssl pkcs12 -in cert.p12 -out key.pem -nocerts -nodes .Ed .Pp There is also .Lk https://www.CAcert.org which issues client and server certificates to members of their community for free; their root certificate .Pf ( Lk https://\:www.cacert.org/\:certs/\:root.crt ) is often not in the default set of trusted CA root certificates, though, which means their root certificate has to be downloaded separately, and needs to be part of the S/MIME certificate validation chain by including it in .Va smime-ca-dir or as a vivid member of the .Va smime-ca-file . But let us take a step-by-step tour on how to setup S/MIME with a certificate from CAcert.org despite this situation! .Pp First of all you will have to become a member of the CAcert.org community, simply by registrating yourself via the web interface. Once you are, create and verify all email addresses you want to be able to create signed and encrypted messages for/with using the corresponding entries of the web interface. Now ready to create S/MIME certificates, so let us create a new .Dq client certificate , ensure to include all email addresses that should be covered by the certificate in the following web form, and also to use your name as the .Dq common name . .Pp Create a private key and a certificate request on your local computer (please see the manual pages of the used commands for more in-depth knowledge on what the used arguments etc. do): .Pp .Dl $ openssl req -nodes -newkey rsa:4096 -keyout key.pem -out creq.pem .Pp Afterwards copy-and-paste the content of .Dq creq.pem into the certificate-request (CSR) field of the web form on the CAcert.org website (you may need to unfold some .Dq advanced options to see the corresponding text field). This last step will ensure that your private key (which never left your box) and the certificate belong together (through the public key that will find its way into the certificate via the certificate-request). You are now ready and can create your CAcert certified certificate. Download and store or copy-and-paste it as .Dq pub.crt . .Pp Yay. In order to use your new S/MIME setup a combined private key/public key (certificate) file has to be created: .Pp .Dl $ cat key.pem pub.crt > ME@HERE.com.paired .Pp This is the file \*(UA will work with. If you have created your private key with a passphrase then \*(UA will ask you for it whenever a message is signed or decrypted, unless this operation has been automated as described in .Sx "Signed and encrypted messages with S/MIME" . Set the following variables to henceforth use S/MIME (setting .Va smime-ca-file is of interest for verification only): .Bd -literal -offset indent ? set smime-ca-file=ALL-TRUSTED-ROOT-CERTS-HERE \e smime-sign-cert=ME@HERE.com.paired \e smime-sign-digest=SHA512 \e smime-sign .Ed .Ss "Using CRLs with S/MIME or TLS" \*(OP Certification authorities (CAs) issue certificate revocation lists (CRLs) on a regular basis. These lists contain the serial numbers of certificates that have been declared invalid after they have been issued. Such usually happens because the private key for the certificate has been compromised, because the owner of the certificate has left the organization that is mentioned in the certificate, etc. To seriously use S/MIME or TLS verification, an up-to-date CRL is required for each trusted CA. There is otherwise no method to distinguish between valid and invalidated certificates. \*(UA currently offers no mechanism to fetch CRLs, nor to access them on the Internet, so they have to be retrieved by some external mechanism. .Pp \*(UA accepts CRLs in PEM format only; CRLs in DER format must be converted, like, e.\|g.: .Pp .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem .Pp To tell \*(UA about the CRLs, a directory that contains all CRL files (and no other files) must be created. The .Va smime-crl-dir or .Va tls-crl-dir variables, respectively, must then be set to point to that directory. After that, \*(UA requires a CRL to be present for each CA that is used to verify a certificate. .Sh "FAQ" In general it is a good idea to turn on .Va debug .Pf ( Fl d ) and / or .Va verbose .Pf ( Fl v , twice) if something does not work well. Very often a diagnostic message can be produced that leads to the problems' solution. .Ss "\*(UA shortly hangs on startup" This can have two reasons, one is the necessity to wait for a file lock and cannot be helped, the other being that \*(UA calls the function .Xr uname 2 in order to query the nodename of the box (sometimes the real one is needed instead of the one represented by the internal variable .Va hostname ) . One may have varying success by ensuring that the real hostname and .Ql localhost have entries in .Pa /etc/hosts , or, more generally, that the name service is properly setup \(en and does .Xr hostname 1 return the expected value? Does this local hostname have a domain suffix? RFC 6762 standardized the link-local top-level domain .Ql .local , try again after adding an (additional) entry with this extension. .Ss "I cannot login to Google mail aka GMail" Since 2014 some free service providers classify programs as .Dq less secure unless they use a special authentication method (OAuth 2.0) which was not standardized for non-HTTP protocol authentication token query until August 2015 (RFC 7628). .Pp Different to Kerberos / GSSAPI, which is developed since the mid of the 1980s, where a user can easily create a local authentication ticket for her- and himself with the locally installed .Xr kinit 1 program, that protocol has no such local part but instead requires a world-wide-web query to create or fetch a token; since there is no local cache this query would have to be performed whenever \*(UA is invoked (in interactive sessions situation may differ). .Pp \*(UA does not support OAuth. Because of this it is necessary to declare \*(UA a .Dq less secure app (on the providers account web page) in order to read and send mail. However, it also seems possible to take the following steps instead: .Pp .Bl -enum -compact .It give the provider the number of a mobile phone, .It enable .Dq 2-Step Verification , .It create an application specific password (16 characters), and .It use that special password instead of the real Google account password in \*(UA (for more on that see the section .Sx "On URL syntax and credential lookup" ) . .El .Ss "Not \(dqdefunctional\(dq, but the editor key does not work" It can happen that the terminal library (see .Sx "On terminal control and line editor", .Ic bind , .Va termcap ) reports different codes than the terminal really sends, in which case \*(UA will tell that a key binding is functional, but will not be able to recognize it because the received data does not match anything expected. Especially without the \*(OPal terminal capability library support one reason for this may be that the (possibly even non-existing) keypad is not turned on and the resulting layout reports the keypad control codes for the normal keyboard keys. The .Va verbose listing of .Ic bind Ns ings will show the byte sequences that are expected. .Pp To overcome the situation, use, e.g., the program .Xr cat 1 , in conjunction with the command line option .Fl \&\&v , if available, to see the byte sequences which are actually produced by keypresses, and use the variable .Va termcap to make \*(UA aware of them. E.g., the terminal this is typed on produces some false sequences, here an example showing the shifted home key: .Bd -literal -offset indent ? set verbose ? bind* # 1B 5B=[ 31=1 3B=; 32=2 48=H bind base :kHOM z0 ? x $ cat -v ^[[H $ \*(uA -v -Stermcap='kHOM=\eE[H' ? bind* # 1B 5B=[ 48=H bind base :kHOM z0 .Ed .Ss "Can \*(UA git-send-email?" Yes. Put (at least parts of) the following in your .Pa ~/.gitconfig : .Bd -literal -offset indent [sendemail] smtpserver = /usr/bin/\*(uA smtpserveroption = -t #smtpserveroption = -Sexpandaddr smtpserveroption = -Athe-account-you-need ## suppresscc = all suppressfrom = false assume8bitEncoding = UTF-8 #to = /tmp/OUT confirm = always chainreplyto = true multiedit = false thread = true quiet = true annotate = true .Ed .Pp Patches can also be send directly, for example: .Bd -literal -offset indent $ git mail-patch HEAD^ | \*(uA -Athe-account-you-need -t RECEIVER .Ed .Ss "Howto handle stale dotlock files" .Ic file sometimes fails to open MBOX mail databases because creation of .Mx -sx .Sx "dotlock files" is impossible due to existing but unowned lock files. \*(UA does not offer an option to deal with those files, because it is considered a site policy what counts as unowned, and what not. The site policy is usually defined by administrator(s), and expressed in the configuration of a locally installed MTA (for example Postfix .Ql stale_lock_time=500s ) . Therefore the suggestion: .Bd -literal -offset indent $