INSTALL: update for v14.5.1
[s-mailx.git] / nail.1
blob54d5404720cbee81178d462f4974950963a9c274
1 .\" Copyright (c) 1980, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\" Copyright (c) 2000
4 .\"     Gunnar Ritter.  All rights reserved.
5 .\" Copyright (c) 2012 - 2013 Steffen "Daode" Nurpmeso <sdaoden@users.sf.net>.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\"     This product includes software developed by Gunnar Ritter
20 .\"     and his contributors.
21 .\" 4. Neither the name of the University nor the names of its contributors
22 .\"    may be used to endorse or promote products derived from this software
23 .\"    without specific prior written permission.
24 .\"
25 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS '\fIAS IS\fR' AND
26 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" SUCH DAMAGE.
36 .\"
37 .Dd Dec 27, 2013
38 .\"--MKMAN-START--
39 .ds UU \\%S-NAIL
40 .ds UA \\%S-nail
41 .ds UV \\%S-nail dirty
42 .ds ua \\%s-nail
43 .ds UR \\%s-nail.rc
44 .\"--MKMAN-END--
45 .\" If not ~/.mailrc, it breaks POSIX compatibility.  And adjust main.c.
46 .ds ur \\%~/.mailrc
47 \."
48 .ds OP [Optional]
49 .ds LE [Legacy]
50 .ds OB [Obsolete]
51 \."
52 .Dt "\*(UU" 1
53 .Sh NAME
54 .Nm \*(UV
55 .Nd send and receive Internet mail
56 .\"
57 .\" --  >8  --  8<  --
58 .\"
59 .Sh SYNOPSIS
60 .Nm \*(ua
61 .Op Fl BDdEFintv~
62 .Op Fl A Ar account
63 .Op Fl a Ar attachment
64 .Op Fl b Ar bcc-addr
65 .Op Fl c Ar cc-addr
66 .Op Fl O Ar mta-option
67 .Op Fl q Ar quote-file
68 .Op Fl r Ar from-addr
69 .Op Fl S Ar variable Ns Op Ns = Ns Ar value
70 .Op Fl s Ar subject
71 .Bk
72 .Ar to-addr ...
73 .Ek
74 .Nm \*(ua
75 .Op Fl BDdEeHiNnRv~#
76 .Op Fl A Ar account
77 .Op Fl S Ar variable Ns Op Ns = Ns Ar value
78 .Bk
79 .Fl f Op Ar file
80 .Ek
81 .Nm \*(ua
82 .Op Fl BDdEeiNnRv~#
83 .Op Fl A Ar account
84 .Op Fl S Ar variable Ns Op Ns = Ns Ar value
85 .Op Fl u Ar user
86 .\"
87 .\" --  >8  --  8<  --
88 .\"
89 .Sh DESCRIPTION
90 \*(UA is a mail processing system with a command syntax reminiscent of
91 .Xr ed 1
92 with lines replaced by messages.
93 It is intended to provide the functionality of the POSIX
94 .Xr mailx 1
95 command and offers (mostly optional) extensions for line editing, IDNA,
96 MIME, S/MIME, SMTP, POP3 and IMAP.
97 It is usable as a mail batch language.
98 .Pp
99 In the following list of supported command line options,
100 .Fl D ,
101 .Fl d ,
102 .Fl E ,
103 .Fl i ,
104 .Fl N
106 .Fl v
107 are implemented by means of setting the respective option, as via
108 .Fl S .
109 .\" ---
110 .Bl -tag -width ".Fl A Ar account"
111 .It Fl A Ar account
112 Executes an
113 .Ic account
114 command (see below) for
115 .Ar account
116 after the startup files have been read.
117 .It Fl a Ar file
118 Attach the given file to the message.
119 The same filename conventions as described in the section
120 .Sx "Commands"
121 apply.
122 .It Fl B
123 Make standard input and standard output line-buffered.
124 .It Fl b Ar address
125 Send blind carbon copies to the given list of addresses.
126 .Sx "Sending mail"
127 below goes into more detail on that.
128 .It Fl c Ar address
129 Send carbon copies to the given list of addresses.
130 .It Fl D
131 \*(OP Set the
132 .Va disconnected
133 variable.
134 .It Fl d
135 Set the
136 .Va debug
137 variable, which enables debug messages and disables message delivery.
138 Note that this is not a real `sandbox' mode.
139 .It Fl E
140 Set the
141 .Va skipemptybody
142 variable and thus discard messages with an empty message part body.
143 This is useful for sending messages from scripts.
144 .It Fl e
145 Just check if mail is present in the system mailbox.
146 If yes, return an exit status of zero, a non-zero value otherwise.
147 .It Fl F
148 Save the message to send in a file named after the local part of the
149 first recipient's address.
150 .It Fl f Op Ar file
151 Read in the contents of the user's mbox (or the specified file)
152 for processing;
153 when \*(UA is quit, it writes undeleted messages back to this file.
154 The string
155 .Ar file
156 is interpreted as described for the
157 .Ic folder
158 command below.
159 Note that
160 .Ar file
161 is not a direct argument to the flag
162 .Fl f ,
163 but is instead taken from the command line after option processing has
164 been completed.
165 .It Fl H
166 Print header summaries for all messages and exit.
167 .It Fl i
168 Set the
169 .Va ignore
170 variable to ignore tty interrupt signals.
171 .It Fl N
172 Unset the
173 .Va header
174 variable and thus inhibits the initial display of message headers when
175 reading mail or editing a mail folder.
176 .It Fl n
177 Inhibits reading \*(UR upon startup.
178 This option should be activated for \*(UA scripts that are invoked on
179 more than one machine, because the contents of that file may differ
180 between them.
181 (The same behaviour can be achieved by setting the
182 .Ev NAIL_NO_SYSTEM_RC
183 environment variable.)
184 .It Fl O Ar mta-option
185 Pass the given option through to the mail-transfer-agent (MTA).
186 This option has no effect when mail is send via SMTP.
187 E.g., use
188 .Ns ` Ns Li "-O-h -Onumber" Ns '
189 to specify the hop count for an old
190 .Xr sendmail 1 .
191 Options set like that persist for an entire (interactive) session.
192 .It Fl q Ar file
193 Start the message with the contents of the specified file.
194 May be given in send mode only.
195 .It Fl R
196 Opens any folders read-only.
197 .It Fl r Ar address
198 Sets the envelope sender address by passing an
199 .Fl r
200 option to the MTA when a message is send.
201 If a non-empty
202 .Ar address
203 argument is given it'll be checked for validity and then fixated to
204 the given value, but otherwise the content of the variable
205 .Va from
206 will be used for that purpose \(en i.e., it'll be passed through to
207 the MTA via the
208 .Fl r
209 option whenever a message is send.
210 A valid non-empty value will also be set as if an additional
211 .Ns ` Ns Li "-Sfrom=VALUE" Ns '
212 option had been used and therefore affect sending of messages via SMTP
213 (as a consideration for `From:').
214 .It Fl S Ar variable Ns Op = Ns value
215 Sets the internal option
216 .Ar variable
217 and, in case of a value option, assigns
218 .Ar value
219 to it.
220 Even though options set via
221 .Fl S
222 may be overwritten from within resource files,
223 the command line setting will be reestablished after all resources have
224 been loaded.
225 .It Fl s Ar subject
226 Specify the subject on the command line
227 (be careful to quote subjects containing spaces).
228 .It Fl t
229 The message to be sent is expected to contain a message header with
230 `To:', `Cc:', or `Bcc:' fields giving its recipients and `Subject:'
231 giving the subject of the message.
232 Recipients and subject specified on the command line are ignored.
233 .It Fl u Ar user
234 Read the system mailbox of
235 .Ar user
236 (appropriate privileges presumed), and `assume to be'
237 .Ar user
238 in some aspects, e.g. in respect to expansions of `%' etc.
239 Also see
240 .Ev USER .
241 .It Fl V
242 Print \*(UA's version and exit.
243 .It Fl v
244 Sets the
245 .Va verbose
246 option, which enables more verbose messages.
247 .It Fl ~
248 Enable tilde escapes even if not in interactive mode.
249 .It Fl #
250 This sets multiple options to prepare \*(UA for working in batch mode
251 (most likely in non-interactive mode):
252 .Va dot ,
253 .Va emptystart ,
254 .Va noheader ,
255 .Va quiet ,
256 .Va sendwait ;
257 it also enables processing of tilde escapes.
258 E.g., the following should send an email message to `alias'.
260 .Dl printf 'm alias\en~s Subject\enBody\en.\enx\en' | \
261    MAILRC=/dev/null s-nail -n -#
264 .\" --  >8  --  8<  --
265 .Ss "Sending mail"
266 To send a message to one or more people,
267 \*(UA can be invoked with arguments which are the names of people to
268 whom the mail will be sent.
269 These names may be
270 .Ic alias Ns
271 es, plain addresses or full address specifications including user names
272 and comments,
273 in which case care for proper quoting may be necessary.
274 If this manual refers to a \fIlist of addresses\fR,
275 then \*(UA expects a comma-separated list of such names.
276 The section
277 .Sx "Recipient address specifications"
278 below explains the interpretation of names in more detail.
279 The user is then expected to type in his message, followed by a
280 .Li `control-D'
281 at the beginning of a line.
282 The section
283 .Sx "Replying to or originating mail"
284 describes some features of \*(UA available to help when composing
285 letters.
287 .\" --  >8  --  8<  --
288 .Ss "Reading mail"
289 In normal usage \*(UA is given no arguments and checks the user's mail
290 out of the post office,
291 then prints out a one line header of each message found.
292 The current message is initially the first message (numbered 1) and can
293 be printed using the
294 .Ic print
295 command, which can be abbreviated `p'.
296 The commands `p+' and `p\-' move forward to the next and backward to the
297 previous message, respectively, and messages can be addressed directly
298 by specifying their message number, as in `p 1'.
300 .\" --  >8  --  8<  --
301 .Ss "Disposing of mail"
302 After examining a message the user can
303 .Ic delete
304 (`d') the message or
305 .Ic reply
306 (`r') to it.
307 Deletion causes the \*(UA program to forget about the message.
308 This is not irreversible;
309 one can
310 .Ic undelete
311 (`u') the message by giving its number,
312 or the \*(UA session can be ended by giving the
313 .Ic exit
314 (`x') command.
315 Deleted messages will, however, usually disappear never to be seen
316 again.
318 .\" --  >8  --  8<  --
319 .Ss "Specifying messages"
320 Commands such as print and delete can be given a list of message numbers
321 as arguments to apply to a number of messages at once.
322 Thus
323 .Ns ` Ns Li "delete 1 2" Ns '
324 deletes messages 1 and 2,
325 whereas
326 .Ns ` Ns Li "delete 1-5" Ns '
327 will delete the messages 1 through 5.
328 In sorted or threaded mode (see the
329 .Ic sort
331 .Ic thread
332 commands),
333 .Ns ` Ns Li "delete 1-5" Ns '
334 will delete the messages that are located between (and including)
335 messages 1 through 5 in the sorted/threaded order, as shown in the
336 header summary.
337 The following special message names exist:
338 .\" ---
339 .Bl -tag -width ".It .Ar :n:u"
340 .It Ar :n
341 All new messages.
342 .It Ar :o
343 All old messages (any not in state read or new).
344 .It Ar :u
345 All unread messages.
346 .It Ar :d
347 All deleted messages (for the
348 .Ic undelete
349 command).
350 .It Ar :r
351 All read messages.
352 .It Ar :f
353 All `flagged' messages.
354 .It Ar :a
355 All answered messages
356 (cf. the
357 .Va markanswered
358 variable).
359 .It Ar :t
360 All messages marked as draft.
361 .It Ar :s
362 \*(OP All messages classified as spam.
363 .It Ar \&.
364 The current message.
365 .It Ar \&;
366 The message that was previously the current message.
367 .It Ar \&,
368 The parent message of the current message,
369 that is the message with the Message-ID given in the `In-Reply-To:' field
370 or the last entry of the `References:' field of the current message.
371 .It Ar -
372 The next previous undeleted message,
373 or the next previous deleted message for the
374 .Ic undelete
375 command.
376 In sorted/threaded mode,
377 the next previous such message in the sorted/threaded order.
378 .It Ar +
379 The next undeleted message,
380 or the next deleted message for the
381 .Ic undelete
382 command.
383 In sorted/threaded mode,
384 the next such message in the sorted/threaded order.
385 .It Ar ^
386 The first undeleted message,
387 or the first deleted message for the
388 .Ic undelete
389 command.
390 In sorted/threaded mode,
391 the first such message in the sorted/threaded order.
392 .It Ar $
393 The last message.
394 In sorted/threaded mode,
395 the last message in the sorted/threaded order.
396 .It Ar & Ns Ar x
397 In threaded mode,
398 selects the message addressed with
399 .Ar x ,
400 where
401 .Ar x
402 is any other message specification,
403 and all messages from the thread that begins at it.
404 Otherwise it is identical to
405 .Ar x .
407 .Ar x
408 is omitted,
409 the thread beginning with the current message is selected.
410 .It Ar *
411 All messages.
412 .It Ar `
413 All messages that were included in the message list for the previous
414 command.
415 .It Ar / Ns Ar string
416 All messages that contain
417 .Ar string
418 in the subject field (case ignored).
419 See also the
420 .Va searchheaders
421 variable.
423 .Ar string
424 is empty,
425 the string from the previous specification of that type is used again.
426 .It Ar address
427 All messages from
428 .Ar address .
429 By default, this is a case-sensitive search for the complete email
430 address.
431 If the
432 .Va allnet
433 variable is set,
434 only the local part of the addresses is evaluated for the comparison.
435 Otherwise if the
436 .Va showname
437 variable is set,
438 a case-sensitive search for the complete real name of a sender is
439 performed.
440 The IMAP-style
441 .Ns ` Ns Li "(from address)" Ns '
442 expression can be used instead if substring matches are desired.
443 .It Ar ( criterion )
444 All messages that satisfy the given IMAP-style SEARCH
445 .Ar criterion .
446 This addressing mode is available with all types of folders;
447 for folders not located on IMAP servers,
448 or for servers unable to execute the SEARCH command,
449 \*(UA will perform the search locally.
450 Strings must be enclosed by double quotes `"' in their entirety
451 if they contain white space or parentheses;
452 within the quotes,
453 only backslash `\e' is recognized as an escape character.
454 All string searches are case-insensitive.
455 When the description indicates that the `envelope' representation of an
456 address field is used,
457 this means that the search string is checked against both a list
458 constructed as
460 .Dl ( \*q Ns name Ns \*q \*q Ns source Ns \*q \*q Ns \
461     local-part Ns \*q \*q Ns domain-part Ns \*q )
463 for each address,
464 and the addresses without real names from the respective header field.
465 Criteria can be nested using parentheses.
466 .It Ar ( criterion1 criterion2 ... criterionN )
467 All messages that satisfy all of the given criteria.
468 .It Ar ( or criterion1 criterion2 )
469 All messages that satisfy either
470 .Ar criterion1
472 .Ar criterion2 ,
473 or both.
474 To connect more than two criteria using `or',
475 (or) specifications have to be nested using additional parentheses,
476 as with
477 .Ns ` Ns Li "(or a (or b c))" Ns ',
478 since
479 .Ns ` Ns Li "(or a b c)" Ns '
480 really means
481 .Ns ` Ns Li "((a or b) and c)" Ns '.
482 For a simple `or' operation of independent criteria on the lowest
483 nesting level,
484 it is possible to achieve similar effects by using three separate
485 criteria, as with
486 .Ns ` Ns Li "(a) (b) (c)" Ns '.
487 .It Ar ( not criterion )
488 All messages that do not satisfy
489 .Ar criterion .
490 .It Ar ( bcc \*q Ns Ar string Ns Ar \*q )
491 All messages that contain
492 .Ar string
493 in the `envelope' representation of the `Bcc:' field.
494 .It Ar ( cc \*q Ns Ar string Ns Ar \*q )
495 All messages that contain
496 .Ar string
497 in the `envelope' representation of the `Cc:' field.
498 .It Ar ( from \*q Ns Ar string Ns Ar \*q )
499 All messages that contain
500 .Ar string
501 in the `envelope' representation of the `From:' field.
502 .It Ar ( subject \*q Ns Ar string Ns Ar \*q )
503 All messages that contain
504 .Ar string
505 in the `Subject:' field.
506 .It Ar ( to \*q Ns Ar string Ns Ar \*q )
507 All messages that contain
508 .Ar string
509 in the `envelope' representation of the `To:' field.
510 .It Ar ( header name \*q Ns Ar string Ns Ar \*q )
511 All messages that contain
512 .Ar string
513 in the specified
514 .Ar Name:
515 field.
516 .It Ar ( body \*q Ns Ar string Ns Ar \*q )
517 All messages that contain
518 .Ar string
519 in their body.
520 .It Ar ( text \*q Ns Ar string Ns Ar \*q )
521 All messages that contain
522 .Ar string
523 in their header or body.
524 .It Ar ( larger size )
525 All messages that are larger than
526 .Ar size
527 (in bytes).
528 .It Ar ( smaller size )
529 All messages that are smaller than
530 .Ar size
531 (in bytes).
532 .It Ar ( before date )
533 All messages that were received before
534 .Ar date ,
535 which must be in the form
536 .Li "d[d]-mon-yyyy" ,
537 where `d' denotes the day of the month as one or two digits,
538 `mon' is the name of the month \(en one of
539 `Jan', `Feb', `Mar', `Apr', `May', `Jun',
540 `Jul', `Aug', `Sep', `Oct', `Nov', or `Dec',
541 and `yyyy' is the year as four digits, e.g., "28-Dec-2012".
542 .It Ar ( on date )
543 All messages that were received on the specified date.
544 .It Ar ( since date )
545 All messages that were received since the specified date.
546 .It Ar ( sentbefore date )
547 All messages that were sent on the specified date.
548 .It Ar ( senton date )
549 All messages that were sent on the specified date.
550 .It Ar ( sentsince date )
551 All messages that were sent since the specified date.
552 .It Ar ()
553 The same criterion as for the previous search.
554 This specification cannot be used as part of another criterion.
555 If the previous command line contained more than one independent
556 criterion then the last of those criteria is used.
559 \*(OP An IMAP-style search can be turned into a case-insensitive regular
560 expression search (see
561 .Xr re_format 7 Ns
562 ) in its entirety by using a slash `/' as the first character after the
563 opening parenthesis, as in
564 .Bd -literal -offset indent
565    ? f (/or subject ^\\[S-nail (subject ^\\[nail-devel))
568 On the lowest nesting level each expression is treated by itself:
569 .Bd -literal -offset indent
570    ? f (/subject ^\\[S-nail) (/subject ^\\[nail-devel)
573 Of course, now that we have regular expression support those should be
574 written much more efficiently as
575 .Bd -literal -offset indent
576    ? f (/subject "^\\\\[(S-nail|nail-devel)")
579 Note that regular expression searches are always performed on local
580 storage, messages will be downloaded first as necessary.
582 .\" --  >8  --  8<  --
583 .Ss "Replying to or originating mail"
584 The command
585 .Ic reply
586 can be used to set up a response to a message,
587 sending it back to the person who it was from.
588 Text the user types in, up to an end-of-file,
589 defines the contents of the message.
590 While the user is composing a message \*(UA treats lines beginning with
591 the character `~' specially.
592 For instance, typing `~m' (alone on a line) will place a copy of the
593 current message into the response right shifting it by a tabstop
594 (more about the
595 .Va indentprefix
596 variable below).
597 Other escapes will set up subject fields,
598 add and delete recipients to the message,
599 attach files to it
600 and allow the user to escape to an editor to revise the message
601 or to a shell to run some commands.
602 (These options are given in the summary below.)
604 .\" --  >8  --  8<  --
605 .Ss "Ending a mail processing session"
606 The user can end a \*(UA session by issuing the
607 .Ic quit
608 (`q') command.
609 Messages which have been examined go to the user's mbox file unless they
610 have been deleted,
611 in which case they are discarded.
612 Unexamined messages go back to the post office.
613 (Also see the
614 .Fl f
615 option above.)
616 When command line history is tracked, an updated history file is
617 written.
618 None of these actions is performed when the command
619 .Ic exit
620 (`x') is used instead of
621 .Ic quit
622 (`q').
624 .\" --  >8  --  8<  --
625 .Ss "Personal and systemwide distribution lists"
626 It is possible to create personal distribution lists so that,
627 for instance, the user can send mail to `cohorts'
628 and have it go to a group of people.
629 Such lists can be defined via the
630 .Ic alias
631 command by, e.g., placing lines like
633 .Dl alias cohorts bill ozalp jkf mark kridle@ucbcory
635 in the file \*(ur in the user's home directory.
636 Using
637 .Ic alias
638 without arguments lists all the currently known aliases.
640 Please note that this mechanism has nothing in common with the system
641 wide aliases that may be used by the local MTA (mail-transfer-agent)
642 and are often tracked in a file
643 .Pa /etc/aliases
644 (and documented in
645 .Xr aliases 5
647 .Xr sendmail 1 Ns
649 Personal aliases will be expanded by \*(UA before the message is sent.
650 They are a convenient alternative to specifying each addressee by
651 itself.
653 .\" --  >8  --  8<  --
654 .Ss "Recipient address specifications"
655 When an address is used to name a recipient (in `To:', `Cc:', or `Bcc:'),
656 names of local mail folders and pipes to external commands may also be
657 specified \(en the message text is then written to them.
658 The rules are: Any name which starts with a `|' (vertical bar) character
659 specifies a pipe \(en the command string following the `|' is executed
660 and the message is sent to its standard input;
661 any other name which contains a `@' (at sign) character is treated as
662 a mail address;
663 any other name which starts with a `+' (plus sign) character specifies
664 a folder name;
665 any other name which contains a `/' (slash) character but no `!'
666 (exclamation mark) or `%' (percent sign) character before also specifies
667 a folder name;
668 what remains is treated as a mail address.
669 Compressed folders are handled as described for the
670 .Ic folder
671 command.
673 .\" --  >8  --  8<  --
674 .Ss "Network mail (Internet / ARPA, UUCP, Berknet)"
676 .Xr mailaddr 7
677 for a description of network addresses.
678 If support for IDNA (internationalized domain names for applications)
679 has been compiled into \*(UA,
680 then the domain name part of network addresses will be converted via
681 IDNA mechanisms as necessary, effectively treating it as a name in the
682 .Va ttycharset
683 character set; see
684 .Sx "Character sets"
685 for the complete picture about character sets.
687 \*(UA has a number of options which can be set in the \*(ur file
688 to alter its behavior; e.g.,
689 .Ic "set askcc"
690 enables the
691 .Va askcc
692 feature, and
693 .Ic "set idna-disable"
694 will disable the mentioned IDNA conversion even if support is available.
695 (These options are summarized below.)
697 .\" --  >8  --  8<  --
698 .Ss "MIME types"
699 For any outgoing attachment \*(UA tries to determine the content type.
700 It does this by reading MIME type files whose lines have the following
701 syntax:
703 .Dl type/subtype        extension [extension ...]
705 where `type/subtype' are strings describing the file contents,
706 and `extension' is the part of a filename starting after the last dot.
707 Any line not immediately beginning with an ASCII alphabetical character
708 is ignored by \*(UA.
709 The variable
710 .Va mimetypes-load-control
711 can be used to control the sources of MIME types, and the
712 .Ic mimetypes
713 command can be used to show the list of mime types known to \*(UA.
714 If there is a match with the `extension' of the file to attach,
715 the given `type/subtype' pair is used.
716 Otherwise, or if the filename has no extension,
717 the content types `text/plain' or `application/octet-stream' are used,
718 dependent upon file content inspection.
719 Also see
720 .Va mime-allow-text-controls .
722 .\" --  >8  --  8<  --
723 .Ss "Character sets"
724 \*(UA normally detects the character set of the terminal by using
725 mechanisms that are controlled by the `LC_CTYPE' locale setting,
726 if such are supported; the variable
727 .Va ttycharset
728 will be set to the detected terminal character set and will thus
729 show up in the output of the command
730 .Ic set .
732 A user supplied
733 .Va ttycharset
734 value is not overwritten by this detection mechanism;
735 this feature must be used if the detection doesn't work properly,
736 and it may be used to adjust the name of the locale character set.
737 E.g., on BSD systems one may use a locale with the character set
738 `ISO8859-1', which is not a valid name for this character set;
739 to be on the safe side, one may set
740 .Va ttycharset
741 to the correct name, `ISO-8859-1'.
743 Note that changing the value doesn't mean much beside that,
744 since several aspects of the real character set are implied by the
745 locale environment of the system,
746 and that stays unaffected by the content of an overwritten
747 .Va ttycharset
748 variable.
749 (This is mostly an issue when interactively using \*(UA, though.
750 It is actually possible to send mail in a completely "faked" locale
751 environment.)
753 If no character set conversion capabilities have been compiled into
754 \*(UA (i.e., no
755 .Xr iconv 3
756 library has been found), then
757 .Va ttycharset
758 will be the only supported character set,
759 and it is simply assumed that it can be used to exchange 8 bit messages,
760 and the rest of this section does not apply;
761 it may however still be necessary to explicitly set it if automatic
762 detection fails, since in that case it defaults to `ISO-8859-1'.
764 When reading messages, their text is converted into
765 .Va ttycharset
766 as necessary in order to display them on the users terminal.
767 Unprintable characters and illegal byte sequences are detected
768 and replaced by proper substitution characters
769 (unless the variable
770 .Va print-all-chars
771 was set once \*(UA was started).
773 When sending messages all their parts and attachments are classified.
774 Whereas no character set conversion is performed on those parts which
775 appear to be binary data,
776 the character set being used must be declared within the MIME header of
777 an outgoing text part if it contains characters that do not conform to
778 the set of characters that are allowed by the email standards.
779 Permissible values for character sets can be declared using the
780 .Va sendcharsets
781 variable, which is expected to contain a (comma-separated list of)
782 character set (names), and the
783 .Va charset-8bit
784 variable, which is used as a catch-all last-resort fallback.
786 All the specified character sets are tried in order unless the
787 conversion of the part or attachment succeeds.
788 If none of the tried (8 bit) character sets is capable to represent the
789 content of the part or attachment,
790 then the message will not be sent and its text will be saved to
791 .Va DEAD .
792 Note that some character set conversions will never fail, even if the
793 result is incorrect; e.g., `ISO-8859-1' is capable to represent any
794 8 bit message.
796 In general, if the message `Cannot convert from a to b' appears, either
797 some characters are not appropriate for the currently selected
798 (terminal) character set,
799 or the needed conversion is not supported by the system.
800 In the first case, it is necessary to set an appropriate `LC_CTYPE'
801 locale and/or the variable
802 .Va ttycharset .
804 The best results are usually achieved when \*(UA is run in a UTF-8
805 locale on a UTF-8 capable terminal,
806 in which case the full Unicode spectrum of characters is available.
807 In this setup characters from various countries can be displayed,
808 while it is still possible to use more simple character sets for sending
809 to retain maximum compatibility with older mail clients.
811 .\" --  >8  --  8<  --
812 .Ss "Command line editor"
813 \*(OP \*(UA can be configured to support a command line editor and
814 command history lists which are saved in between sessions.
815 One may link against fully-fledged external libraries
816 .Ns ( Ns Xr readline 3 ,
817 .Xr editline 3 Ns
818 ) or use the \*(UA command line editor instead, which should work in all
819 environments which comply to ISO C (ISO/IEC 9899:1990/Amendment 1:1995).
820 When an external library is used, interactive behaviour of \*(UA relies
821 on that library and may not correspond one-to-one to what is described
822 in this manual.
824 Regardless of the actually used command line editor history entries
825 will be created for lines entered in command mode only, and creation of
826 such an entry can be forcefully suppressed by starting the line with
827 a space character.
828 Note that history handling is by itself an optional feature and may
829 therefore not be available.
830 For more information see the documentation of the options
831 .Va emptystart ,
832 .Va line-editor-disable ,
833 .Va NAIL_HISTFILE
835 .Va NAIL_HISTSIZE .
837 The builtin \*(UA command line editor supports the following operations;
838 the notation `^-character' stands for the combination of the `control'
839 key plus the mentioned character, e.g., `^A' means "hold control key
840 while adding an A key on top of it":
841 .Bl -tag -width "^M^"
842 .It ^A
843 Go to the start of the line.
844 .It ^B
845 Move the cursor backward one character.
846 .It ^D
847 Forward delete the character under the cursor;
848 quits \*(UA if used on the empty line, unless the
849 .Va ignoreeof
850 option is set.
851 .It ^E
852 Go to the end of the line.
853 .It ^F
854 Move the cursor forward one character.
855 .It ^G
856 Cancel current operation, full reset.
857 If there is an active history search or tabulator expansion then this
858 command will first reset that, reverting to the former line content;
859 thus a second reset is needed for a full reset in this case.
860 In all cases \*(UA will reset a possibly used multibyte character input
861 state machine.
862 .It ^H
863 The same as `backspace': backward delete one character.
864 .It ^I
865 \*(OP The same as `horizontal tabulator': try to expand the "word"
866 before the cursor.
867 Here "expansion" refers to the \*(UA expansion, as documented for
868 .Ic folder ,
869 and thus includes shell word expansion (as a last step).
870 I.e., this is \*(UA "expansion", not what one usually expects from
871 "tab-completion".
872 .It ^J
873 The same as `RETURN': complete this line of input.
874 .It ^K
875 Delete all characters from the cursor to the end of the line.
876 .It ^L
877 Repaint the line.
878 .It ^N
879 \*(OP Go to the next history entry.
880 .It ^P
881 \*(OP Go to the previous history entry.
882 .It ^R
883 \*(OP Complete the current line from (the remaining older) history entries.
884 .It ^U
885 The same as `^A' followed by `^K'.
886 .It ^W
887 Delete the characters from the one preceding the cursor to the preceding
888 word boundary.
889 .It ^X
890 Move the cursor forward one word boundary.
891 .It ^Y
892 Move the cursor backward one word boundary.
895 If problems with commands that are based upon rightwise movement are
896 encountered, adjustments of the option
897 .Va line-editor-cursor-right
898 may solve the problem, as documented for it.
900 .\" --  >8  --  8<  --
901 .Ss "Commands"
902 Each command is typed on a line by itself,
903 and may take arguments following the command word.
904 The command need not be typed in its entirety \(en
905 the first command which matches the typed prefix is used.
906 (The command
907 .Ic list
908 prints a sorted list of available commands, and the command
909 .Ic ? ,
910 when given an argument, will show a documentation string for the
911 expansion, as in
912 .Ns ` Ns Ic ? Ns Ar unc Ns ' ;
913 documentation strings are however \*(OP.)
915 For commands which take message lists as arguments,
916 if no message list is given,
917 then the next message forward which satisfies the command's requirements
918 is used.
919 If there are no messages forward of the current message,
920 the search proceeds backwards,
921 and if there are no good messages at all,
922 \*(UA types `no applicable messages' and aborts the command.
923 If the command begins with a `#' (number sign) character,
924 the line is ignored.
926 The arguments to commands can be quoted, using the following methods:
927 .Bl -bullet -offset indent
929 An argument can be enclosed between paired double-quotes `"argument"' or
930 single-quotes `'argument'';
931 any white space, shell word expansion, or backslash characters (except
932 as described next) within the quotes are treated literally as part of
933 the argument.
934 A double-quote will be treated literally within single-quotes and vice
935 versa.
936 Inside such a quoted string the actually used quote character can be
937 used nonetheless by escaping it with a backslash `\\', as in
938 `"y\\"ou"'.
940 An argument that is not enclosed in quotes, as above, can usually still
941 contain space characters if those spaces are backslash-escaped.
943 A backslash outside of the enclosing quotes is discarded
944 and the following character is treated literally as part of the argument.
946 An unquoted backslash at the end of a command line is discarded and the
947 next line continues the command.
950 Filenames, where expected, are subsequently subjected to the following
951 transformations, in sequence:
952 .Bl -bullet -offset indent
954 If the filename begins with an unquoted plus sign, and the
955 .Va folder
956 variable is defined,
957 the plus sign will be replaced by the value of the
958 .Va folder
959 variable followed by a slash.
960 If the
961 .Va folder
962 variable is unset or is set to null, the filename will be unchanged.
964 Shell word expansions are applied to the filename.
965 If more than a single pathname results from this expansion and the
966 command is expecting one file, an error results.
970 The following commands are provided:
971 .Bl -tag -width ".Ic account"
972 .It Ic ~
973 Interprets the remainder of the word as a macro name and passes it
974 through to the
975 .Ic call
976 command; e.g.,
977 .Ns ` Ns Ic ~ Ns Ar mymacro Ns '
978 is a shorter synonym for
979 .Ns ` Ns Ic call Ar mymacro Ns ' .
980 .It Ic -
981 Print out the preceding message.
982 If given a numeric argument n,
983 goes to the n'th previous message and prints it.
984 .It Ic \&?
985 Prints a brief summary of commands.
986 \*(OP Given an argument a synopsis for the command in question is
987 printed instead.
988 .It Ic \&!
989 Executes the shell (see
990 .Xr sh 1
992 .Xr csh 1 Ns
993 ) command which follows.
994 .It Ic \&|
995 A synonym for the
996 .Ic pipe
997 command.
998 .It Ic account
999 (ac) Creates, selects or lists an email account.
1000 An account is formed by a group of commands,
1001 primarily of those to set variables.
1002 With two arguments,
1003 of which the second is a `{',
1004 the first argument gives an account name,
1005 and the following lines create a group of commands for that account
1006 until a line containing a single `}' appears.
1007 With one argument the previously created group of commands for the
1008 account name is executed, and a
1009 .Ic folder
1010 command is executed for the system mailbox or inbox of that account.
1011 Without arguments the list of accounts and their contents are printed.
1012 As an example,
1013 .Bd -literal -offset indent
1014    account myisp {
1015       set folder=imaps://mylogin@imap.myisp.example
1016       set record=+Sent
1017       set from="myname@myisp.example (My Name)"
1018       set smtp=smtp.myisp.example
1019    }
1022 creates an account named `myisp' which can later be selected by
1023 specifying `account myisp'.
1024 The special account `null' (case-insensitive) always exists.
1025 .It Ic alias
1026 (a) With no arguments, prints out all currently-defined aliases.
1027 With one argument, prints out that alias.
1028 With more than one argument,
1029 creates a new alias or changes an old one.
1030 .It Ic alternates
1031 (alt) The alternates command is useful if the user has accounts on
1032 several machines.
1033 It can be used to inform \*(UA that the listed addresses all belong to
1034 the invoking user.
1035 When replying to messages \*(UA will not send a copy of the message
1036 to any of the addresses listed on the alternates list.
1037 If the alternates command is given with no argument,
1038 the current set of alternate names is displayed.
1039 .It Ic answered
1040 (ans) Takes a message list and marks each message as having been
1041 answered.
1042 This mark has no technical meaning in the mail system;
1043 it just causes messages to be marked in the header summary,
1044 and makes them specially addressable.
1045 .It Ic cache
1046 \*(OP Only applicable to cached IMAP mailboxes;
1047 takes a message list and reads the specified messages into the IMAP
1048 cache.
1049 .It Ic call
1050 Calls a macro (see the
1051 .Ic define
1052 command).
1053 .It Ic cd
1054 Same as
1055 .Ic chdir .
1056 .It Ic certsave
1057 \*(OP Only applicable to S/MIME signed messages.
1058 Takes a message list and a file name and saves the certificates
1059 contained within the message signatures to the named file in both
1060 human-readable and PEM format.
1061 The certificates can later be used to send encrypted messages to the
1062 respective message senders by setting
1063 .Va smime-encrypt-user@host
1064 variables.
1065 .It Ic chdir
1066 (ch) Changes the user's working directory to the specified one,
1067 or to the user's login directory, if none was given.
1068 .It Ic collapse
1069 (coll)
1070 Only applicable to threaded mode.
1071 Takes a message list and makes all replies to these messages invisible
1072 in header summaries,
1073 unless they are in state `new'.
1074 .It Ic connect
1075 \*(OP (conn) If operating in disconnected mode on an IMAP mailbox,
1076 switch to online mode and connect to the mail server while retaining the
1077 mailbox status.
1078 See the description of the
1079 .Va disconnected
1080 variable for more information.
1081 .It Ic copy
1082 (c) The copy command does the same thing that
1083 .Ic save
1084 does except that it does not mark the given messages for deletion when
1085 the user quits.
1086 Compressed files and IMAP mailboxes are handled as described for the
1087 .Ic folder
1088 command.
1089 .It Ic Copy
1090 (C) Similar to
1091 .Ic copy ,
1092 but saves the messages in a file named after the local part of the
1093 sender address of the first message.
1094 .It Ic cwd
1095 Print the current working directory.
1096 .It Ic decrypt
1097 \*(OP (dec) For unencrypted messages,
1098 this command is identical to
1099 .Ic copy .
1100 Encrypted messages are first decrypted, if possible, and then copied.
1101 .It Ic Decrypt
1102 \*OP (Dec) Similar to
1103 .Ic decrypt ,
1104 but saves the messages in a file named after the local part of the
1105 sender address of the first message.
1106 .It Ic define
1107 (def) Defines a macro.
1108 A macro definition is a sequence of commands in the following form:
1109 .Bd -literal -offset indent
1110    define name {
1111       command1
1112       command2
1113       ...
1114       commandN
1115    }
1118 A defined macro can be explicitly invoked using
1119 .Ic call
1121 .Ic ~ ,
1122 or it can be implicitly invoked by setting the
1123 .Va folder-hook
1125 .Va folder-hook-fullname
1126 variables.
1127 .It Ic defines
1128 Prints the currently defined macros including their contents.
1129 .It Ic delete
1130 (d) Takes a list of messages as argument and marks them all as deleted.
1131 Deleted messages will not be saved in `mbox',
1132 nor will they be available for most other commands.
1133 .It Ic discard
1134 Same as
1135 .Ic ignore .
1136 .It Ic disconnect
1137 \*(OP (disco) If operating in online mode on an IMAP mailbox,
1138 switch to disconnected mode while retaining the mailbox status.
1139 See the description of the
1140 .Va disconnected
1141 variable for more.
1142 A list of messages may optionally be given as argument;
1143 the respective messages are then read into the cache before the
1144 connection is closed.
1145 Thus `disco *' makes the entire mailbox available for disconnected use.
1146 .It Ic dp Ns \ or Ic dt
1147 Deletes the current message and prints the next message.
1148 If there is no next message, \*(UA says `at EOF'.
1149 .It Ic draft
1150 Takes a message list and marks each given message as a draft.
1151 This mark has no technical meaning in the mail system;
1152 it just causes messages to be marked in the header summary,
1153 and makes them specially addressable.
1154 .It Ic echo
1155 Echoes its arguments,
1156 resolving special names as documented for the command
1157 .Ic folder .
1158 The escape sequences `\ea', `\eb', `\ec', `\ef', `\en', `\er', `\et',
1159 `\ev', `\e\e', and `\e0octal-num\fR' are interpreted just as they are by
1160 .Xr printf 1
1161 (proper quoting provided).
1162 .It Ic edit
1163 (e) Point the text editor at each message from the given list in turn.
1164 Modified contents are discarded unless the
1165 .Va writebackedited
1166 variable is set.
1167 .It Ic else
1168 Marks the end of the then-part of an if statement and the beginning of
1169 the part to take effect if the condition of the if statement is false.
1170 .It Ic endif
1171 Marks the end of an if statement.
1172 .It Ic exit
1173 (ex or x) Effects an immediate return to the Shell without modifying the
1174 user's system mailbox, his `mbox' file, or his edit file in
1175 .Fl f ,
1176 as well as a possibly tracked command line editor history file.
1177 .It Ic features
1178 Print the list of features that have been compiled into \*(UA.
1179 .It Ic file
1180 (fi) The same as
1181 .Ic folder .
1182 .It Ic flag
1183 (fl) Takes a message list and marks the messages as `flagged' for
1184 urgent/special attention.
1185 This mark has no technical meaning in the mail system;
1186 it just causes messages to be highlighted in the header summary,
1187 and makes them specially addressable.
1188 .It Ic folders
1189 With no arguments, list the names of the folders in the folder directory.
1190 With an existing folder as an argument,
1191 lists the names of folders below the named folder;
1192 e.\|g. the command `folders @' lists the folders on the base level of
1193 the current IMAP server.
1194 See also the variable
1195 .Va imap-list-depth .
1196 .It Ic folder
1197 (fold) The folder command switches to a new mail file or folder.
1198 With no arguments, it tells the user which file he is currently reading.
1199 If an argument is given, it will write out changes (such as deletions)
1200 the user has made in the current file and read in the new file.
1201 Some special conventions are recognized for the
1202 .Ar name
1203 argument:
1204 .Bl -tag -offset indent -width ".Ar %:filespec"
1205 .It Ar #
1206 (number sign) means the previous file,
1207 .It Ar %
1208 (percent sign) means the invoking user's system mailbox
1209 (or the value of
1210 .Va folder
1211 for IMAP folders),
1212 .It Ar %user
1213 means the system mailbox of `user'
1214 (and never the value of
1215 .Va folder ,
1216 regardless of its actual setting),
1217 .It Ar &
1218 (ampersand) means the invoking user's `mbox' file (see
1219 .Va MBOX Ns
1220 ) and
1221 .It Ar +file
1222 means a `file' in the
1223 .Va folder
1224 directory.
1225 .It Ar %:filespec
1226 expands to the same value as `filespec',
1227 but the file is handled as a system mailbox by, e.g., the
1228 .Ic mbox
1230 .Ic save
1231 commands.
1234 If the name matches one of the strings defined with the command
1235 .Ic shortcut ,
1236 it is replaced by its long form and expanded.
1237 If the name ends with `.gz' or `.bz2' it is treated as being compressed
1238 with
1239 .Xr gzip 1
1241 .Xr bzip2 1 ,
1242 respectively.
1243 Likewise, if `name' does not exist,
1244 but either `name.gz' or `name.bz2' does,
1245 then the compressed file is used.
1246 If `name' refers to a directory with the subdirectories `tmp', `new',
1247 and `cur', then it is treated as a folder in `maildir' format.
1248 A name of the form
1250 .Dl protocol://[user@]host[:port][/file]
1252 is taken as an Internet mailbox specification.
1253 The (optionally) supported protocols are `imap' (IMAP v4r1), `imaps'
1254 (IMAP with SSL/TLS encrypted transport), `pop3' (POP3) and `pop3s' (POP3
1255 with SSL/TLS encrypted transport).
1256 If `user' contains special characters, in particular `/' or `%',
1257 they must be escaped in URL notation, as `%2F' or `%25'.
1258 The optional `file' part applies to IMAP only;
1259 if it is omitted, the default `INBOX' is used.
1261 If \*(UA is connected to an IMAP server,
1262 a name of the form `@mailbox' refers to the `mailbox' on that server,
1263 but otherwise a `@' prefix has no special meaning.
1264 .It Ic Followup
1265 (F) Similar to
1266 .Ic Respond ,
1267 but saves the message in a file named after the local part of the first
1268 recipient's address.
1269 .It Ic followup
1270 (fo) Similar to
1271 .Ic respond ,
1272 but saves the message in a file named after the local part of the first
1273 recipient's address.
1274 .It Ic followupall
1275 Similar to
1276 .Ic followup ,
1277 but responds to all recipients regardless of the
1278 .Va flipr
1280 .Va Replyall
1281 variables.
1282 .It Ic followupsender
1283 Similar to
1284 .Ic Followup ,
1285 but responds to the sender only regardless of the
1286 .Va flipr
1288 .Va Replyall
1289 variables.
1290 .It Ic forward
1291 (fwd) Takes a message and the address of a recipient
1292 and forwards the message to him.
1293 The text of the original message is included in the new one,
1294 with the value of the
1295 .Va fwdheading
1296 variable printed before.
1298 .Ic fwdignore
1300 .Ic fwdretain
1301 commands specify which header fields are included in the new message.
1302 Only the first part of a multipart message is included unless the
1303 .Va forward-as-attachment
1304 option is set.
1305 .It Ic Forward
1306 (Fwd) Similar to
1307 .Ic forward ,
1308 but saves the message in a file named after the local part of the
1309 recipient's address.
1310 .It Ic from
1311 (f) Takes a list of messages and prints their message headers,
1312 piped through the pager if the output does not fit on the screen.
1313 .It Ic fwdignore
1314 Specifies which header fields are to be ignored with the command
1315 .Ic forward .
1316 This command has no effect when the
1317 .Va forward-as-attachment
1318 option is set.
1319 .It Ic fwdretain
1320 Specifies which header fields are to be retained with the command
1321 .Ic forward .
1322 .Ic fwdretain
1323 overrides
1324 .Ic fwdignore .
1325 This command has no effect when the
1326 .Va forward-as-attachment
1327 option is set.
1328 .It Ic ghost
1329 Without arguments it lists all currently defined command aliases,
1330 so-called ghosts.
1331 With two arguments it defines a new command alias: the first argument is
1332 the name under which the second should be accessible.
1333 The content of the second argument can be just about anything.
1334 A ghost can be used everywhere a normal command can be used, but always
1335 takes precedence; any arguments that are given to the command alias are
1336 joined onto the alias content, and the resulting string forms the
1337 command line that is, in effect, executed.
1338 Also see
1339 .Ic unghost .
1341 .Dl ? ghost ls '!ls -latro'
1342 .Dl ? ls /usr/local
1343 .It Ic headers
1344 (h) Lists the current range of headers, which is an 18-message group.
1345 If a `+' argument is given the next 18-message group is printed,
1346 likewise the previous is printed if the argument was `-'.
1347 .It Ic help
1348 A synonym for `?'.
1349 .It Ic hold
1350 (ho, also preserve) Takes a message list and marks each message therein
1351 to be saved in the user's system mailbox instead of in `mbox'.
1352 Does not override the
1353 .Ic delete
1354 command.
1355 \*(UA deviates from the POSIX standard with this command,
1356 as a
1357 .Ic next
1358 command issued after
1359 .Ic hold
1360 will display the following message, not the current one.
1361 .It Ic if
1362 Commands in \*(UA's startup files can be executed conditionally
1363 depending on whether the user is sending or receiving mail with the if
1364 command, e.g.:
1365 .Bd -literal -offset indent
1366    if receive
1367       commands ...
1368    endif
1371 An else form is also available:
1372 .Bd -literal -offset indent
1373    if receive
1374       commands ...
1375    else
1376       commands ...
1377    endif
1380 Note that the only allowed conditions are `receive', `send' and `term'
1381 (execute if standard input is a tty).
1382 .It Ic ignore
1383 Add the list of header fields named to the ignored list.
1384 Header fields in the ignore list are not printed on the terminal when
1385 a message is printed.
1386 This command is very handy for suppression of certain machine-generated
1387 header fields.
1389 .Ic Type
1391 .Ic Print
1392 commands can be used to print a message in its entirety, including
1393 ignored fields.
1394 It lists the current set of ignored fields if no arguments were given.
1395 .It Ic imap
1396 \*(OP Sends command strings directly to the current IMAP server.
1397 \*(UA operates always in IMAP `selected state' on the current mailbox;
1398 commands that change this will produce undesirable results and should be
1399 avoided.
1400 Useful IMAP commands are:
1401 .Bl -tag -offset indent -width ".Ic getquotearoot"
1402 .It create
1403 Takes the name of an IMAP mailbox as an argument and creates it.
1404 .It getquotaroot
1405 (RFC 2087) Takes the name of an IMAP mailbox as an argument
1406 and prints the quotas that apply to the mailbox.
1407 Not all IMAP servers support this command.
1408 .It namespace
1409 (RFC 2342) Takes no arguments and prints the Personal Namespaces,
1410 the Other User's Namespaces and the Shared Namespaces.
1411 Each namespace type is printed in parentheses;
1412 if there are multiple namespaces of the same type,
1413 inner parentheses separate them.
1414 For each namespace a prefix and a hierarchy separator is listed.
1415 Not all IMAP servers support this command.
1417 .It Ic inc
1418 Same as
1419 .Ic newmail .
1420 .It Ic list
1421 Prints the names of all available commands, alphabetically sorted.
1422 .It Ic localopts
1423 Can only be used inside of a macro definition block introduced by
1424 .Ic account
1426 .Ic define ,
1427 and is interpreted as a boolean (value `0' means false, everything
1428 else true).
1429 Any option that had been set while `localopts' was in effect will be
1430 reverted to its former value once the block is left / the `account'
1431 is switched.
1432 .Bd -literal -offset indent
1433 define temporary_settings {
1434         set global_option1
1435         localopts 1
1436         set local_option1
1437         set local_option2
1438         localopts 0
1439         set global_option2
1443 Note that these options stack upon each other, i.e., if macro1 sets
1444 `localopts' and calls macro2, which explicitly resets `localopts', then
1445 any values set within macro2 will still be cleaned up by macro1.
1446 .It Ic Mail
1447 (M) Similar to
1448 .Ic mail ,
1449 but saves the message in a file named after the local part of the first
1450 recipient's address.
1451 .It Ic mail
1452 (m) Takes a (list of) recipient address(es) as (an) argument(s),
1453 or asks on standard input if none were given;
1454 then collects the remaining mail content and sends it out.
1455 .It Ic mbox
1456 The given message list is to be sent to `mbox' when \*(UA is quit.
1457 This is the default action unless the
1458 .Va hold
1459 option is set.
1460 \*(UA deviates from the POSIX standard with this command,
1461 as a
1462 .Ic next
1463 command issued after
1464 .Ic mbox
1465 will display the following message, not the current one.
1466 .It Ic mimetypes
1467 Either
1468 .Ns ( Ar show
1470 .Ar clear
1472 .Xr mime.types 5
1473 cache.
1474 In the former case all sources are loaded first as necessary.
1476 .Va mimetypes-load-control
1477 option can be used to fine-tune loading of the sources.
1478 .It Ic move
1479 (mv) Acts like
1480 .Ic copy
1481 but marks the messages for deletion if they were transferred
1482 successfully.
1483 .It Ic more
1484 Takes a message list and invokes the
1485 .Va PAGER
1486 on that list, printing a form-feed (`\\f') in between messages.
1487 .It Ic More
1488 Like
1489 .Ic more ,
1490 but also prints ignored header fields and all MIME parts.
1491 .It Ic Move
1492 (Mv) Similar to
1493 .Ic move ,
1494 but moves the messages to a file named after the local part of the
1495 sender address of the first message.
1496 .It Ic newmail
1497 Checks for new mail in the current folder without committing any changes
1498 before.
1499 If new mail is present, a message is printed.
1500 If the
1501 .Va header
1502 variable is set,
1503 the headers of each new message are also printed.
1504 .It Ic next
1505 (n) (like `+' or `ENTER') Goes to the next message in sequence
1506 and types it.
1507 With an argument list, types the next matching message.
1508 .It Ic New
1509 Same as
1510 .Ic unread .
1511 .It Ic new
1512 Same as
1513 .Ic unread .
1514 .It Ic online
1515 Same as
1516 .Ic connect .
1517 .It Ic noop
1518 If the current folder is located on an IMAP or POP3 server,
1519 a `NOOP' command is sent.
1520 Otherwise, no operation is performed.
1521 .It Ic Pipe
1522 (Pi) Like
1523 .Ic pipe
1524 but also pipes ignored header fields and all parts of MIME
1525 `multipart/alternative' messages.
1526 .It Ic pipe
1527 (pi) Takes a message list and a shell command
1528 and pipes the messages through the command.
1529 Without an argument the current message is piped through the command
1530 given by the
1531 .Va cmd
1532 variable.
1533 If the
1534 .Va page
1535 variable is set,
1536 every message is followed by a formfeed character.
1537 .It Ic preserve
1538 (pre) A synonym for
1539 .Ic hold .
1540 .It Ic Print
1541 (P) Like
1542 .Ic print
1543 but also prints out ignored header fields and all parts of MIME
1544 `multipart/alternative' messages.
1545 See also
1546 .Ic print ,
1547 .Ic ignore
1549 .Ic retain .
1550 .It Ic print
1551 (p) Takes a message list and types out each message on the user's
1552 terminal.
1553 If the message is a MIME multipart message,
1554 all parts with a content type of `text' or `message' are shown,
1555 the other are hidden except for their headers.
1556 Messages are decrypted and converted to the terminal character set
1557 if necessary.
1558 .It Ic quit
1559 (q) Terminates the session, saving all undeleted, unsaved messages in
1560 the current `mbox', preserving all messages marked with
1561 .Ic hold
1563 .Ic preserve
1564 or never referenced in his system mailbox,
1565 and removing all other messages from his system mailbox.
1566 If new mail has arrived during the session,
1567 the message `You have new mail' is given.
1568 If given while editing a mailbox file with the command line flag
1569 .Fl f ,
1570 then the edit file is rewritten.
1571 A return to the shell is effected,
1572 unless the rewrite of edit file fails,
1573 in which case the user can escape with the exit command.
1574 .It Ic redirect
1575 (red) Same as
1576 .Ic resend .
1577 .It Ic Redirect
1578 (Red) Same as
1579 .Ic Resend .
1580 .It Ic remove
1581 (rem) Removes the named folders.
1582 The user is asked for confirmation in interactive mode.
1583 .It Ic rename
1584 (ren) Takes the name of an existing folder
1585 and the name for the new folder
1586 and renames the first to the second one.
1587 Both folders must be of the same type
1588 and must be located on the current server for IMAP.
1589 .It Ic Reply
1590 (R) Reply to originator.
1591 Does not reply to other recipients of the original message.
1592 .It Ic reply
1593 (r) Takes a message list and sends mail to the sender and all recipients
1594 of the specified messages.
1595 The default message must not be deleted.
1596 .It Ic replyall
1597 Similar to
1598 .Ic reply ,
1599 but responds to all recipients regardless of the
1600 .Va flipr
1602 .Va Replyall
1603 variables.
1604 .It Ic replysender
1605 Similar to
1606 .Ic Reply ,
1607 but responds to the sender only regardless of the
1608 .Va flipr
1610 .Va Replyall
1611 variables.
1612 .It Ic Resend
1613 Like
1614 .Ic resend ,
1615 but does not add any header lines.
1616 This is not a way to hide the sender's identity,
1617 but useful for sending a message again to the same recipients.
1618 .It Ic resend
1619 Takes a list of messages and a user name
1620 and sends each message to the named user.
1621 `Resent-From:' and related header fields are prepended to the new copy
1622 of the message.
1623 .It Ic Respond
1624 Same as
1625 .Ic Reply .
1626 .It Ic respond
1627 Same as
1628 .Ic reply .
1629 .It Ic respondall
1630 Same as
1631 .Ic replyall .
1632 .It Ic respondsender
1633 Same as
1634 .Ic replysender .
1635 .It Ic retain
1636 Add the list of header fields named to the retained list.
1637 Only the header fields in the retain list are shown on the terminal when
1638 a message is printed, all other header fields are suppressed.
1640 .Ic Type
1642 .Ic Print
1643 commands can be used to print a message in its entirety.
1644 The current set of retained fields is shown if
1645 .Ic retain
1646 is used without arguments.
1647 .It Ic Save
1648 (S) Similar to
1649 .Ic save,
1650 but saves the messages in a file named after the local part of the
1651 sender of the first message instead of taking a filename argument.
1652 .It Ic save
1653 (s) Takes a message list and a filename and appends each message in turn
1654 to the end of the file.
1655 If no filename is given, the `mbox' file is used.
1656 The filename in quotes, followed by the line count and character count
1657 is echoed on the user's terminal.
1658 If editing a system mailbox the messages are marked for deletion.
1659 Compressed files and IMAP mailboxes are handled as described for the
1660 .Fl f
1661 command line option above.
1662 .It Ic savediscard
1663 Same as
1664 .Ic saveignore .
1665 .It Ic saveignore
1666 Is to
1667 .Ic save
1668 what
1669 .Ic ignore
1670 is to
1671 .Ic print
1673 .Ic type .
1674 Header fields thus marked are filtered out when saving a message by
1675 .Ic save
1676 or when automatically saving to `mbox'.
1677 This command should only be applied to header fields that do not contain
1678 information needed to decode the message,
1679 as MIME content fields do.
1680 If saving messages on an IMAP account ignoring fields makes it
1681 impossible to copy the data directly on the server,
1682 thus operation usually becomes much slower.
1683 .It Ic saveretain
1684 Is to
1685 .Ic save
1686 what
1687 .Ic retain
1688 is to
1689 .Ic print
1691 .Ic type .
1692 Header fields thus marked are the only ones saved with a message when
1693 saving by
1694 .Ic save
1695 or when automatically saving to `mbox'.
1696 .Ic saveretain
1697 overrides
1698 .Ic saveignore .
1699 The use of this command is strongly discouraged since it may strip
1700 header fields that are needed to decode the message correctly.
1701 .It Ic set
1702 (se) With no arguments, prints all variable values.
1703 Otherwise, sets an option.
1704 Arguments are of the form `option=value' (no space before or after `='),
1705 or plain `option' if there is no value.
1706 Quotation marks may be placed around any part of the assignment
1707 statement to quote blanks or tabs, e.g.,
1709 .Dl set indentprefix="->"
1711 If an argument begins with `no', as in `set nosave',
1712 the effect is the same as invoking the
1713 .Ic unset
1714 command with the remaining part of the variable (`unset save').
1715 .It Ic seen
1716 Takes a message list and marks all messages as having been read.
1717 .It Ic shell
1718 (sh) Invokes an interactive version of the shell.
1719 .It Ic shortcut
1720 Defines a shortcut name and its string for expansion,
1721 as described for the
1722 .Ic folder
1723 command.
1724 If used without arguments the currently defined shortcuts are printed.
1725 .It Ic show
1726 (Sh) Like
1727 .Ic print ,
1728 but performs neither MIME decoding nor decryption so that the raw
1729 message text is shown.
1730 .It Ic size
1731 Print the size in characters of each message of the given message-list.
1732 .It Ic sort
1733 Create a sorted representation of the current folder,
1734 and change the
1735 .Ic next
1736 command and the addressing modes such that they refer to messages in the
1737 sorted order.
1738 Message numbers are the same as in regular mode.
1739 If the
1740 .Va header
1741 variable is set,
1742 a header summary in the new order is also printed.
1743 Possible sorting criteria are:
1744 .Bl -tag -offset indent -width "subject"
1745 .It date
1746 Sort the messages by their `Date:' field,
1747 that is by the time they were sent.
1748 .It from
1749 Sort messages by the value of their `From:' field,
1750 that is by the address of the sender.
1751 If the
1752 .Va showname
1753 variable is set,
1754 the sender's real name (if any) is used.
1755 .It size
1756 Sort the messages by their size.
1757 .It spam
1758 \*(OP Sort the message by their spam score, as has been classified via
1759 the command
1760 .Ic spamrate .
1761 .It status
1762 Sort the messages by their message status (new, read, old, etc.).
1763 .It subject
1764 Sort the messages by their subject.
1765 .It thread
1766 Create a threaded order,
1767 as with the command
1768 .Ic thread .
1769 .It to
1770 Sort messages by the value of their `To:' field,
1771 that is by the address of the recipient.
1772 If the
1773 .Va showname
1774 variable is set,
1775 the recipient's real name (if any) is used.
1778 If no argument is given,
1779 the current sorting criterion is printed.
1780 .It Ic source
1781 The source command reads commands from a file.
1782 .It Ic spamclear
1783 \*(OP Takes a list of messages and clears their `is-spam' flag.
1784 .It Ic spamforget
1785 \*(OP Takes a list of messages and forces the spam detector to forget it
1786 has ever used them to train its Bayesian filter, wether as `ham' or
1787 `spam'.
1788 .It Ic spamham
1789 \*(OP Takes a list of messages and teaches them to the spam detector as
1790 being `ham'.
1791 This also clears the `is-spam' flag of the messages in question.
1792 .It Ic spamrate
1793 \*(OP Takes a list of messages and rates them using the configured spam
1794 detector, setting their `is-spam' flag as appropriate.
1795 Note that the messages are not modified, and due to that the rating will
1796 get lost once the mailbox is left.
1797 Refer to the manual section
1798 .Sx "Handling spam"
1799 for the complete picture of spam handling in \*(UA.
1800 .It Ic spamset
1801 \*(OP Takes a list of messages and sets their `is-spam' flag.
1802 .It Ic spamspam
1803 \*(OP Takes a list of messages and teaches them to the spam detector as
1804 being `spam'.
1805 This also sets the `is-spam' flag of the messages in question.
1806 .It Ic thread
1807 (th) Create a threaded representation of the current folder,
1808 i.\|e. indent messages that are replies to other messages in the header
1809 display and change the
1810 .Ic next
1811 command and the addressing modes such that they refer to messages in the
1812 threaded order.
1813 Message numbers are the same as in unthreaded mode.
1814 If the
1815 .Va header
1816 variable is set,
1817 a header summary in threaded order is also printed.
1818 .It Ic top
1819 Takes a message list and prints the top few lines of each.
1820 The number of lines printed is controlled by the variable
1821 .Va toplines
1822 and defaults to five.
1823 .It Ic touch
1824 Takes a message list and marks the messages for saving in `mbox'.
1825 \*(UA deviates from the POSIX standard with this command,
1826 as a
1827 .Ic next
1828 command issued after `mbox' will display the following message instead
1829 of the current one.
1830 .It Ic Type
1831 (T) Identical to the
1832 .Ic Print
1833 command.
1834 .It Ic type
1835 (t) A synonym for
1836 .Ic print .
1837 .It Ic unalias
1838 Takes a list of names defined by alias commands
1839 and discards the remembered groups of users.
1840 .It Ic unanswered
1841 Takes a message list and marks each message as not having been answered.
1842 .It Ic uncollapse
1843 (unc) Only applicable to threaded mode.
1844 Takes a message list and makes the message and all replies to it visible
1845 in header summaries again.
1846 When a message becomes the current message,
1847 it is automatically made visible.
1848 Also when a message with collapsed replies is printed,
1849 all of these are automatically uncollapsed.
1850 .It Ic undef
1851 Undefines each of the named macros.
1852 It is not an error to use a name that does not belong to
1853 one of the currently defined macros.
1854 .It Ic undelete
1855 (u) Takes a message list and marks each message as not being deleted.
1856 .It Ic undraft
1857 Takes a message list and
1858 .Ns un Ns Ic draft Ns
1859 s each message.
1860 .It Ic unflag
1861 Takes a message list and marks each message as not being
1862 .Ic flag Ns ged .
1863 .It Ic unfwdignore
1864 Removes the header field names from the list of ignored fields for the
1865 .Ic forward
1866 command.
1867 .It Ic unfwdretain
1868 Removes the header field names from the list of retained fields for the
1869 .Ic forward
1870 command.
1871 .It Ic unghost
1872 Remove an existing command
1873 .Ic ghost .
1874 .It Ic unignore
1875 Removes the header field names from the list of ignored fields.
1876 .It Ic Unread
1877 Same as
1878 .Ic unread .
1879 .It Ic unread
1880 (U) Takes a message list and marks each message as not having been read.
1881 .It Ic unretain
1882 Removes the header field names from the list of retained fields.
1883 .It Ic unsaveignore
1884 Removes the header field names from the list of ignored fields for
1885 saving.
1886 .It Ic unsaveretain
1887 Removes the header field names from the list of retained fields for
1888 saving.
1889 .It Ic unset
1890 Takes a list of option names and discards their remembered values;
1891 the inverse of
1892 .Ic set .
1893 .It Ic unshortcut
1894 Deletes the shortcut names given as arguments.
1895 .It Ic unsort
1896 Disable sorted or threaded mode
1897 (see the
1898 .Ic sort
1900 .Ic thread
1901 commands),
1902 return to normal message order and,
1903 if the
1904 .Va header
1905 variable is set,
1906 print a header summary.
1907 .It Ic unthread
1908 (unth) Same as
1909 .Ic unsort .
1910 .It Ic verify
1911 \*(OP (verif) Takes a message list and verifies each message.
1912 If a message is not an S/MIME signed message,
1913 verification will fail for it.
1914 The verification process checks if the message was signed using a valid
1915 certificate,
1916 if the message sender's email address matches one of those contained
1917 within the certificate,
1918 and if the message content has been altered.
1919 .It Ic visual
1920 (v) Takes a message list and invokes the display editor on each message.
1921 Modified contents are discarded unless the
1922 .Va writebackedited
1923 variable is set.
1924 .It Ic write
1925 (w) For conventional messages the body without all headers is written.
1926 The output is decrypted and converted to its native format as necessary.
1927 If the output file exists, the text is appended.
1928 If a message is in MIME multipart format its first part is written to
1929 the specified file as for conventional messages,
1930 and the user is asked for a filename to save each other part.
1931 For convience saving of each part may be skipped by giving an empty value;
1932 the same result can also be achieved by writing it to
1933 .Pa /dev/null .
1934 For the second and subsequent parts a leading `|' character causes the
1935 part to be piped to the remainder of the user input interpreted as
1936 a shell command;
1937 otherwise the user input is expanded as usually for folders,
1938 e.g., tilde expansion is performed.
1939 In non-interactive mode, only the parts of the multipart message
1940 that have a filename given in the part header are written,
1941 the others are discarded.
1942 The original message is never marked for deletion in the originating
1943 mail folder.
1944 For attachments,
1945 the contents of the destination file are overwritten if the file
1946 previously existed.
1947 No special handling of compressed files is performed.
1948 .It Ic xit
1949 (x) A synonym for
1950 .Ic exit .
1951 .It Ic z
1952 \*(UA presents message headers in windowfuls as described under the
1953 .Ic headers
1954 command.
1955 This command scrolls to the next window of messages.
1956 If an argument is given,
1957 it specifies the window to use.
1958 A number prefixed by `+' or `\-' indicates
1959 that the window is calculated in relation to the current position.
1960 A number without a prefix specifies an absolute window number,
1961 and a `$' lets \*(UA scroll to the last window of messages.
1962 .It Ic Z
1963 Similar to
1964 .Ic z ,
1965 but scrolls to the next or previous window that contains at least one
1966 new or `flagged' message.
1969 .\" --  >8  --  8<  --
1970 .Ss "Tilde escapes"
1971 Here is a summary of the tilde escapes,
1972 which are used to perform special functions when composing messages.
1973 Tilde escapes are only recognized at the beginning of lines.
1974 The name `tilde escape' is somewhat of a misnomer since the actual
1975 escape character can be set by the option
1976 .Va escape .
1977 .Bl -tag -width ".Ic ~< filename"
1978 .It Ic ~~ Ar string
1979 Insert the string of text in the message prefaced by a single `~'.
1980 (If the escape character has been changed,
1981 that character must be doubled
1982 in order to send it at the beginning of a line.)
1983 .It Ic ~! Ar command
1984 Execute the indicated shell
1985 .Ar command ,
1986 then return to the message.
1987 .It Ic ~.
1988 Same effect as typing the end-of-file character.
1989 .It Ic ~: Ar \*(UA-command Ns \ or Ic ~_ Ar \*(UA-command
1990 Execute the given \*(UA command.
1991 Not all commands, however, are allowed.
1992 .It Ic ~?
1993 Write a summary of command escapes.
1994 .It Ic ~< Ar filename
1995 Identical to
1996 .Ic ~r .
1997 .It Ic ~<! Ar command
1998 .Ar command
1999 is executed using the shell.
2000 Its standard output is inserted into the message.
2001 .It Ic ~@ Op Ar filename...
2002 With no arguments, edit the attachment list interactively.
2003 If an attachment's file name is left empty,
2004 that attachment is deleted from the list.
2005 When the end of the attachment list is reached,
2006 \*(UA will ask for further attachments until an empty name is given.
2007 If a given file name solely consists of the number sign `#' followed
2008 by a valid message number of the currently active mailbox, the given
2009 message is attached as a MIME `message/rfc822' and the rest of this
2010 section does not apply.
2012 If character set conversion has been compiled into \*(UA, then this mode
2013 gives the user the option to specify input and output character sets,
2014 unless the file extension indicates binary content, in which case \*(UA
2015 asks wether this step shall be skipped for the attachment in question.
2016 If not skipped, then the charset that succeeds to represent the
2017 attachment data will be used in the `charset=' MIME parameter of the
2018 mail message.
2019 .Bl -bullet
2021 If input and output character sets are specified, then the conversion is
2022 performed on the fly.
2023 The user will be asked repeatedly until the desired conversion succeeds.
2025 If only an output character set is specified, then the input is assumed
2026 to be in the
2027 .Va ttycharset
2028 charset and will be converted to the given output charset on the fly.
2029 The user will be asked repeatedly until the desired conversion succeeds.
2031 If no character sets are specified at all then the algorithm that is
2032 documented in the section
2033 .Sx "Character sets"
2034 is applied, but directly and on the fly.
2035 The user will be asked repeatedly until the desired conversion succeeds.
2037 Finally, if an input-, but no output character set is specified, then no
2038 conversion is ever performed, but the `charset=' MIME parameter will
2039 still be set to the user input.
2042 Without character set conversion support, \*(UA will ask for the input
2043 character set only, and it'll set the `charset=' MIME parameter to the
2044 given input, if any;
2045 if no user input is seen then the
2046 .Va ttycharset
2047 character set will be used for the `charset=' parameter instead.
2048 Note that the file extension check isn't performed in this mode, since
2049 no conversion will take place anyway.
2051 Note that in non-interactive mode, for reproduceabilities sake, there
2052 will always be two questions for each attachment, regardless of wether
2053 character set conversion is available and what the file extension is.
2054 The first asks for the filename, and the second asks for the input
2055 character set to be passed through to the `charset=' MIME parameter;
2056 no conversion will be tried if there is input to the latter question,
2057 otherwise the usual conversion algorithm, as above, is applied.
2058 For message attachments, the answer to the second question is completely
2059 ignored.
2062 .Ar filename
2063 arguments are specified,
2064 they are treated as a comma separated list of files,
2065 which are all expanded and appended to the end of the attachment list.
2066 (Filenames with commas, or with leading or trailing whitespace can only
2067 be added via the command line or the first method.
2068 Message attachments can only be added via the first method;
2069 filenames which clash with message numbers can only be added via the
2070 command line or the second method.)
2071 In this mode the (text) attachments are assumed to be in
2072 .Va ttycharset
2073 encoding, and will be evaluated as documented in the section
2074 .Sx "Character sets" .
2075 .It Ic ~A
2076 Inserts the string contained in the
2077 .Va Sign
2078 variable (same as `~i Sign').
2079 The escape sequences `\et' (tabulator) and `\en' (newline) are understood.
2080 .It Ic ~a
2081 Inserts the string contained in the
2082 .Va sign
2083 variable (same as `~i sign').
2084 The escape sequences `\et' (tabulator) and `\en' (newline) are understood.
2085 .It Ic ~b Ar name ...
2086 Add the given names to the list of blind carbon copy recipients.
2087 .It Ic ~c Ar name ...
2088 Add the given names to the list of carbon copy recipients.
2089 .It Ic ~d
2090 Read the file specified by the
2091 .Va DEAD
2092 variable into the message.
2093 .It Ic ~e
2094 Invoke the text editor on the message collected so far.
2095 After the editing session is finished,
2096 the user may continue appending text to the message.
2097 .It Ic ~f Ar messages
2098 Read the named messages into the message being sent.
2099 If no messages are specified,
2100 read in the current message.
2101 Message headers currently being ignored (by the
2102 .Ic ignore
2104 .Ic retain
2105 command) are not included.
2106 For MIME multipart messages,
2107 only the first printable part is included.
2108 .It Ic ~F Ar messages
2109 Identical to `~f', except that all message headers and MIME parts are
2110 included.
2111 .It Ic ~h
2112 Edit the message header fields `To:', `Cc:', `Bcc:', and `Subject:' by
2113 typing each one in turn and allowing the user to edit the field.
2114 .It Ic ~H
2115 Edit the message header fields `From:', `Reply-To:', `Sender:' and
2116 `Organization:' in the same manner as described for
2117 .Ic ~h .
2118 The default values for these fields originate from the
2119 .Va from ,
2120 .Va replyto ,
2121 .Va sender
2123 .Va ORGANIZATION
2124 variables.
2125 .It Ic ~i Ar variable
2126 Insert the value of the specified variable into the message,
2127 adding a newline character at the end.
2128 The message remains unaltered if the variable is unset or empty.
2129 The escape sequences `\et' (tabulator) and `\en' (newline) are understood.
2130 .It Ic ~m Ar messages
2131 Read the named messages into the message being sent,
2132 indented by a tab or by the value of
2133 .Va indentprefix .
2134 If no messages are specified,
2135 read the current message.
2136 Message headers currently being ignored (by the
2137 .Ic ignore
2139 .Ic retain
2140 commands) are not included.
2141 For MIME multipart messages,
2142 only the first printable part is included.
2143 .It Ic ~M Ar messages
2144 Identical to `~m', except that all message headers and MIME parts are
2145 included.
2146 .It Ic ~p
2147 Print out the message collected so far,
2148 prefaced by the message header fields
2149 and followed by the attachment list, if any.
2150 .It Ic ~q
2151 Abort the message being sent,
2152 copying it to the file specified by the
2153 .Va DEAD
2154 variable if
2155 .Va save
2156 is set.
2157 .It Ic ~r Ar filename
2158 Read the named file into the message.
2159 .It Ic ~s Ar string
2160 Cause the named string to become the current subject field.
2161 .It Ic ~t Ar name ...
2162 Add the given name(s) to the direct recipient list.
2163 .It Ic ~v
2164 Invoke an alternate editor (defined by the
2165 .Va VISUAL
2166 option) on the message collected so far.
2167 Usually, the alternate editor will be a screen editor.
2168 After the editor is quit,
2169 the user may resume appending text to the end of the message.
2170 .It Ic ~w Ar filename
2171 Write the message onto the named file.
2172 If the file exists,
2173 the message is appended to it.
2174 .It Ic ~x
2175 Same as `~q', except that the message is not saved at all.
2176 .It Ic ~| Ar command
2177 Pipe the message through the specified filter command.
2178 If the command gives no output or terminates abnormally,
2179 retain the original text of the message.
2180 E.g., the command
2181 .Xr fmt 1
2182 is often used as a rejustifying filter.
2185 .\" --  >8  --  8<  --
2186 .Ss "Variable options"
2187 Options are controlled via
2188 .Ic set
2190 .Ic unset
2191 commands, see the corresponding entries for a syntax description.
2192 An option is also set if it is passed to \*(UA as part of the program
2193 environment (this is not restricted to specific variables as in the
2194 POSIX standard).
2195 A value given in a startup file overrides a value imported from the
2196 environment.
2197 Options may be either binary, in which case it is only significant to
2198 see whether they are set or not;
2199 or string, in which case the actual value is of interest.
2201 .\" --  >8  --  8<  --
2202 .Ss "Binary options"
2203 The binary options include the following:
2204 .Bl -tag -width ".Va autoprint"
2205 .It Va add-file-recipients
2206 When file or pipe recipients have been specified,
2207 mention them in the corresponding address fields of the message instead
2208 of silently stripping them from their recipient list.
2209 By default such addressees are not mentioned.
2210 .It Va allnet
2211 Causes only the local part to be evaluated
2212 when comparing addresses.
2213 .It Va append
2214 Causes messages saved in mbox to be appended to the end rather than
2215 prepended.
2216 This should always be set.
2217 .It Va ask Ns \ or Va asksub
2218 Causes \*(UA to prompt for the subject of each message sent.
2219 If the user responds with simply a newline,
2220 no subject field will be sent.
2221 .It Va askatend
2222 Causes the prompts for `Cc:' and `Bcc:' lists to appear after the
2223 message has been edited.
2224 .It Va askattach
2225 If set, \*(UA asks for files to attach at the end of each message.
2226 An empty line finalizes the list.
2227 .It Va askcc
2228 Causes the user to be prompted for additional carbon copy recipients (at
2229 the end of each message if
2230 .Va askatend
2232 .Va bsdcompat
2233 are set).
2234 An empty line finalizes the list.
2235 .It Va askbcc
2236 Causes the user to be prompted for additional blind carbon copy
2237 recipients (at the end of each message if
2238 .Va askatend
2240 .Va bsdcompat
2241 are set).
2242 An empty line finalizes the list.
2243 .It Va asksign
2244 \*(OP Causes the user to be prompted if the message is to be signed at
2245 the end of each message.
2247 .Va smime-sign
2248 variable is ignored when this variable is set.
2249 .It Va autocollapse
2250 Causes threads to be collapsed automatically when threaded mode is
2251 entered (see the
2252 .Ic collapse
2253 command).
2254 .It Va autoinc
2255 Same as
2256 .Va newmail .
2257 .It Va autoprint
2258 Causes the delete command to behave like `dp -';
2259 thus, after deleting a message the next one will be typed automatically.
2260 .It Va autothread
2261 Causes threaded mode (see the
2262 .Ic thread
2263 command) to be entered automatically when a folder is opened.
2264 .It Va bang
2265 Enables the substitution of `!' by the contents of the last command line
2266 in shell escapes.
2267 .It Va batch-exit-on-error
2268 If the batch mode has been enabled via the
2269 .Fl #
2270 command line option, then this variable will be consulted whenever \*(UA
2271 completes one operation (returns to the command prompt); if it is set
2272 then \*(UA will terminate if the last operation generated an error.
2273 .It Va bsdannounce
2274 Causes automatic display of a header summary after executing a
2275 .Ic folder
2276 command.
2277 .It Va bsdcompat
2278 Sets some cosmetical features to traditional BSD style;
2279 has the same affect as setting
2280 .Va askatend
2281 and all other variables prefixed with `bsd';
2282 it also changes the meaning of the \*(UA specific `\\&'
2283 .Va prompt
2284 escape sequence.
2285 .It Va bsdflags
2286 Changes the letters printed in the first column of a header summary
2287 to traditional BSD style.
2288 .It Va bsdheadline
2289 Changes the display of columns in a header summary to traditional BSD
2290 style.
2291 .It Va bsdmsgs
2292 Changes some informational messages to traditional BSD style.
2293 .It Va bsdorder
2294 Causes the `Subject:' field to appear immediately after the `To:' field
2295 in message headers and with the `~h' tilde command.
2296 .It Va bsdset
2297 Changes the output format of the
2298 .Ic set
2299 command to traditional BSD style.
2300 .It Va debug
2301 Prints debugging messages and disables the actual delivery of messages.
2302 Unlike
2303 .Va verbose ,
2304 this option is intended for \*(UA development only.
2305 .It Va disconnected
2306 \*(OP When an IMAP mailbox is selected and this variable is set,
2307 no connection to the server is initiated.
2308 Instead, data is obtained from the local cache (see
2309 .Va imap-cache Ns
2311 Mailboxes that are not present in the cache
2312 and messages that have not yet entirely been fetched from the server
2313 are not available;
2314 to fetch all messages in a mailbox at once,
2315 the command
2316 .Ns ` Ns Li copy * /dev/null Ns '
2317 can be used while still in
2318 .Va online
2319 mode.
2320 Changes that are made to IMAP mailboxes in disconnected mode are queued
2321 and committed later when a connection to that server is opened in online
2322 mode.
2323 This procedure is not completely reliable since it cannot be guaranteed
2324 that the IMAP unique identifiers (UIDs) on the server still match the
2325 ones in the cache at that time.
2326 Data is saved to
2327 .Va DEAD
2328 when this problem occurs.
2329 .It Va disconnected-user@host
2330 The specified account is handled as described for the
2331 .Va disconnected
2332 variable above,
2333 but other accounts are not affected.
2334 .It Va dot
2335 The binary option dot causes \*(UA to interpret a period alone on a line
2336 as the terminator of a message the user is sending.
2337 .It Va editalong
2338 If this variable is set then the editor is started automatically when
2339 composing a message in an interactive mode,
2340 as if the `~e' tilde command had been specified.
2342 .Va editheaders
2343 variable is implied for this automatically spawned editor session.
2344 .It Va editheaders
2345 When a message is edited while being composed,
2346 its header is included in the editable text.
2347 The `To:', `Cc:', `Bcc:', `Subject:', `From:', `Reply-To:', `Sender:',
2348 and 'Organization:' fields are accepted within the header,
2349 other fields are ignored.
2350 .It Va emptybox
2351 If set, an empty mailbox file is not removed.
2352 This may improve the interoperability with other mail user agents
2353 when using a common folder directory.
2354 .It Va emptystart
2355 If the mailbox is empty \*(UA normally prints `No mail for user' and
2356 exits immediately.
2357 If this option is set \*(UA starts even with an empty mailbox.
2358 .It Va flipr
2359 Exchanges the
2360 .Ic Respond
2361 with the
2362 .Ic respond
2363 commands and vice-versa.
2364 .It Va forward-as-attachment
2365 Original messages are normally sent as inline text with the
2366 .Ic forward
2367 command,
2368 and only the first part of a multipart message is included.
2369 With this option messages are sent as MIME `message/rfc822' attachments
2370 with all of their parts included.
2372 .Va fwdignore
2374 .Va fwdretain
2375 options are ignored when the
2376 .Va forward-as-attachment
2377 option is set.
2378 .It Va fullnames
2379 When replying to a message \*(UA normally removes the comment parts of
2380 email addresses,
2381 which by convention contain the full names of the recipients.
2382 If this variable is set such stripping is not performed,
2383 and comments are retained.
2384 .It Va header
2385 Causes the header summary to be written at startup and after commands
2386 that affect the number of messages or the order of messages in the
2387 current folder; enabled by default.
2388 .It Va hold
2389 This option is used to hold messages in the system mailbox by default.
2390 .It Va idna-disable
2391 \*(OP Can be used to turn off the automatic conversion of domain names
2392 according to the rules of IDNA (internationalized domain names for
2393 applications).
2394 Since the IDNA code assumes domain names are specified with the
2395 .Va ttycharset
2396 character set, an UTF-8 locale charset is required to represent
2397 all possible international domain names (before conversion, that is).
2398 .It Va ignore
2399 Causes interrupt signals from the terminal to be ignored
2400 and echoed as `@'s.
2401 .It Va ignoreeof
2402 An option related to
2403 .Va dot
2405 .Va ignoreeof ,
2406 which makes \*(UA refuse to accept a `control-D' as the end of a message.
2407 This option also applies to \*(UA command mode.
2408 .It Va imap-use-starttls
2409 \*(OP Causes \*(UA to issue a `STARTTLS' command to make an unencrypted
2410 IMAP session SSL/TLS encrypted.
2411 This functionality is not supported by all servers,
2412 and is not used if the session is already encrypted by the IMAPS method.
2413 .It Va imap-use-starttls-user@host
2414 Activates
2415 .Va imap-use-starttls
2416 for a specific account.
2417 .It Va keep
2418 This option causes \*(UA to truncate the user's system mailbox instead
2419 of deleting it when it is empty.
2420 This should always be set since it prevents malicious users from
2421 creating fake mail folders in a world-writable spool directory.
2422 .It Va keepsave
2423 When a message is saved it is usually discarded from the originating
2424 folder when \*(UA is quit.
2425 Setting this option causes all saved message to be retained.
2426 .It Va line-editor-disable
2427 Turn off any enhanced command line editing capabilities (see
2428 .Sx "Command line editor"
2429 for more).
2430 .It Va markanswered
2431 When a message is replied to and this variable is set,
2432 it is marked as having been answered.
2433 This mark has no technical meaning in the mail system;
2434 it just causes messages to be marked in the header summary,
2435 and makes them specially addressable.
2436 .It Va message-id-disable
2437 By setting this option the generation of `Message-ID:' can be completely
2438 suppressed, effectively leaving this task up to the mail-transfer-agent
2439 (MTA) or the SMTP server.
2440 (According to RFC 5321 your SMTP server is not required to add this
2441 field by itself, so you should ensure that it accepts messages without
2442 a `Message-ID'.)
2443 .It Va metoo
2444 Usually, when a group is expanded that contains the sender,
2445 the sender is removed from the expansion.
2446 Setting this option causes the sender to be included in the group.
2447 .It Va mime-allow-text-controls
2448 When sending messages, each part of the message is MIME-inspected in
2449 order to classify the `Content-Type:' and `Content-Transfer-Encoding:'
2450 that is required to send this part over mail transport, i.e.,
2451 a computation rather similar to what the
2452 .Xr file 1
2453 command produces when used with the
2454 .Fl -mime
2455 option.
2457 This classification however treats text files which are encoded in
2458 UTF-16 (often found for HTML files) and similar character sets as binary
2459 octet-streams, forcefully changing any `text/plain' or `text/html'
2460 specification to `application/octet-stream';
2461 if that actually happens, then a yet unset charset MIME parameter is set
2462 to `binary', effectively making it impossible for the receiving MUA to
2463 automatically interpret the contents of the part.
2465 If this option is set, and the data was unambiguously identified as text
2466 data at first glance (by a `.txt' or `.html' file extension), then the
2467 original `Content-Type:' will not be overwritten.
2468 .It Va mime-counter-evidence
2469 Normally the `Content-Type:' field is used to decide how to treat
2470 a messages MIME part.
2471 Some MUAs however don't use
2472 .Xr mime.types 5
2473 or a similar mechanism to correctly classify content,
2474 but simply specify `application/octet-stream',
2475 even for plain text attachments like `text/diff'.
2476 If this variable is set then \*(UA will use the file extension of
2477 attachments to classify such MIME message parts, if possible.
2478 .It Va newmail
2479 Checks for new mail in the current folder each time the prompt is
2480 printed.
2481 For IMAP mailboxes the server is then polled for new mail,
2482 which may result in delayed operation if the connection to the server is
2483 slow.
2484 A `maildir' folder must be re-scanned to determine if new mail has
2485 arrived.
2487 If this variable is set to the special value `nopoll' an IMAP server is
2488 not actively asked for new mail,
2489 but new mail may still be detected and announced with any other IMAP
2490 command that is sent to the server.
2491 A `maildir' folder is not scanned, then.
2493 In either case the IMAP server may send notifications about messages
2494 that have been deleted on the server by another process or client.
2495 In this case, `Expunged X messages' is printed regardless of this
2496 variable,
2497 and message numbers may have changed.
2498 .It Va noheader
2499 Setting this option is the same as using the command line option
2500 .Fl N .
2501 .It Va outfolder
2502 Causes the filename given in the
2503 .Va record
2504 variable
2505 and the sender-based filenames for the
2506 .Ic Copy
2508 .Ic Save
2509 commands to be interpreted relative to the directory given in the
2510 .Va folder
2511 variable rather than to the current directory,
2512 unless it is set to an absolute pathname.
2513 .It Va page
2514 If set, each message the
2515 .Ic pipe
2516 command prints out is followed by a formfeed character.
2517 .It Va piperaw
2518 Send messages to the
2519 .Ic pipe
2520 command without performing MIME and character set conversions.
2521 .It Va pop3-bulk-load
2522 \*(OP When accessing a POP3 server \*(UA loads the headers of the
2523 messages, and only requests the message bodies on user request.
2524 For the POP3 protocol this means that the message headers will be
2525 downloaded twice.
2526 If this option is set then \*(UA will download only complete messages
2527 from POP3 servers instead.
2528 It may be useful to
2529 .Ic define
2530 a macro that temporarily sets this option, then accesses a POP3 account
2531 that is known to only get small text messages, and then unsets this
2532 variable again.
2533 .It Va pop3-no-apop
2534 \*(OP Unless this variable is set the `APOP' authentication method
2535 will be used when connecting to a POP3 server that advertises support.
2536 The advantage of APOP over `USER/PASS' authentication is that the
2537 password is not sent in clear text over the wire and that only a single
2538 packet is sent for the user/password tuple.
2539 .It Va pop3-no-apop-user@host
2540 Disables usage of the `APOP' authentication method (see
2541 .Va pop3-no-apop )
2542 for a specific account.
2543 .It Va pop3-use-starttls
2544 \*(OP Causes \*(UA to issue a `STLS' command to make an unencrypted POP3
2545 session SSL/TLS encrypted.
2546 This functionality is not supported by all servers,
2547 and is not used if the session is already encrypted by the POP3S method.
2548 .It Va pop3-use-starttls-user@host
2549 Activates
2550 .Va pop3-use-starttls
2551 for a specific account.
2552 .It Va print-all-chars
2553 This option causes all characters to be considered printable.
2554 It is only effective if given in a startup file.
2555 With this option set some character sequences in messages may put the
2556 user's terminal in an undefined state when printed;
2557 it should only be used as a last resort if no working system locale can
2558 be found.
2559 .It Va print-alternatives
2560 When a MIME message part of type `multipart/alternative' is displayed
2561 and it contains a subpart of type `text/plain',
2562 other parts are normally discarded.
2563 Setting this variable causes all subparts to be displayed,
2564 just as if the surrounding part was of type `multipart/mixed'.
2565 .It Va quiet
2566 Suppresses the printing of the version when first invoked.
2567 .It Va quote-as-attachment
2568 If this is set, then the original message is added in its entirety
2569 as a `message/rfc822' MIME attachment when replying to a message.
2570 Note this works regardless of the setting of
2571 .Va quote .
2572 .It Va recipients-in-cc
2573 On group replies, specify only the sender of the original mail in `To:'
2574 and mention it's other recipients in the secondary `Cc:'.
2575 .It Va record-resent
2576 If both this variable and the
2577 .Va record
2578 variable are set,
2580 .Ic resend
2582 .Ic Resend
2583 commands save messages to the
2584 .Va record
2585 folder as it is normally only done for newly composed messages.
2586 .It Va reply-in-same-charset
2587 If this variable is set \*(UA first tries to use the same character set
2588 of the original message for replies.
2589 If this fails, the mechanism described in
2590 .Sx "Character sets"
2591 is evaluated as usual.
2592 .It Va Replyall
2593 Reverses the sense of
2594 .Ic reply
2596 .Ic Reply
2597 commands.
2598 .It Va rfc822-body-from_
2599 This variable can be used to force the display of a so-called `From_'
2600 line for messages that are embedded into an envelope mail via the
2601 `message/rfc822' MIME mechanism.
2602 .It Va save
2603 When the user aborts a message with two `RUBOUT' (interrupt) characters,
2604 \*(UA will copy the partial letter to the file
2605 .Va DEAD .
2606 This option is set by default.
2607 .It Va searchheaders
2608 Expand message-list specifiers in the form `/x:y' to all messages
2609 containing the substring `y' in the header field `x'.
2610 The string search is case insensitive.
2611 .It Va sendcharsets-else-ttycharset
2612 \*(OP If this variable is set, but
2613 .Va sendcharsets
2614 is not, then \*(UA acts as if
2615 .Va sendcharsets
2616 had been set to the value of the variable
2617 .Va ttycharset .
2618 In effect this combination passes through the message data in the
2619 character set of the current locale (given that
2620 .Va ttycharset
2621 hasn't been set manually), i.e., without converting it to the
2622 .Va charset-8bit
2623 fallback character set.
2624 Thus, mail message text will be in `ISO-8859-1' encoding when send from
2625 within a `ISO-8859-1' locale, and in `UTF-8' encoding when send from
2626 within an `UTF-8' locale.
2627 .It Va sendwait
2628 When sending a message wait until the MTA exits before accepting further
2629 commands.
2630 If the MTA returns a non-zero exit status,
2631 the exit status of \*(ua will also be non-zero.
2632 .It Va showlast
2633 Setting this option causes \*(UA to start at the last message instead of
2634 the first one when opening a mail folder.
2635 .It Va showname
2636 Causes \*(UA to use the sender's real name instead of the plain address
2637 in the header field summary and in message specifications.
2638 .It Va showto
2639 Causes the recipient of the message to be shown in the header summary
2640 if the message was sent by the user.
2641 .It Va skipemptybody
2642 If an outgoing message does not contain any text in its first or only
2643 message part,
2644 do not send it but discard it silently (see also the command line option
2645 .Fl E Ns
2647 .It Va smime-force-encryption
2648 \*(OP Causes \*(UA to refuse sending unencrypted messages.
2649 .It Va smime-sign
2650 \*(OP S/MIME sign outgoing messages with the user's private key.
2651 Signing a message enables a recipient to verify that the sender used
2652 a valid certificate,
2653 that the email addresses in the certificate match those in the message
2654 header and that the message content has not been altered.
2655 It does not change the message text,
2656 and people will be able to read the message as usual.
2657 .It Va smime-no-default-ca
2658 \*(OP Don't load default CA locations when verifying S/MIME signed
2659 messages.
2660 .It Va smtp-use-starttls
2661 \*(OP Causes \*(UA to issue a `STARTTLS' command to make an SMTP session
2662 SSL/TLS encrypted.
2663 Not all servers support this command \(en because of common
2664 implementation defects it can't be automatically determined whether
2665 a server supports it or not.
2666 .It Va ssl-no-default-ca
2667 \*(OP Don't load default CA locations to verify SSL/TLS server
2668 certificates.
2669 .It Va ssl-v2-allow
2670 \*(OP Accept SSLv2 connections.
2671 These are normally not allowed because this protocol version is insecure.
2672 .It Va keep-content-length
2673 When (editing messages and) writing MBOX mailbox files \*(UA can be told
2674 to keep the `Content-Length:' and `Lines:' header fields that some MUAs
2675 generate by setting this variable.
2676 Since \*(UA does neither use nor update these non-standardized header
2677 fields (which in itself shows one of their conceptual problems),
2678 stripping them should increase interoperability in between MUAs that
2679 work with with same mailbox files.
2680 Note that, if this is not set but
2681 .Va writebackedited ,
2682 as below, is, a possibly performed automatic stripping of these header
2683 fields already marks the message as being modified.
2684 .It Va verbose
2685 Setting the option verbose is the same as using the command line option
2686 .Fl v .
2687 When \*(UA runs in verbose mode details of the actual message delivery
2688 and protocol conversations for IMAP, POP3, and SMTP,
2689 as well as of other internal processes,
2690 are displayed on the user's terminal.
2691 This is sometimes useful to debug problems.
2692 \*(UA prints all data that is sent to remote servers in clear texts,
2693 including passwords,
2694 so care should be taken that no unauthorized option can view the screen
2695 if this option is enabled.
2696 .It Va writebackedited
2697 If this variable is set messages modified using the
2698 .Ic edit
2700 .Ic visual
2701 commands are written back to the current folder when it is quit;
2702 it is only honoured for writable folders in `mbox' format, though.
2703 Note that the editor will be pointed to the raw message content in that
2704 case, i.e., neither MIME decoding nor decryption will have been
2705 performed,
2706 and proper RFC 4155 `From ' quoting of newly added or edited content is
2707 also left as an excercise to the user.
2710 .\" --  >8  --  8<  --
2711 .Ss "Value options"
2712 The value options include the following:
2713 .Bl -tag -width ".Va autoprint"
2714 .It Va attrlist
2715 A sequence of characters to print in the `attribute' column of a header
2716 summary,
2717 each for one type of messages in the following order:
2718 new (N), unread but old (U), new but read (R), read and old (O), saved
2719 (S), preserved (P), mboxed (M), flagged (F), answered (A), draft (T),
2720 start of a collapsed thread (+), collapsed (\-), classified as spam ($).
2721 The default is `NUROSPMFAT+\-$',
2722 or `NU\ \ *HMFAT+\-$' if
2723 .Va bsdflags
2724 or the
2725 .Va SYSV3
2726 environment variable are set.
2727 .It Va autobcc
2728 Specifies a list of recipients to which a blind carbon copy of each
2729 outgoing message will be sent automatically.
2730 .It Va autocc
2731 Specifies a list of recipients to which a carbon copy of each outgoing
2732 message will be sent automatically.
2733 .It Va autosort
2734 Causes sorted mode (see the
2735 .Ic sort
2736 command) to be entered automatically with the value of this option as
2737 sorting method when a folder is opened.
2738 .It Va charset-7bit
2739 The value that should appear in the `charset=' parameter of
2740 `Content-Type:' MIME header fields when no character set conversion of
2741 the message data was performed.
2742 This defaults to `US-ASCII', and the chosen character set should be
2743 `US-ASCII' compatible.
2744 .It Va charset-8bit
2745 \*(OP The default 8 bit character set that is used if
2746 .Va sendcharsets
2747 is not set or no character set therein was capable to represent the
2748 content of a message.
2749 Defaults to `UTF-8'.
2750 If no character set conversion capabilities are available in \*(UA then
2751 the only supported character set is
2752 .Va ttycharset .
2753 Refer to the section
2754 .Sx "Character sets"
2755 for the complete picture of character set conversion in \*(UA.
2756 .It Va cmd
2757 The default value for the
2758 .Ic pipe
2759 command.
2760 .It Va crt
2761 The valued option crt is used as a threshold to determine how long
2762 a message must be before
2763 .Va PAGER
2764 is used to read it.
2766 .Va crt
2767 is set without a value then the height of the terminal screen stored in
2768 the system is used to compute the threshold (see
2769 .Va LINES
2771 .Xr stty 1 Ns
2773 .It Va DEAD
2774 The name of the file to use for saving aborted messages.
2775 This defaults to `dead.letter' in the user's home directory.
2776 .It Va datefield
2777 The date in a header summary is normally the date of the mailbox `From\ '
2778 line of the message.
2779 If this variable is set, then the date as given in the `Date:' field is
2780 used, converted to local time.
2781 It is possible to control the display of the date by assigning a value,
2782 in which case the
2783 .Xr strftime 3
2784 function will be used to format the date accordingly.
2785 Please read your system manual for the available formats.
2786 Note that the `%n' format should not be used, because \*(UA doesn't
2787 take embedded newlines into account when calculating how many lines fit
2788 onto the screen.
2789 .It Va datefield-markout-older
2790 This option, when set in addition to
2791 .Va datefield ,
2792 modifies the display of messages that are not really current in a way
2793 that is rather comparable to the
2794 .Fl l
2795 option of the POSIX
2796 .Xr ls 1
2797 command.
2798 The interpretation of the value is identical to what has been described
2800 .Va datefield .
2801 .It Va EDITOR
2802 Pathname of the text editor to use in the
2803 .Ic edit
2804 command and
2805 .Ic ~e
2806 tilde escape.
2807 A default editor is used if this value is not defined.
2808 .It Va encoding
2809 The default MIME encoding to use in outgoing text messages and message
2810 parts.
2811 Valid values are the default `quoted-printable', `8bit' and `base64'.
2812 `8bit' may cause problems with mail transfers that are not ESMTP
2813 compliant.
2814 If there is no need to encode a message,
2815 `7bit' transfer mode is always used regardless of this variable.
2816 Binary data is always encoded as `base64'.
2817 .It Va escape
2818 If defined, the first character of this option
2819 gives the character to use in place of `~' to denote tilde escapes.
2820 .It Va folder
2821 The name of the directory to use for storing folders of messages.
2822 All folder names that begin with `+' refer to files below it.
2823 The same special conventions as documented for the
2824 .Ic folder
2825 command may be used when specifying a new value for
2826 .Va folder ,
2827 but be aware that the expansion is fully performed immediately.
2828 E.g., if the expanded name refers to an IMAP account, all names that
2829 begin with `+' refer to IMAP mailboxes below the
2830 .Va folder
2831 target box.
2833 Note: some IMAP servers do not accept the creation of mailboxes in
2834 the hierarchy base, but require that they are created as subfolders of
2835 `INBOX' \(en with such servers a folder name of the form
2837 .Dl imaps://mylogin@imap.myisp.example/INBOX.
2839 should be used (the last character is the server's hierarchy delimiter).
2840 Folder names prefixed by `+' will then refer to folders below `INBOX',
2841 while folder names prefixed by `@' refer to folders below the hierarchy
2842 base.
2843 See the
2844 .Ic imap
2845 namespace command for a method to detect the appropriate prefix and
2846 delimiter.
2847 .It Va folder-hook
2848 When a folder is opened and this variable is set,
2849 the macro corresponding to the value of this variable is executed.
2850 The macro is also invoked when new mail arrives,
2851 but message lists for commands executed from the macro
2852 only include newly arrived messages then.
2853 .It Va folder-hook-fullname
2854 When a folder named `fullname' is opened,
2855 the macro corresponding to the value of this variable is executed.
2856 Unlike other folder specifications,
2857 the fully expanded name of a folder, without metacharacters,
2858 is used to avoid ambiguities.
2859 The macro specified with
2860 .Va folder-hook
2861 is not executed if this variable is effective for a folder
2862 (but it can be
2863 .Ic call Ns
2864 ed from within the actually executed macro).
2865 .It Va from
2866 The address (or a list of addresses) to put into the `From:' field of
2867 the message header.
2868 If replying to messages these addresses are handled as if they were in
2870 .Ic alternates
2871 list.
2872 If the machine's hostname is not valid at the Internet (for example at
2873 a dialup machine), then either this variable or
2874 .Va hostname
2875 have to be set.
2877 .Va from
2878 contains more than one address,
2880 .Va sender
2881 variable must also be set.
2882 .It Va fwdheading
2883 The string to print before the text of a message with the
2884 .Ic forward
2885 command
2886 (unless the
2887 .Va forward-as-attachment
2888 variable is set).
2889 Defaults to `-------- Original Message --------' if unset.
2890 No heading is printed if it is set to the empty string.
2891 .It Va headline
2892 A format string to use for the header summary,
2893 similar to
2894 .Xr printf 3
2895 formats.
2896 A `%' character introduces a format specifier.
2897 It may be followed by a number indicating the field width.
2898 If the (possibly implicitly implied) field width is negative, the field
2899 is to be left-aligned.
2900 Valid format specifiers are:
2901 .Bl -tag -offset indent -width "%%"
2902 .It %a
2903 Message attributes.
2904 .It %d
2905 The date when the message was received.
2906 .It %e
2907 The indenting level in threaded mode.
2908 .It %f
2909 The address of the message sender.
2910 .It %i
2911 The message thread structure.
2912 (Note that this format doesn't support a field width.)
2913 .It %l
2914 The number of lines of the message.
2915 .It %m
2916 Message number.
2917 .It %o
2918 The number of octets (bytes) in the message.
2919 .It %s
2920 Message subject (if any).
2921 .It %S
2922 Message subject (if any) in double quotes.
2923 .It %t
2924 The position in threaded/sorted order.
2925 .It %>
2926 A `>' for the current message, otherwise ` '.
2927 .It %<
2928 A `<' for the current message, otherwise ` '.
2929 .It %$
2930 The spam score of the message, as has been classified via the command
2931 .Ic spamrate .
2932 .It %%
2933 A `%' character.
2936 The default is `%>\&%a\&%m\ %-18f\ %16d\ %4l/%\-5o\ %i%-s',
2937 or `%>\&%a\&%m\ %20-f\ \ %16d\ %3l/%\-5o\ %i%-S' if
2938 .Va bsdcompat
2939 is set.
2940 .It Va hostname
2941 Use this string as hostname when expanding local addresses instead of
2942 the value obtained from
2943 .Xr uname 2
2945 .Xr getaddrinfo 3 ,
2946 i.e., in `Message-ID:' and `From:' fields.
2947 Note that when
2948 .Va smtp
2949 transport is not used then it is normally the responsibility of the MTA
2950 to create these fields; you should produce some test messages with the
2951 desired combination of
2952 .Va hostname ,
2953 and/or
2954 .Va from ,
2955 .Va sender
2956 etc. first.
2957 .It Va imap-auth
2958 \*(OP Sets the IMAP authentication method.
2959 Valid values are `login' for the usual password-based authentication
2960 (the default),
2961 `cram-md5', which is a password-based authentication that does not send
2962 the password over the network in clear text,
2963 and `gssapi' for GSSAPI-based authentication.
2964 .It Va imap-auth-user@host
2965 Sets the IMAP authentication method for a specific account.
2966 .It Va imap-cache
2967 \*(OP Enables caching of IMAP mailboxes.
2968 The value of this variable must point to a directory that is either
2969 existent or can be created by \*(UA.
2970 All contents of the cache can be deleted by \*(UA at any time;
2971 it is not safe to make assumptions about them.
2972 .It Va imap-keepalive
2973 \*(OP IMAP servers may close the connection after a period of
2974 inactivity; the standard requires this to be at least 30 minutes,
2975 but practical experience may vary.
2976 Setting this variable to a numeric `value' greater than 0 causes
2977 a `NOOP' command to be sent each `value' seconds if no other operation
2978 is performed.
2979 .It Va imap-list-depth
2980 \*(OP When retrieving the list of folders on an IMAP server, the
2981 .Ic folders
2982 command stops after it has reached a certain depth to avoid possible
2983 infinite loops.
2984 The value of this variable sets the maximum depth allowed.
2985 The default is 2.
2986 If the folder separator on the current IMAP server is a slash `/',
2987 this variable has no effect and the
2988 .Ic folders
2989 command does not descend to subfolders.
2990 .It Va indentprefix
2991 String used by the `~m' and `~M' tilde escapes and by the
2992 .Va quote
2993 option for indenting messages,
2994 in place of the normal tab character (`^I').
2995 Be sure to quote the value if it contains spaces or tabs.
2996 .It Va LISTER
2997 Pathname of the directory lister to use in the
2998 .Ic folders
2999 command when operating on local mailboxes.
3000 Default is
3001 .Pa /bin/ls .
3002 .It Va line-editor-cursor-right
3003 \*(OP If the builtin command line editor is used, actions which are
3004 based on rightwise movement may not work on some terminals.
3005 If you encounter such problems, set this variable to the terminal
3006 control sequence that is necessary to move the cursor one column to the
3007 right.
3008 The default is `\\033[C', which should work for most terminals.
3009 Less often occur `\\033OC' and `\\014'.
3010 Note that `ESCAPE' and other control character have to be written as
3011 shell-style escape sequences, e.g., `\\033' for `ESCAPE'.
3012 .It Va MAIL
3013 Is used as the user's mailbox, if set.
3014 Otherwise, a system-dependent default is used.
3015 Supports a logical subset of the special conventions that are documented
3016 for the
3017 .Ic folder
3018 command and the
3019 .Va folder
3020 option.
3021 .It Va MBOX
3022 The name of the mbox file.
3023 Supports a logical subset of the special conventions that are documented
3024 for the
3025 .Ic folder
3026 command and the
3027 .Va folder
3028 option.
3029 The fallback default is `mbox' in the user's home directory.
3030 .It Va mimetypes-load-control
3031 This option can be used to control which of the
3032 .Xr mime.types 5
3033 MIME type databases are loaded by \*(UA.
3034 If the letter `u' (or `U') is part of this options value, then the
3035 user's personal
3036 .Pa ~/.mime.types
3037 file will be loaded (if it exists);
3038 likewise the letter `s' (or `S') controls loading of the system wide
3039 .Pa /etc/mime.types .
3040 If this option is not set \*(UA will try to load both files instead.
3041 Incorporation of the MIME types that are compiled into \*(UA cannot be
3042 suppressed.
3043 .It Va NAIL_EXTRA_RC
3044 The name of an optional startup file to be read after \*(ur.
3045 This variable is ignored if it is imported from the environment;
3046 it has an effect only if it is set in \*(UR or \*(ur to allow bypassing
3047 the configuration with, e.g., `MAILRC=/dev/null'.
3048 Use this file for commands that are not understood by other \*(UA
3049 implementations.
3050 .It Va NAIL_HEAD
3051 A string to put at the beginning of each new message.
3052 The escape sequences `\et' (tabulator) and `\en' (newline) are understood.
3053 .It Va NAIL_HISTFILE
3054 \*(OP If a command line editor is available then this can be set to
3055 name the (expandable) path of the location of a permanent history file.
3056 .It Va NAIL_HISTSIZE
3057 \*(OP If a command line editor is available this value restricts the
3058 amount of history entries that are saved into a set and valid
3059 .Va NAIL_HISTFILE .
3060 A value of less than 0 disables this feature;
3061 note that loading and incorporation of
3062 .Va NAIL_HISTFILE
3063 upon program startup can also be suppressed by doing this.
3064 An unset or invalid value, or 0, causes a default value to be used.
3065 Dependent on the available command line editor this will also define the
3066 number of history entries in memory;
3067 it is also editor-specific wether runtime updates of this value will be
3068 honoured.
3069 .It Va NAIL_TAIL
3070 A string to put at the end of each new message.
3071 The escape sequences `\et' (tabulator) and `\en' (newline) are understood.
3072 .It Va newfolders
3073 If this variable has the value `maildir',
3074 newly created local folders will be in `maildir' format.
3075 .It Va ORGANIZATION
3076 The value to put into the `Organization:' field of the message header.
3077 .It Va PAGER
3078 Pathname of the program to use in the more command or when the
3079 .Va crt
3080 variable is set.
3081 The default paginator is
3082 .Xr more 1 .
3083 .It Va password-user@host
3084 Set the password for `user' when connecting to `host'.
3085 If no such variable is defined for a host,
3086 the user will be asked for a password on standard input.
3087 Specifying passwords in a startup file is generally a security risk;
3088 the file should be readable by the invoking user only.
3089 .It Va pipe-content/subcontent
3090 When a MIME message part of `content/subcontent' type is displayed or
3091 is replied to,
3092 its text is filtered through the value of this variable interpreted as
3093 a shell command.
3095 The special value `@' can be used to force interpretation of the message
3096 part as plain text, e.g., `set pipe-application/pgp-signature=@' will
3097 henceforth treat signatures as plain text and display them "as is".
3099 Also, if a normal shell command is prefixed with `@', then the command
3100 will only be used to prepare the MIME message part if the message is
3101 displayed by itself, but not when multiple messages are displayed at
3102 once.
3104 Finally, if a normal shell command is prefixed with `@&', then, in
3105 addition to what has been described for the plain `@' shell command
3106 prefix, the command will be run asynchronously, i.e., without blocking
3107 \*(UA, which may be a handy way to display a, e.g., PDF file while also
3108 continuing to read the mail message.
3110 Special care must be taken when using such commands as mail viruses may
3111 be distributed by this method;
3112 if messages of type `application/x-sh' were filtered through the shell,
3113 for example,
3114 a message sender could easily execute arbitrary code on the system \*(UA
3115 is running on.
3116 .It Va pop3-keepalive
3117 \*(OP POP3 servers close the connection after a period of inactivity;
3118 the standard requires this to be at least 10 minutes,
3119 but practical experience may vary.
3120 Setting this variable to a numeric `value' greater than 0 causes
3121 a `NOOP' command to be sent each `value' seconds if no other operation
3122 is performed.
3123 .It Va prompt
3124 The string printed when a command is accepted.
3125 Prompting may be prevented by either setting this to the null string
3126 or by setting
3127 .Va noprompt .
3128 The same XSI escape sequences that are understood by the
3129 .Ic echo
3130 command may be used within
3131 .Va prompt .
3133 In addition, the following \*(UA specific additional sequences are
3134 understood:
3135 `\\&', which expands to `?' unless
3136 .Va bsdcompat
3137 is set, in which case it expands to `&';
3138 note that "\\& " is the default value for
3139 .Va prompt .
3140 `\\?', which will expand to `1' if the last command failed, and to `0'
3141 otherwise,
3142 `\\$', which will expand to the name of the currently active
3143 .Ic account ,
3144 if any, and to the empty string otherwise,
3145 and `\\@', which will expand to the name of the currently active mailbox.
3146 (Note that the prompt buffer is size-limited, excess is cut off.)
3148 When a newer version of the
3149 .Xr editline 3
3150 .Sx "Command line editor"
3151 is used, any escape sequence must itself be encapsulated with another
3152 escape character for usage with the
3153 .Va EL_PROMPT_ESC
3154 mechanism: \*(UA configures the control character `\\01' for this.
3155 .It Va quote
3156 If set, \*(UA starts a replying message with the original message
3157 prefixed by the value of the variable
3158 .Va indentprefix .
3159 Normally, a heading consisting of `Fromheaderfield wrote:' is printed
3160 before the quotation.
3161 If the string `noheading' is assigned to the
3162 .Va quote
3163 variable, this heading is omitted.
3164 If the string `headers' is assigned, the headers selected by the
3165 .Ic ignore Ns / Ns Ic retain
3166 commands are printed above the message body,
3167 thus
3168 .Va quote
3169 acts like an automatic `~m' tilde escape command, then.
3170 If the string `allheaders' is assigned, all headers are printed above
3171 the message body and all MIME parts are included,
3172 making
3173 .Va quote
3174 act like an automatic `~M' command.
3175 Also see
3176 .Va quote-as-attachment .
3177 .It Va quote-fold
3178 \*(OP Can be set in addition to
3179 .Va indentprefix .
3180 Setting this turns on a more fancy quotation algorithm in that leading
3181 quotation characters are compressed and overlong lines are folded.
3182 .Va quote-fold
3183 can be set to either one or two (space separated) numeric values,
3184 which are interpreted as the maximum (goal) and the minimum line length,
3185 respectively, in a spirit rather equal to the
3186 .Xr fmt 1
3187 program, but line-, not paragraph-based.
3188 If not set explicitly the minimum will reflect the goal algorithmically.
3189 The goal can't be smaller than the length of
3190 .Va indentprefix
3191 plus some additional pad.
3192 Necessary adjustments take place silently.
3193 .It Va record
3194 If defined, gives the pathname of the folder used to record all outgoing
3195 mail.
3196 If not defined, then outgoing mail is not saved.
3197 When saving to this folder fails the message is not sent,
3198 but instead saved to
3199 .Va DEAD .
3200 .It Va replyto
3201 A list of addresses to put into the `Reply-To:' field of the message
3202 header.
3203 Members of this list are handled as if they were in the
3204 .Ic alternates
3205 list.
3206 .It Va screen
3207 When \*(UA initially prints the message headers it determines the number
3208 to print by looking at the speed of the terminal.
3209 The faster the terminal, the more it prints.
3210 This option overrides this calculation and specifies how many message
3211 headers are printed.
3212 This number is also used for scrolling with the
3213 .Ic z
3214 command.
3215 .It Va sendcharsets
3216 \*(OP A comma-separated list of character set names that can be used in
3217 outgoing Internet mail.
3218 If no character set conversion capabilities are compiled into \*(UA then
3219 the only supported charset is
3220 .Va ttycharset .
3221 Also see
3222 .Va sendcharsets-else-ttycharset
3223 and refer to the section
3224 .Sx "Character sets"
3225 for the complete picture of character set conversion in \*(UA.
3226 .It Va sender
3227 An address that is put into the `Sender:' field of outgoing messages.
3228 This field needs not normally be present.
3229 It is, however, required if the `From:' field contains more than one
3230 address.
3231 It can also be used to indicate that a message was sent on behalf of
3232 someone else \(en in this case, `From:' should contain the address
3233 of the person that took responsibility for the message,
3234 and `Sender:' should contain the address of the person that actually
3235 sent the message.
3237 .Va sender
3238 address is handled as if it were in the
3239 .Ic alternates
3240 list.
3241 .It Va sendmail
3242 To use an alternate mail delivery system,
3243 set this option to the full pathname of the program to use.
3244 It may be necessary to set
3245 .Va sendmail-progname
3246 in addition.
3247 .It Va sendmail-progname
3248 Many systems use a so-called
3249 .Xr mailwrapper 8
3250 environment to ensure compatibility with
3251 .Xr sendmail 1 .
3252 This works by inspecting the name that was used to invoke the mail
3253 delivery system.
3254 If this variable is set then the mailwrapper (the program that is
3255 actually executed when calling `sendmail') will treat its contents as
3256 that name.
3257 The default is `sendmail'.
3258 .It Va SHELL
3259 Pathname of the shell to use in the
3260 .Ic !
3261 command and the `~!' tilde escape.
3262 A default shell is used if this option is not defined.
3263 .It Va Sign
3264 A string for use with the `~A' tilde escape.
3265 .It Va sign
3266 A string for use with the `~a' tilde escape.
3267 .It Va signature
3268 Must correspond to the name of a readable file if set.
3269 The file's content is then appended to each singlepart message
3270 and to the first part of each multipart message.
3271 Be warned that there is no possibility to edit the signature for an
3272 individual message.
3273 .It Va smime-ca-dir
3274 \*(OP Specifies a directory with CA certificates in PEM (Privacy
3275 Enhanced Mail) format for verification of S/MIME signed messages.
3276 .It Va smime-ca-file
3277 \*(OP Specifies a file with CA certificates in PEM format for
3278 verification of S/MIME signed messages.
3279 .It Va smime-cipher-user@host
3280 \*(OP Specifies a cipher to use when generating S/MIME encrypted
3281 messages for `user@host'.
3282 Valid ciphers are `rc2-40' (RC2 with 40 bits), `rc2-64' (RC2 with 64
3283 bits), `des' (DES, 56 bits) and `des-ede3' (3DES, 112/168 bits).
3284 The default is 3DES.
3285 It is not recommended to use the other ciphers unless a recipient's
3286 client is actually unable to handle 3DES since they are comparatively
3287 weak.
3288 .It Va smime-crl-file
3289 \*(OP Specifies a file that contains a CRL in PEM format to use when
3290 verifying S/MIME messages.
3291 .It Va smime-crl-dir
3292 \*(OP Specifies a directory that contains files with CRLs in PEM format
3293 to use when verifying S/MIME messages.
3294 .It Va smime-encrypt-user@host
3295 \*(OP If this variable is set, messages to `user@host' are encrypted
3296 before sending.
3297 The value of the variable must be set to the name of a file that
3298 contains a certificate in PEM format.
3300 If a message is sent to multiple recipients,
3301 each of them for whom a corresponding variable is set will receive an
3302 individually encrypted message;
3303 other recipients will continue to receive the message in plain text
3304 unless the
3305 .Va smime-force-encryption
3306 variable is set.
3307 It is recommended to sign encrypted messages, i.e., to also set the
3308 .Va smime-sign
3309 variable.
3310 .It Va smime-sign-cert
3311 \*(OP Points to a file in PEM format that contains the user's private
3312 key as well as his certificate.
3313 Both are used with S/MIME for signing and decrypting messages.
3314 .It Va smime-sign-cert-user@host
3315 Overrides
3316 .Va smime-sign-cert
3317 for the specific addresses.
3318 When signing messages and the value of the
3319 .Va from
3320 variable is set to `user@host', the specific file is used.
3321 When decrypting messages,
3322 their recipient fields (`To:' and `Cc:') are searched for addresses
3323 for which such a variable is set.
3324 \*(UA always uses the first address that matches,
3325 so if the same message is sent to more than one of the user's addresses
3326 using different encryption keys, decryption might fail.
3327 .It Va smime-sign-include-certs
3328 \*(OP If used, this must be set to a comma-separated list of files,
3329 each of which containing a single certificate in PEM format to be
3330 included in the S/MIME message in addition to the
3331 .Va smime-sign-cert
3332 certificate.
3333 This is most useful for long certificate chains if it is desired to aid
3334 the receiving party's verification process.
3335 .It Va smime-sign-include-certs-user@host
3336 Overrides
3337 .Va smime-sign-include-certs
3338 for the specific addresses.
3339 Refer to the discussion of
3340 .Va smime-sign-cert-user@host
3341 for more on this topic.
3342 .It Va smtp
3343 \*(OP Normally \*(UA invokes
3344 .Xr sendmail 1
3345 directly to transfer messages.
3346 If the
3347 .Va smtp
3348 variable is set, a SMTP connection to the server specified by the value
3349 of this variable is used instead.
3350 If the SMTP server does not use the standard port, a value of
3351 `server:port' can be given, with `port' as a name or as a number.
3353 There are two possible methods to get SSL/TLS encrypted SMTP sessions:
3354 First, the `STARTTLS' command can be used to encrypt a session after it
3355 has been initiated,
3356 but before any user-related data has been sent; see
3357 .Va smtp-use-starttls
3358 above.
3359 Second, some servers accept sessions that are encrypted from begin on.
3360 This mode is configured by assigning `smtps://server[:port]' to the
3361 .Va smtp
3362 variable.
3364 The SMTP transfer is executed in a child process, which runs
3365 asynchronously unless either the
3366 .Va sendwait
3367 or the
3368 .Va verbose
3369 variable is set.
3370 If it receives a TERM signal, it will abort and save the message to
3371 .Va DEAD .
3372 .It Va smtp-auth
3373 \*(OP Sets the SMTP authentication method.
3374 If set to `login', or if unset and
3375 .Va smtp-auth-user
3376 is set, `AUTH LOGIN' is used.
3377 If set to `cram-md5', `AUTH CRAM-MD5' is used;
3378 if set to `plain', `AUTH PLAIN' is used.
3379 Otherwise, no SMTP authentication is performed.
3380 .It Va smtp-auth-user@host
3381 Overrides
3382 .Va smtp-auth
3383 for specific values of sender addresses, dependend upon the variable
3384 .Va from .
3385 .It Va smtp-auth-password
3386 \*(OP Sets the global password for `SMTP AUTH'.
3387 Both user and password have to be given for `AUTH LOGIN' and
3388 `AUTH CRAM-MD5'.
3389 .It Va smtp-auth-password-user@host
3390 Overrides
3391 .Va smtp-auth-password
3392 for specific values of sender addresses, dependent upon the variable
3393 .Va from .
3394 .It Va smtp-auth-user
3395 \*(OP Sets the global user name for `SMTP AUTH'.
3396 Both user and password have to be given for `AUTH LOGIN' and
3397 `AUTH CRAM-MD5'.
3398 If this variable is set but neither
3399 .Va smtp-auth-password
3400 nor a matching
3401 .Va smtp-auth-password-user@host
3402 can be found,
3403 \*(UA will ask for a password on the user's terminal.
3404 .It Va smtp-auth-user-user@host
3405 Overrides
3406 .Va smtp-auth-user
3407 for specific values of sender addresses, dependent upon the variable
3408 .Va from .
3409 .It Va spam-command
3410 \*(OP The path to the spam detector.
3411 Note that the path is not expanded, but used "as is".
3412 A fallback path will have been compiled into the \*(UA binary if the
3413 .Xr spamc 1
3414 executable had been found during compilation.
3415 .It Va spam-host
3416 \*(OP Can be used to specify the host on which
3417 .Xr spamd 1
3418 listens for connections; if not set, defaults to `localhost'.
3419 .It Va spam-maxsize
3420 \*(OP Spam detectors like
3421 .Xr spamc 1
3422 decline to work with messages which exceed a specific size;
3423 if this variable is set then \*(UA won't even try to pass messages which
3424 exceed the given limit.
3425 The default is 420000 bytes.
3426 .It Va spam-port
3427 \*(OP Can be used to explicitly specify the port on which
3428 .Xr spamd 1
3429 listens for connections.
3430 .It Va spam-socket
3431 \*(OP If the spam detector listens on a path-based UNIX domain socket,
3432 then setting this variable to the fully qualified path will force its
3433 usage for communication.
3434 .It Va spam-user
3435 \*(OP This can be used to support multiple, per-used configuration files
3436 of the spam detector.
3437 Note that \*(UA doesn't automatically set this to reflect a possibly set
3438 .Fl u
3439 option.
3440 .It Va ssl-ca-dir
3441 \*(OP Specifies a directory with CA certificates in PEM (Pricacy
3442 Enhanced Mail) for verification of of SSL/TLS server certificates.
3444 .Xr SSL_CTX_load_verify_locations 3
3445 for more information.
3446 .It Va ssl-ca-file
3447 \*(OP Specifies a file with CA certificates in PEM format for
3448 verification of SSL/TLS server certificates.
3450 .Xr SSL_CTX_load_verify_locations 3
3451 for more information.
3452 .It Va ssl-cert
3453 \*(OP Sets the file name for a SSL/TLS client certificate required by
3454 some servers.
3455 .It Va ssl-cert-user@host
3456 Sets an account-specific file name for a SSL/TLS client certificate
3457 required by some servers.
3458 Overrides
3459 .Va ssl-cert
3460 for the specified account.
3461 .It Va ssl-cipher-list
3462 \*(OP Specifies a list of ciphers for SSL/TLS connections.
3464 .Xr ciphers 1
3465 for more information.
3466 .It Va ssl-crl-file
3467 \*(OP Specifies a file that contains a CRL in PEM format to use when
3468 verifying SSL/TLS server certificates.
3469 .It Va ssl-crl-dir
3470 \*(OP Specifies a directory that contains files with CRLs in PEM format
3471 to use when verifying SSL/TLS server certificates.
3472 .It Va ssl-key
3473 \*(OP Sets the file name for the private key of a SSL/TLS client
3474 certificate.
3475 If unset, the name of the certificate file is used.
3476 The file is expected to be in PEM format.
3477 .It Va ssl-key-user@host
3478 Sets an account-specific file name for the private key of a SSL/TLS
3479 client certificate.
3480 Overrides
3481 .Va ssl-key
3482 for the specified account.
3483 .It Va ssl-method
3484 \*(OP Selects a SSL/TLS protocol version;
3485 \*(UA accepts the values `ssl2', `ssl3', `tls1', `tls1.1' and `tls1.2',
3486 though it depends on the OpenSSL library that is found on the system
3487 what is truly supported.
3488 If unset, the method is selected automatically, if possible
3489 (this process usually tries to use the most secure method possible).
3490 This approach is also taken if the chosen value is not supported by the
3491 OpenSSL library, in which case an error message will be printed first.
3492 .It Va ssl-method-user@host
3493 Overrides
3494 .Va ssl-method
3495 for a specific account.
3496 .It Va ssl-rand-egd
3497 \*(OP Gives the pathname to an entropy daemon socket, see
3498 .Xr RAND_egd 3 .
3499 .It Va ssl-rand-file
3500 \*(OP Gives the pathname to a file with entropy data, see
3501 .Xr RAND_load_file 3 .
3502 If the file is a regular file writable by the invoking user,
3503 new data is written to it after it has been loaded.
3504 .It Va ssl-verify
3505 \*(OP Sets the action to be performed if an error occurs during SSL/TLS
3506 server certificate validation.
3507 Valid values are
3508 `strict' (fail and close connection immediately),
3509 `ask' (ask whether to continue on standard input),
3510 `warn' (print a warning and continue),
3511 `ignore' (do not perform validation).
3512 The default is `ask'.
3513 .It Va ssl-verify-user@host
3514 Overrides
3515 .Va ssl-verify
3516 for a specific account.
3517 .It Va stealthmua
3518 If only set without an assigned value, then this option inhibits the
3519 generation of the `Message-Id:' and `User-Agent:' header fields that
3520 include obvious references to \*(UA.
3521 There are two pitfalls associated with this:
3522 First, the message id of outgoing messages is not known anymore.
3523 Second, an expert may still use the remaining information in the header
3524 to track down the originating mail user agent.
3525 If set to the value `noagent', then the mentioned `Message-Id:'
3526 suppression doesn't occur.
3527 .It Va toplines
3528 If defined, gives the number of lines of a message to be printed out
3529 with the top command;
3530 normally, the first five lines are printed.
3531 .It Va ttycharset
3532 The character set of the terminal \*(UA operates on,
3533 and the one and only supported character set that \*(UA can use if no
3534 character set conversion capabilities have been compiled into it,
3535 in which case it defaults to `ISO-8859-1' unless it can deduce a value
3536 from the `LC_CTYPE' locale environment.
3537 Refer to the section
3538 .Sx "Character sets"
3539 for the complete picture about character sets.
3540 .It Va VISUAL
3541 Pathname of the text editor to use in the
3542 .Ic visual
3543 command and `~v' tilde escape.
3546 .\" --  >8  --  8<  --
3548 .Sh ENVIRONMENT
3549 Besides the variables described above,
3550 \*(UA uses the following environment variables:
3551 .Bl -tag -width ".It Va MAILRC"
3552 .It Va COLUMNS
3553 The user's preferred width in column positions for the terminal screen
3554 or window (only used during startup).
3555 .It Va HOME
3556 The user's home directory.
3557 .It Va LANG , Va LC_ALL , Va LC_COLLATE , Va LC_CTYPE , Va LC_MESSAGES
3559 .Xr locale  7 .
3560 .It Va LINES
3561 The user's preferred number of lines on a page or the vertical screen or
3562 window size in lines (only used during startup).
3563 .It Va MAILRC
3564 Is used as a startup file instead of \*(ur if set.
3565 When \*(UA scripts are invoked on behalf of other users,
3566 this variable should be set to
3567 .Pa /dev/null
3568 to avoid side-effects from reading their configuration files.
3569 .It Va NAILRC
3570 If this variable is set and
3571 .Va MAILRC
3572 is not, it is treated as a startup configuration file and read.
3573 .It Va NAIL_NO_SYSTEM_RC
3574 If this variable is set then reading of \*(UR at startup is inhibited,
3575 i.e., the same effect is achieved as if \*(UA had been started up with
3576 the option
3577 .Fl n .
3578 .It Va SYSV3
3579 Changes the letters printed in the first column of a header summary.
3580 .It Va TMPDIR
3581 Used as directory for temporary files instead of
3582 .Pa /tmp ,
3583 if set.
3584 .It Va USER
3585 Can be used to force identification as
3586 .Va USER ,
3587 i.e., identical to the
3588 .Fl u
3589 command line option.
3592 .\" --  >8  --  8<  --
3594 .Sh FILES
3595 .Bl -tag -width ".It Pa /etc/mime.types"
3596 .It Pa \*(ur
3597 File giving initial commands.
3598 .It Pa \*(UR
3599 System wide initialization file.
3600 .It Pa ~/.mime.types
3601 Personal MIME types.
3602 .It Pa /etc/mime.types
3603 System wide MIME types.
3606 .\" --  >8  --  8<  --
3608 .Sh EXAMPLES
3610 .\" --  >8  --  8<  --
3611 .Ss "Getting started"
3612 The \*(UA command has two distinct usages, according to whether one
3613 wants to send or receive mail.
3614 Sending mail is simple: to send a message to a user whose email address
3615 is, say, `<bill@host.example>', use the shell command:
3617 .Dl $ \*(ua bill@host.example
3619 then type your message.
3620 \*(UA will prompt you for a message `Subject:' first;
3621 after that, lines typed by you form the body of the message.
3622 When you reach the end of the message,
3623 type an EOT (`control\-D') at the beginning of a line,
3624 which will cause \*(UA to echo `EOT' and return you to the shell.
3626 If, while you are composing the message you decide that you do not wish
3627 to send it after all, you can abort the letter by typing two `RUBOUT'
3628 (interrupt) characters.
3629 Typing a single `RUBOUT' causes \*(UA to print
3630 .Ns ` Ns Li (Interrupt -- one more to kill letter) Ns '.
3631 Typing a second `RUBOUT' causes \*(UA to save your partial letter on the
3632 file
3633 .Va DEAD
3634 and abort the letter.
3635 Once you have sent mail to someone, there is no way to undo the act, so
3636 be careful.
3638 If you want to send the same message to several other people,
3639 you can list their email addresses on the command line.
3640 .Bd -literal -offset indent
3641 $ \*(ua sam@workstation.example bob@server.example
3642 Subject: Fees
3643 Tuition fees are due next Friday.  Don't forget!
3644 <control\-D>
3649 will sendout to `<sam@workstation.example>' and `<bob@server.example>'.
3650 To read your mail, simply type
3652 .Dl $ \*(ua
3654 \*(UA will respond by typing its version number and date and then
3655 listing the messages you have waiting.
3656 Then it will type a prompt and await your command.
3657 The messages are assigned numbers starting with 1 \(en you refer to the
3658 messages with these numbers.
3659 \*(UA keeps track of which messages are `new' (have been sent since you
3660 last read your mail) and `read' (have been read by you).
3661 New messages have an `N' next to them in the header listing and old,
3662 but unread messages have a `U' next to them.
3663 \*(UA keeps track of new/old and read/unread messages by putting a
3664 header field called `Status' into your messages.
3666 To look at a specific message, use the
3667 .Ic type
3668 command, which may be abbreviated to simply `t'.
3669 For example, if you had the following messages:
3670 .Bd -literal -offset indent
3671 O 1 drfoo@myhost.example Wed Sep  1 19:52   5/421 "Fees"
3672 O 2 sam@friends.example  Thu Sep  2 00:08  30/895
3675 you could examine the first message by giving the command:
3677 .Dl type 1
3679 which might cause \*(UA to respond with, for example:
3680 .Bd -literal -offset indent
3681 [-- Message  1 -- 5 lines, 421 bytes --]:
3682 From drfoo@myhost.example Wed Sep  1 19:52:25 2004
3683 Subject: Fees
3684 Status: R
3686 Tuition fees are due next Wednesday.  Don't forget!
3689 Many \*(UA commands that operate on messages take a message number as an
3690 argument, just as the shown
3691 .Ic type
3692 command.
3693 For these commands, there is a notion of a current message.
3694 When you enter the \*(UA program,
3695 the current message is initially the first (or the first recent) one.
3696 Thus, you can often omit the message number and use, for example, `t` to
3697 type the current message.
3698 As a further shorthand, you can type a message by simply giving its
3699 message number \(en hence `1` would type the first message.
3701 Frequently, it is useful to read the messages in your mailbox in order,
3702 one after another.
3703 You can read the next message in \*(UA by simply typing a newline.
3704 As a special case, you can type a newline as your first command to
3705 \*(UA to type the first message.
3707 If, after typing a message, you wish to immediately send a reply,
3708 you can do so with the command
3709 .Ic reply .
3710 This command, like
3711 .Ic type ,
3712 takes a message number as an argument.
3713 \*(UA then begins a message addressed to the user who sent you the
3714 message and let you type in your letter in reply, followed by
3715 a `<control-D>' at the beginning of a line, as before.
3717 Note that \*(UA copies the subject header from the original message.
3718 This is useful in that correspondence about a particular matter will
3719 tend to retain the same subject heading, making it easy to recognize.
3720 If there are other header fields in the message, like `Cc:',
3721 the information found will also be used.
3723 Sometimes you will receive a message that has been sent to several
3724 people and wish to reply only to the person who sent it.
3725 .Ic Reply
3726 (with a capital `R') replies to a message, but sends a copy to the
3727 sender only.
3729 If you wish, while reading your mail, to send a message to someone,
3730 but not as a reply to one of your messages, you can send the message
3731 directly with the
3732 .Ic mail
3733 command, which takes as arguments the names of the recipients you wish
3734 to send to.
3735 For example, to send a message to `<frank@machine.example>':
3737 .Dl mail frank@machine.example
3739 To delete a message from the mail folder, you can use the command
3740 .Ic delete .
3741 In addition to not saving deleted messages,
3742 \*(UA will not let you type them, either.
3743 The effect is to make the message disappear altogether, along with its
3744 number.
3746 Many features of \*(UA can be tailored to your liking with the
3747 .Ic set
3748 command; it has two forms, depending on whether you are setting
3749 a `binary' or a `valued' option.
3750 Binary options are either on or off \(en for example, the
3751 .Va askcc
3752 option informs \*(UA that each time you send a message, you want it to
3753 prompt you for a `Cc:' header to be included in the message.
3754 To set the
3755 .Va askcc
3756 option, you would type
3758 .Dl set askcc
3760 Valued options are values which \*(UA uses to adapt to your tastes.
3761 For example, the
3762 .Va record
3763 option tells \*(UA where to save messages sent by you,
3764 and is specified by, e.g.,
3766 .Dl set record=Sent
3768 Note that no spaces are allowed in `set record=Sent'.
3770 \*(UA includes a simple facility for maintaining groups of messages
3771 together in folders.
3772 To use the folder facility, you must tell \*(UA where you wish to keep
3773 your folders.
3774 Each folder of messages will be a single file.
3775 For convenience, all of your folders are kept in a single directory of
3776 your choosing.
3777 To tell \*(UA where your folder directory is, put a line of the form
3779 .Dl set folder=letters
3781 in your \*(ur file.
3782 If, as in the example above, your folder directory does not begin with
3783 a `/', \*(UA will assume that your folder directory is to be found
3784 starting from your home directory.
3786 Anywhere a file name is expected, you can use a folder name, preceded
3787 with `+'.
3788 For example, to put a message into a folder with the
3789 .Ic save
3790 command, you can use:
3792 .Dl save +classwork
3794 to save the current message in the `classwork' folder.
3795 If the `classwork' folder does not yet exist, it will be created.
3796 Note that messages which are saved with the
3797 .Ic save
3798 command are automatically removed from your system mailbox.
3800 In order to make a copy of a message in a folder without causing
3801 that message to be removed from your system mailbox, use the
3802 .Ic copy
3803 command, which is identical in all other respects to the
3804 .Ic save
3805 command.
3808 .Ic folder
3809 command
3810 can be used to direct \*(UA to the contents of a different folder.
3811 For example,
3813 .Dl folder +classwork
3815 directs \*(UA to read the contents of the `classwork' folder.
3816 All of the commands that you can use on your system mailbox are also
3817 applicable to folders, including
3818 .Ic type ,
3819 .Ic delete ,
3821 .Ic reply .
3822 To inquire which folder you are currently editing, use `folder' without
3823 arguments.
3824 And to list your current set of folders, use the
3825 .Ic folders
3826 command.
3828 Finally, the
3829 .Ic help
3830 command is available to print out a brief summary of the most important
3831 \*(UA commands.
3833 While typing in a message to be sent to others it is often useful to be
3834 able to invoke the text editor on the partial message, print the
3835 message, execute a shell command, or do some other auxiliary function.
3836 \*(UA provides these capabilities through `tilde escapes',
3837 which consist of a tilde (`~') at the beginning of a line, followed by
3838 a single character which indicates the function to be performed.
3839 For example, to print the text of the message so far, use:
3841 .Dl ~p
3843 which will print a line of dashes, the recipients of your message, and
3844 the text of the message so far.
3845 A list of the most important tilde escapes is available with `~?'.
3847 .\" --  >8  --  8<  --
3848 .Ss "IMAP or POP3 client setup"
3849 \*(OP First you need the following data from your ISP:
3850 the host name of the IMAP or POP3 server,
3851 user name and password for this server,
3852 and a notice whether the server uses SSL/TLS encryption.
3853 Assuming the SSL/TLS secured host name of your IMAP account is
3854 `server.myisp.example' and your user name for that server is `mylogin',
3855 you could refer to this account using the
3856 .Ic folder
3857 command or the
3858 .Fl f
3859 command line option with
3861 .Dl imaps://mylogin@server.myisp.example
3863 (This string is not necessarily the same as your Internet mail address.)
3864 Even if the server does not accept IMAPS or POP3S connections,
3865 it is possible that it supports the `STARTTLS' method of upgrading
3866 already connected, but not yet authenticated sessions to use SSL/TLS
3867 encryption.
3868 The only reliable method to see if this works is to try it; enter one of
3870 .Dl set imap-use-starttls
3871 .Dl set pop3-use-starttls
3873 before you initiate the connection, dependent on the actual protocol.
3875 As you probably want messages to be deleted from this account
3876 after saving them, prefix it with `%:'.
3878 .Ic shortcut
3879 command can be used to avoid typing that many characters every time you
3880 want to connect:
3882 .Dl shortcut myisp %:imaps://mylogin@server.myisp.example
3884 You might want to put this string into a startup file.
3885 .Ic shortcut
3886 is one of those commands that are specific to \*(UA and will thus
3887 confuse other implementations of POSIX
3888 .Xr mailx 1 ,
3889 so it should possibly not be placed in \*(ur.
3890 Instead, put
3892 .Dl set NAIL_EXTRA_RC=.\*(uarc
3894 in \*(ur and create a file
3895 .Pa ~/.\*(uarc
3896 containing all the commands that are specific to \*(UA.
3897 You can then access your remote mailbox by invoking
3899 .Dl \*(ua \-f myisp
3901 on the command line, or by executing
3903 .Dl fi myisp
3905 within \*(UA.
3906 If you want to use more than one IMAP mailbox on a server,
3907 or if you want to use the IMAP server for mail storage too, the
3908 .Ic account
3909 command (which is also \*(UA-specific) is possibly more appropriate.
3910 You can put the following in
3911 .Pa ~/.\*(uarc :
3912 .Bd -literal -offset indent
3913 account myisp {
3914    set folder=imaps://mylogin@server.myisp.example
3915    set record=+Sent MBOX=+mbox outfolder
3919 and can then access incoming mail for this account by invoking
3920 `\*(ua \-A myisp' on the command line or by executing `ac myisp' within
3921 \*(UA.
3922 After that, a command like `copy 1 +otherfolder' will refer to
3923 `otherfolder' on the IMAP server.
3924 In particular, `fi &' will change to the `mbox' folder,
3925 and `fi +Sent' will show your recorded sent mail,
3926 with both folders located on the IMAP server.
3928 \*(UA will ask you for a password string each time you connect to
3929 a remote account.
3930 If you can reasonably trust the security of your workstation,
3931 you can give this password in the startup file as
3933 .Dl set password-mylogin@server.myisp.example="SECRET"
3935 You should change the permissions of this file to 0600, see
3936 .Xr chmod 1 .
3938 \*(UA supports different authentication methods for both IMAP and POP3.
3939 If Kerberos is used at your location,
3940 you can try to activate (the optional) GSSAPI-based authentication via
3942 .Dl set imap-auth=gssapi
3944 The advantage of this method is that \*(UA doesn't need to know your
3945 password at all, nor does it have to send sensitive data over the network.
3946 If that isn't possible, try to use authentication methods that at least
3947 avoid sending the password in clear over the wire, which is especially
3948 important if SSL/TLS cannot be used, e.g.,
3950 .Dl set imap-auth=cram-md5
3952 For POP3 \*(UA will try to use the `APOP' mechanism automatically unless
3953 explicitly disabled.
3954 If the server does not offer any such authentication methods,
3955 conventional user/password based authentication must be used.
3956 It is sometimes helpful, especially when setting up an account or when
3957 there are authentification problems, to enable verbosity by setting the
3958 .Va verbose
3959 option \(en \*(UA will display all data sent to the server in clear text
3960 on the screen when this option is set.
3961 (Because this may also include passwords you should take care that no
3962 unauthorized person can look at your terminal when this option is set.)
3964 If you regularly use the same workstation to access IMAP accounts,
3965 you can greatly enhance performance by enabling local caching of IMAP
3966 messages.
3967 For any message that has been fully or partially fetched from the server,
3968 a local copy is made and is used when the message is accessed again,
3969 so most data is transferred over the network once only.
3970 To enable the IMAP cache, select a local directory name and put
3972 .Dl set imap-cache=~/localdirectory
3974 in the (\*(UA-specific) startup file.
3975 All files within that directory can be overwritten or deleted by \*(UA
3976 at any time,
3977 so you should not use the directory to store other information.
3979 Once the cache contains some messages,
3980 it is not strictly necessary anymore to open a connection to the IMAP
3981 server to access them.
3982 When \*(UA is invoked with the option
3983 .Fl D ,
3984 or when the
3985 .Va disconnected
3986 variable is set,
3987 only cached data is used for any folder you open.
3988 Messages that have not yet been completely cached are not available
3989 then, but all other messages can be handled as usual.
3990 Changes made to IMAP mailboxes in
3991 .Va disconnected
3992 mode are committed to the IMAP server next time it is used in
3993 .Va online
3994 mode.
3995 Synchronizing the local status with the status on the server is thus
3996 partially within your responsibility;
3997 if you forget to initiate a connection to the server again before you
3998 leave your location,
3999 changes made on one workstation are not available on others.
4000 Also if you alter IMAP mailboxes from a workstation while uncommitted
4001 changes are still pending on another,
4002 the latter data may become invalid.
4003 The same might also happen because of internal server status changes.
4004 You should thus carefully evaluate this feature in your environment
4005 before you rely on it.
4007 Many servers will close the connection after a short period of
4008 inactivity \(en use one of
4010 .Dl set pop3-keepalive=30
4011 .Dl set imap-keepalive=240
4013 to send a keepalive message each 30 seconds for POP3,
4014 or each 4 minutes for IMAP.
4016 If you encounter problems connecting to a SSL/TLS server,
4017 try the
4018 .Va ssl-rand-egd
4020 .Va ssl-rand-file
4021 variables (see the OpenSSL FAQ for more information) or specify the
4022 protocol version with
4023 .Va ssl-method .
4024 Contact your ISP if you need a client certificate or if verification of
4025 the server certificate fails.
4026 If the failed certificate is indeed valid,
4027 fetch its CA certificate by executing the shell command
4029 .Dl $ </dev/null openssl s_client \-showcerts \-connect \e
4030 .Dl \ \ \ \ \ \ server.myisp.example:imaps 2>&1 | tee log.txt
4032 (see
4033 .Xr s_client 1 Ns
4034 ) and put it into the file specified with
4035 .Va ssl-ca-file .
4036 The data you need is located at the end of the certificate chain
4037 within (and including) the `BEGIN CERTIFICATE'
4038 and `END CERTIFICATE' lines.
4039 Note that the example above is \fBinsecure\fR!
4040 One should use the `-verify' and `-CAfile' options of
4041 .Xr s_client 1
4042 to be "on the safe side" regarding the fetched certificates.
4044 .\" --  >8  --  8<  --
4045 .Ss "Reading HTML mail"
4046 You need either the
4047 .Xr elinks 1
4049 .Xr lynx 1
4050 utility or another command-line web browser that can write plain text to
4051 standard output.
4053 .Dl set pipe-text/html="elinks -force-html -dump 1"
4054 .Dl set pipe-text/html="lynx -stdin -dump -force_html"
4056 will cause HTML message parts to be converted into a more friendly form.
4058 .\" --  >8  --  8<  --
4059 .Ss "Viewing PDF attachments"
4060 Most PDF viewers do not accept input directly from a pipe.
4061 It is thus necessary to store the attachment in a temporary file first:
4063 .Dl set pipe-application/pdf="@&cat >/tmp/\*(ua$$.pdf; \e
4064 .Dl \ \ \ \ \ \ acroread /tmp/\*(ua$$.pdf; rm /tmp/\*(ua$$.pdf"
4066 Note that security defects are discovered in PDF viewers from time to
4067 time.
4068 Automatical command execution like this can compromise your system
4069 security,
4070 in particular if you stay not always informed about such issues.
4072 .\" --  >8  --  8<  --
4073 .Ss "Signed and encrypted messages with S/MIME"
4074 \*(OP S/MIME provides two central mechanisms:
4075 message signing and message encryption.
4076 A signed message contains some data in addition to the regular text.
4077 The data can be used to verify that the message was sent using a valid
4078 certificate, that the sender's address in the message header matches
4079 that in the certificate, and that the message text has not been altered.
4080 Signing a message does not change its regular text;
4081 it can be read regardless of whether the recipient's software is able to
4082 handle S/MIME.
4083 It is thus usually possible to sign all outgoing messages if so desired.
4084 Encryption, in contrast, makes the message text invisible for all people
4085 except those who have access to the secret decryption key.
4086 To encrypt a message, the specific recipient's public encryption key
4087 must be known.
4088 It is thus not possible to send encrypted mail to people unless their
4089 key has been retrieved from either previous communication or public key
4090 directories.
4091 A message should always be signed before it is encrypted.
4092 Otherwise, it is still possible that the encrypted message text is
4093 altered.
4095 A central concept to S/MIME is that of the certification authority (CA).
4096 A CA is a trusted institution that issues certificates.
4097 For each of these certificates it can be verified that it really
4098 originates from the CA, provided that the CA's own certificate is
4099 previously known.
4100 A set of CA certificates is usually delivered with OpenSSL and installed
4101 on your system.
4102 If you trust the source of your OpenSSL software installation,
4103 this offers reasonable security for S/MIME on the Internet.
4104 In general, a certificate cannot be more secure than the method its CA
4105 certificate has been retrieved with, though.
4106 Thus if you download a CA certificate from the Internet,
4107 you can only trust the messages you verify using that certificate as
4108 much as you trust the download process.
4110 The first thing you need for participating in S/MIME message exchange is
4111 your personal certificate, including a private key.
4112 The certificate contains public information, in particular your name and
4113 your email address, and the public key that is used by others to encrypt
4114 messages for you,
4115 and to verify signed messages they supposedly received from you.
4116 The certificate is included in each signed message you send.
4117 The private key must be kept secret.
4118 It is used to decrypt messages that were previously encrypted with your
4119 public key, and to sign messages.
4121 For personal use it is recommended that you get a S/MIME certificate
4122 from one of the major CAs on the Internet using your WWW browser.
4123 (Many CAs offer such certificates for free.)
4124 You will usually receive a combined certificate and private key in
4125 PKCS#12 format which \*(UA does not directly accept.
4126 To convert it to PEM format, use the following shell command:
4128 .Dl $ openssl pkcs12 \-in cert.p12 \-out cert.pem \-clcerts \-nodes
4130 If you omit the `\-nodes' parameter, you can specifiy an additional `PEM
4131 pass phrase' for protecting the private key.
4132 \*(UA will then ask you for that pass phrase each time it signs or
4133 decrypts a message.
4134 You can then use
4136 .Dl set smime-sign-cert-myname@myisp.example=cert.pem
4138 to make this private key and certificate known to \*(UA.
4139 You can now sign outgoing messages.
4140 Just use
4142 .Dl set smime-sign
4144 to do so.
4145 From each signed message you send,
4146 the recipient can fetch your certificate and use it to send encrypted
4147 mail back to you.
4148 Accordingly if somebody sends you a signed message, you can do the same.
4149 First use the
4150 .Ic verify
4151 command to check the validity of the certificate.
4152 After that, retrieve the certificate and tell \*(UA that it should use
4153 it for encryption:
4155 .Dl certsave filename
4156 .Dl set smime-encrypt-user@host=filename
4158 You should carefully consider if you prefer to store encrypted messages
4159 in decrypted form.
4160 If you do, anybody who has access to your mail folders can read them,
4161 but if you do not, you might be unable to read them yourself later if
4162 you happen to lose your private key.
4164 .Ic decrypt
4165 command saves messages in decrypted form, while the
4166 .Ic save ,
4167 .Ic copy ,
4169 .Ic move
4170 commands leave them encrypted.
4172 Note that neither S/MIME signing nor encryption applies to message
4173 subjects or other header fields.
4174 Thus they may not contain sensitive information for encrypted messages,
4175 and cannot be trusted even if the message content has been verified.
4176 When sending signed messages,
4177 it is recommended to repeat any important header information in the
4178 message text.
4180 .\" --  >8  --  8<  --
4181 .Ss "Using CRLs with S/MIME or SSL/TLS"
4182 \*(OP Certification authorities (CAs) issue certificate revocation
4183 lists (CRLs) on a regular basis.
4184 These lists contain the serial numbers of certificates that have been
4185 declared invalid after they have been issued.
4186 Such usually happens because the private key for the certificate has
4187 been compromised,
4188 because the owner of the certificate has left the organization that is
4189 mentioned in the certificate, etc.
4190 To seriously use S/MIME or SSL/TLS verification,
4191 an up-to-date CRL is required for each trusted CA.
4192 There is otherwise no method to distinguish between valid and
4193 invalidated certificates.
4194 \*(UA currently offers no mechanism to fetch CRLs, nor to access them on
4195 the Internet, so you have to retrieve them by some external mechanism.
4197 \*(UA accepts CRLs in PEM format only;
4198 CRLs in DER format must be converted, like, e.\|g.:
4200 .Dl $ openssl crl \-inform DER \-in crl.der \-out crl.pem
4202 To tell \*(UA about the CRLs, a directory that contains all CRL files
4203 (and no other files) must be created.
4205 .Va smime-crl-dir
4207 .Va ssl-crl-dir
4208 variables, respectively, must then be set to point to that directory.
4209 After that, \*(UA requires a CRL to be present for each CA that is used
4210 to verify a certificate.
4212 .\" --  >8  --  8<  --
4213 .Ss "Handling spam"
4214 \*(OP \*(UA can make use of spam detection and learning facilities \(en
4215 more precisely, SpamAssassin (\%<http://spamassassin.apache.org>).
4216 A very comprehensive documentation of
4217 .Xr spamassassin 1
4218 can be found at the O'Reilly Commons
4219 (\%<http://commons.oreilly.com/wiki/index.php/SpamAssassin>).
4221 Currently \*(UA supports interaction with
4222 .Xr spamassassin 1
4223 only via its daemonized
4224 .Xr spamd 1 /
4225 .Xr spamc 1
4226 server / client pair, which means that, in order to detect and work
4227 with spam through \*(UA, an instance of the
4228 .Xr spamd 1
4229 daemon must be running (the examples are equivalent):
4230 .Bd -literal -offset indent
4231 $ spamd -i localhost:2142 -i /tmp/.spamsock -d [-L] [-l]
4232 $ spamd --listen=localhost:2142 --listen=/tmp/.spamsock \\
4233     --daemonize [--local] [--allow-tell]
4236 Note that if
4237 .Xr spamd 1
4238 should only listen on a local, path-based UNIX domain socket instead of
4239 offering its service over the network, it maybe necessary to use
4240 a single
4241 .Li --socketpath
4242 option instead of the shown
4243 .Li --listen .
4244 In order to support training of the Bayesian classifier through \*(UA,
4245 .Xr spamd 1
4246 must have been started with the
4247 .Li --allow-tell
4248 option.
4250 Once
4251 .Xr spamd 1
4252 is running \*(UA can classify messages by using the client side program,
4253 .Xr spamc 1 ,
4254 as in:
4255 .Bd -literal -offset indent
4256 $ \*(ua -Sspam-command=/usr/local/bin/spamc \\
4257     -Sspam-socket=/tmp/.spamsock -Sspam-maxsize=500000
4260 The commands offered are
4261 .Ic spamclear
4263 .Ic spamset ,
4264 which simply set an `is-spam' flag that can be used for, e.g., message
4265 selection,
4266 .Ic spamrate ,
4267 which passes messages through to the spam detector in order to gain
4268 a spam score and conditionally set the `is-spam' flag accordingly,
4269 as well as the Bayesian filter related
4270 .Ic spamforget ,
4271 .Ic spamham
4273 .Ic spamspam .
4275 Because messages must exist on local storage in order to be scored (or
4276 used for Bayesian filter training), it is possibly a good idea to
4277 perform the local spam check last:
4278 .Bd -literal -offset indent
4279 define spamdelhook {
4280         # Server side DCC
4281         spamset (header x-dcc-brand-metrics "bulk")
4282         # Server-side spamassassin(1)
4283         spamset (header x-spam-flag "YES")
4284         del :s # TODO we HAVE to be able to do `spamrate :u ! :s'
4285         # And finally the local spamc(1)
4286         spamrate :u
4287         del :s
4289 set folder-hook-FOLDER=spamdelhook
4292 See also the documentation for the variables
4293 .Va spam-command ,
4294 .Va spam-host ,
4295 .Va spam-port ,
4296 .Va spam-socket ,
4297 .Va spam-user
4299 .Va spam-maxsize .
4301 .\" --  >8  --  8<  --
4302 .Ss "Sending mail from scripts"
4303 If you want to send mail from scripts, you must be aware that \*(UA
4304 reads the user's configuration files by default.
4305 So unless your script is only intended for your own personal use
4306 (as, e.g., a cron job), you need to circumvent this:
4308 .Dl MAILRC=/dev/null \*(ua \-n
4310 You then need to create a script-local configuration for \*(UA.
4311 This can be done by either pointing the
4312 .Va MAILRC
4313 variable to a custom configuration file,
4314 by passing the configuration in environment variables,
4315 or by using the
4316 .Fl S
4317 command line option to specify options.
4318 Since many configuration options are not valid shell variables, the
4319 .Xr env 1
4320 command is useful if the approach via environment variables is used:
4321 .Bd -literal -offset indent
4322 env MAILRC=/dev/null from=scriptreply@domain smtp=host \e
4323     smtp-auth-user=login smtp-auth-password=secret \e
4324     smtp-auth=login \*(ua \-n \-s "subject" \e
4325     \-a attachment_file recipient@domain < content_file
4328 .\" --  >8  --  8<  --
4330 .Sh "SEE ALSO"
4331 .Xr file 1 ,
4332 .Xr fmt 1 ,
4333 .Xr more 1 ,
4334 .Xr newaliases 1 ,
4335 .Xr openssl 1 ,
4336 .Xr printf 1 ,
4337 .Xr sendmail 1 ,
4338 .Xr sh 1,
4339 .Xr spamassassin 1 ,
4340 .Xr spamc 1 ,
4341 .Xr spamd 1 ,
4342 .Xr vacation 1 ,
4343 .Xr editline 3 ,
4344 .Xr iconv 3 ,
4345 .Xr readline 3 ,
4346 .Xr setlocale 3 ,
4347 .Xr ssl 3 ,
4348 .Xr aliases 5 ,
4349 .Xr locale 7 ,
4350 .Xr mailaddr 7 ,
4351 .Xr re_format 7 ,
4352 .Xr mailwrapper 8
4354 .\" --  >8  --  8<  --
4356 .Sh "IMPLEMENTATION NOTES"
4357 The character set conversion uses and relies upon the
4358 .Xr iconv 3
4359 function.
4360 Its functionality differs widely between the various system environments
4361 \*(UA runs on.
4363 Limitations with IMAP mailboxes are:
4364 It is not possible to edit messages, but it is possible to append them.
4365 Thus to edit a message, create a local copy of it, edit it, append it,
4366 and delete the original.
4367 The line count for the header display is only appropriate if the entire
4368 message has been downloaded from the server.
4369 The marking of messages as `new' is performed by the IMAP server;
4370 use of the
4371 .Ic exit
4372 command instead of
4373 .Ic quit
4374 will not cause it to be reset, and if the
4375 .Va autoinc Ns / Ns Va newmail
4376 variables are unset, messages that arrived during a session will not be
4377 in state `new' anymore when the folder is opened again.
4378 Also if commands queued in disconnected mode are committed,
4379 the IMAP server will delete the `new' flag for all messages in the
4380 changed folder,
4381 and new messages will appear as unread when it is selected for viewing
4382 later.
4383 The `flagged', `answered', and `draft' attributes are usually permanent,
4384 but some IMAP servers are known to drop them without notification.
4385 Message numbers may change with IMAP every time before the prompt is
4386 printed if \*(UA is notified by the server that messages have been
4387 deleted by some other client or process.
4388 In this case, `Expunged n messages' is printed, and message numbers may
4389 have changed.
4391 Limitations with POP3 mailboxes are:
4392 It is not possible to edit messages, they can only be copied and deleted.
4393 The line count for the header display is only appropriate if the entire
4394 message has been downloaded from the server.
4395 The status field of a message is maintained by the server between
4396 connections; some servers do not update it at all, and with a server
4397 that does, the `exit' command will not cause the message status to be
4398 reset.
4399 The `newmail' command and the `newmail' variable have no effect.
4400 It is not possible to rename or to remove POP3 mailboxes.
4402 If a `RUBOUT' (interrupt) is typed while an IMAP or POP3 operation is in
4403 progress, \*(UA will wait until the operation can be safely aborted, and
4404 will then return to the command loop and print the prompt again.
4405 When a second `RUBOUT' is typed while \*(UA is waiting for the operation
4406 to complete, the operation itself will be cancelled.
4407 In this case, data that has not been fetched yet will have to be fetched
4408 before the next command can be performed.
4409 If the cancelled operation was using an SSL/TLS encrypted channel,
4410 an error in the SSL transport will very likely result and render the
4411 connection unusable.
4413 As \*(UA is a mail user agent, it provides only basic SMTP services.
4414 If it fails to contact its upstream SMTP server, it will not make
4415 further attempts to transfer the message at a later time,
4416 and it does not leave other information about this condition than an
4417 error message on the terminal and an entry in
4418 .Va DEAD .
4419 This is usually not a problem if the SMTP server is located in the same
4420 local network as the computer on which \*(UA is run.
4421 However, care should be taken when using a remote server of an ISP;
4422 it might be better to set up a local SMTP server then which just acts as
4423 a proxy.
4425 \*(UA immediately contacts the SMTP server (or
4426 .Xr sendmail 1 Ns
4427 ) even when operating in
4428 .Va disconnected
4429 mode.
4430 It would not make much sense for \*(UA to defer outgoing mail since SMTP
4431 servers usually provide much more elaborated delay handling than \*(UA
4432 could perform as a client.
4433 Thus the recommended setup for sending mail in
4434 .Va disconnected
4435 mode is to configure a local SMTP server such that it sends outgoing
4436 mail as soon as an external network connection is available again,
4437 i.e., to advise it to do that from a network startup script.
4439 .\" --  >8  --  8<  --
4441 .Sh HISTORY
4442 A \fImail\fR command appeared in Version 1 AT&T Unix.
4443 Berkeley Mail was written in 1978 by Kurt Shoens.
4444 This man page is derived from from The Mail Reference Manual originally
4445 written by Kurt Shoens.
4446 "Heirloom Mailx" enhancements are maintained and documented by Gunnar
4447 Ritter.
4448 "S-nail" is maintained and documented by Steffen "Daode" Nurpmeso.
4450 Portions of this text are reprinted and reproduced in electronic form
4451 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
4452 \(en Operating System Interface (POSIX), The Open Group Base
4453 Specifications Issue 6, Copyright \(co 2001-2003 by the Institute of
4454 Electrical and Electronics Engineers, Inc and The Open Group.
4455 In the event of any discrepancy between this version and the original
4456 IEEE and The Open Group Standard, the original IEEE and The Open Group
4457 Standard is the referee document.
4458 The original Standard can be obtained online at
4459 \%<http://www.opengroup.org/unix/online.html>.
4460 Redistribution of this material is permitted so long as this notice
4461 remains intact.
4463 .\" --  >8  --  8<  --
4465 .Sh AUTHORS
4466 .An "Kurt Shoens" ,
4467 .An "Christos Zoulas" ,
4468 .An "Gunnar Ritter" ,
4469 .An Steffen Qo Daode Qc Nurpmeso Aq s-nail-users@lists.sourceforge.net
4471 .\" --  >8  --  8<  --
4473 .Sh BUGS
4474 Variables in the environment passed to \*(UA cannot be unset.