collect(): flags not value(), keep interactivity..
[s-mailx.git] / mailx.1
blob80acf291af6a677437b0fba01b0afe1a58dacf5a
1 '\" t
2 .\" Copyright (c) 1980, 1990, 1993
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\" Copyright (c) 2000
5 .\"     Gunnar Ritter.  All rights reserved.
6 .\" Copyright (c) 2012 Steffen "Daode" Nurpmeso.
7 .\" All rights reserved.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\"    must display the following acknowledgement:
19 .\"     This product includes software developed by the University of
20 .\"     California, Berkeley and its contributors.
21 .\"     This product includes software developed by Gunnar Ritter
22 .\"     and his contributors.
23 .\" 4. Neither the name of the University nor the names of its contributors
24 .\"    may be used to endorse or promote products derived from this software
25 .\"    without specific prior written permission.
26 .\"
27 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS '\fIAS IS\fR' AND
28 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .\" SUCH DAMAGE.
38 .\"
39 .\"     Sccsid: @(#)mailx.1     2.329 (gritter) 10/9/10
40 .\"
41 .TH S-NAIL 1 "2012-06-30" "S-nail; fork of Heirloom mailx 12.5" "User Commands"
42 .SH NAME
43 s-nail \- send and receive Internet mail
44 .SH SYNOPSIS
45 .PD 0
46 .HP
47 .ad l
48 \fBs-nail\fR [\fB\-BDdEFinOtv~\fR]
49 [\fB\-s\fI\ subject\fR] [\fB\-a\fI\ attachment\fR ]
50 [\fB\-c\fI\ cc-addr\fR] [\fB\-b\fI\ bcc-addr\fR] [\fB\-r\fI\ from-addr\fR]
51 [\fB\-h\fI\ hops\fR]
52 [\fB\-A\fI\ account\fR]
53 [\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]]
54 \fIto-addr\fR .\ .\ .
55 .HP
56 .ad l
57 \fBs-nail\fR [\fB\-BDdeEHiInNRv~\fR] [\fB\-T\fI\ name\fR]
58 [\fB\-A\fI\ account\fR]
59 [\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]]
60 \fB\-f\fR [\fIname\fR]
61 .HP
62 .ad l
63 \fBs-nail\fR [\fB\-BDdeEinNRv~\fR]
64 [\fB\-A\fI\ account\fR]
65 [\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]]
66 [\fB\-u\fI\ user\fR]
67 .br
68 .PD
69 .ad b
70 .SH DESCRIPTION
71 \fIS-nail\fR is an intelligent mail processing system, which has
72 a command syntax reminiscent of
73 .IR ed (1)
74 with lines replaced by messages.
75 It is based on Berkeley Mail 8.1,
76 is intended to provide the functionality of the POSIX
77 .B mailx
78 command,
79 and offers extensions
80 for MIME, IMAP, POP3, SMTP, and S/MIME.
81 .I S-nail
82 provides enhanced
83 features for interactive use, such as caching and disconnected
84 operation for IMAP, message threading, scoring, and filtering.
85 It is also usable as a mail batch language, both for sending
86 and receiving mail.
87 .PP
88 The following options are accepted:
89 .TP
90 .BI \-A \ name
91 Executes an 
92 .I account
93 command (see below)
94 for \fIname\fR after the startup files have been read.
95 .TP
96 .BI \-a \ file
97 Attach the given file to the message.
98 .TP
99 .B \-B
100 Make standard input and standard output line-buffered.
102 .BI \-b \ address
103 Send blind carbon copies to list.
104 List should be a comma-separated
105 list of names.
107 .BI \-c \ address
108 Send carbon copies to list of users.
110 .B \-D
111 Start in
112 .I disconnected
113 mode; see the description for the
114 .I disconnected
115 variable option.
117 .B \-d
118 Enables debugging messages and disables the actual delivery of messages.
119 Unlike
120 .IR \-v ,
121 this option is intended for
122 .I s-nail
123 development only.
125 .B \-e
126 Just check if mail is present in the system mailbox.
127 If yes, return an exit status of zero,
128 else, a non-zero value.
130 .B \-E
131 If an outgoing message does not contain any text
132 in its first or only message part,
133 do not send it but discard it silently,
134 effectively setting the
135 .I skipemptybody
136 variable at program startup.
137 This is useful for sending messages
138 from scripts started by
139 .IR cron (8).
141 \fB\-f\fR [\fIfile\fR]
142 Read in the contents of the user's mbox
143 (or the specified file)
144 for processing;
145 when
146 .I s-nail
147 is quit, it writes
148 undeleted messages back
149 to this file.
150 The string \fIfile\fR is handled
151 as described for the
152 .I folder
153 command below.
155 .B \-F
156 Save the message to send
157 in a file named after the local part
158 of the first recipient's address.
160 .B \-H
161 Print header summaries for all messages and exit.
163 \fB\-h\fI hops\fR
164 Invoke sendmail with the specified hop count.
165 This option has no effect when SMTP is used for sending mail.
167 .B \-i
168 Ignore tty interrupt signals.
169 This is
170 particularly useful when using
171 \fIs-nail\fR on noisy phone lines.
173 .B \-I
174 Shows the `Newsgroup:' or `Article-Id:' fields
175 in the header summary.
176 Only applicable in combination with
177 .IR \-f .
179 .B \-n
180 Inhibits reading /etc/s-nail.rc upon startup.
181 This option should be activated for
182 .I s-nail
183 scripts that are invoked on more than one machine,
184 because the contents of that file may differ between them.
186 .B \-N
187 Inhibits the initial display of message headers when reading mail
188 or editing a mail folder.
190 .BI \-O \ option
191 Pass the given option through to sendmail.
192 This option has no effect when SMTP is used for sending mail.
194 .BI \-q \ file
195 Start the message with the contents of the specified file.
196 May be given in send mode only.
198 .BI \-r \ address
199 Sets the
200 .I From
201 address. Overrides any
202 .I from
203 variable specified in environment or startup files.
204 Tilde escapes are disabled.
205 The \fI\-r\fI address\fR options are passed to the mail transfer agent
206 unless SMTP is used.
207 This option exists for compatibility only;
208 it is recommended to set the 
209 .I from
210 variable directly instead.
212 .B \-R
213 Opens any folders read-only.
215 .BI \-s \ subject
216 Specify subject on command line (only the first argument after the
217 .I \-s
218 flag is used as a subject; be careful to quote subjects
219 containing spaces).
221 \fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]
222 Sets the internal option
223 .I variable
224 and, in case of a string option,
225 assigns
226 .I value
227 to it.
228 These assignments take place after the resource files have been loaded.
230 .BI \-T \ name
231 Writes the `Message-Id:' and `Article-Id:' header fields
232 of each message read in the file
233 .IR name .
234 Implies
235 .IR \-I .
236 Compressed files are handled as described for the
237 .I folder
238 command below.
240 .B \-t
241 The message to be sent is expected to contain a message header
242 with `To:', `Cc:', or `Bcc:' fields giving its recipients
243 and `Subject:' giving the subject of the message.
244 Recipients and subject specified on the command line are ignored.
246 .BI \-u \ user
247 Reads the mailbox of the given user name.
249 .B \-v
250 Verbose mode.
251 The details of
252 delivery are displayed on the user's terminal.
254 .B \-V
255 Print \fIs-nail\fR's version and exit.
257 .B \-~
258 Enable tilde escapes even if not in interactive mode.
259 .SS "Sending mail"
260 To send a message to one or more people,
261 \fIs-nail\fR can be invoked with arguments
262 which are the names of people
263 to whom the mail will be sent.
264 The user is then expected to type in his message,
265 followed by an `control-D' at the beginning of a line.
266 The section below Replying to
267 or originating mail,
268 describes some features of \fIs-nail\fR
269 available to help when composing letters.
270 .SS "Reading mail"
271 In normal usage \fIs-nail\fR is given no arguments
272 and checks the user's mail out of the post office,
273 then prints out a one line header
274 of each message found.
275 The current message is initially
276 the first message (numbered 1)
277 and can be printed using the print command
278 which can be abbreviated `p').
279 The user can move among the messages
280 much as he moves between lines in
281 .IR ed (1),
282 with the commands `+' and `\-' moving backwards and forwards,
283 and simple numbers.
284 .SS "Disposing of mail"
285 After examining a message
286 the user can delete `d') the message
287 or reply `r') to it.
288 Deletion causes the \fIs-nail\fR program
289 to forget about the message.
290 This is not irreversible;
291 the message can be undeleted `u')
292 by giving its number,
293 or the \fIs-nail\fR session can be aborted
294 by giving the exit `x') command.
295 Deleted messages will, however,
296 usually disappear never to be seen again.
297 .SS "Specifying messages"
298 Commands such as print and delete
299 can be given a list of message numbers
300 as arguments to apply to a number of messages at once.
301 Thus `\fIdelete 1 2\fR' deletes messages 1 and 2,
302 while `\fIdelete 1-5\fR' deletes messages 1 through 5.
303 In sorted or threaded mode (see the
304 .I sort
306 .I thread
307 commands),
308 `\fIdelete 1-5\fR' deletes the messages
309 that are located between (and including) messages 1 through 5
310 in the sorted/threaded order,
311 as shown in the header summary.
312 The following special message names exist:
314 .B :n
315 All new messages.
317 .B :o
318 All old messages (any not in state read or new).
320 .B :u
321 All unread messages.
323 .B :d
324 All deleted messages (for the
325 .I undelete
326 command).
328 .B :r
329 All read messages.
331 .B :f
332 All `flagged' messages.
334 .B :a
335 All answered messages
336 (cf. the
337 .I markanswered
338 variable).
340 .B :t
341 All messages marked as draft.
343 .B :k
344 All `killed' messages.
346 .B :j
347 All messages classified as junk.
349 .B .
350 The current message.
352 .B ;
353 The message that was previously the current message.
355 .B ,
356 The parent message of the current message,
357 that is the message with the Message-ID
358 given in the `In-Reply-To:' field
359 or the last entry of the `References:' field
360 of the current message.
362 .B \-
363 The next previous undeleted message,
364 or the next previous deleted message for the
365 .I undelete
366 command.
367 In sorted/threaded mode,
368 the next previous such message in the sorted/threaded order.
370 .B +
371 The next undeleted message,
372 or the next deleted message for the
373 .I undelete
374 command.
375 In sorted/threaded mode,
376 the next such message in the sorted/threaded order.
378 .B ^
379 The first undeleted message,
380 or the first deleted message
381 for the
382 .I undelete
383 command.
384 In sorted/threaded mode,
385 the first such message in the sorted/threaded order.
387 .B $
388 The last message.
389 In sorted/threaded mode,
390 the last message in the sorted/threaded order.
392 .BI & x
393 In threaded mode,
394 selects the message addressed with
395 .IR x ,
396 where
397 .I x
398 is any other message specification,
399 and all messages from the thread that begins at it.
400 Otherwise, it is identical to
401 .IR x .
403 .I x
404 is omitted,
405 the thread beginning with the current message is selected.
407 .B *
408 All messages.
410 .B `
411 All messages that were included in the message list
412 for the previous command.
414 .BI / string
415 All messages that contain
416 .I string
417 in the subject field (case ignored).
418 See also the
419 .I searchheaders
420 variable.
422 .I string
423 is empty,
424 the string from the previous specification of that type is used again.
426 .I address
427 All messages from
428 .IR address .
429 By default, this is a case-sensitive search
430 for the complete email address.
431 If the
432 .I allnet
433 variable is set,
434 only the local part of the addresses is evaluated for the comparison.
435 Otherwise if the
436 .I showname
437 variable is set,
438 a case-sensitive search for the complete real name
439 of a sender is performed.
440 The IMAP-style
441 .BI (from\  address)
442 expression can be used instead
443 if substring matches are desired.
445 .BI ( criterion )
446 All messages that satisfy the given IMAP-style SEARCH
447 .IR criterion .
448 This addressing mode is available with all types of folders;
449 for folders not located on IMAP servers,
450 or for servers unable to execute the SEARCH command,
451 .I s-nail
452 will perform the search locally.
453 Strings must be enclosed by double quotes `"' in their entirety
454 if they contain white space or parentheses;
455 within the quotes,
456 only backslash `\e' is recognized as an escape character.
457 All string searches are case-insensitive.
458 When the description indicates
459 that the `envelope' representation of an address field is used,
460 this means that the search string is checked against
461 both a list constructed as
464 \fB("\fIreal name\fB" "\fIsource-route\fB" "\fIlocal-part\fB" "\fIdomain-part\fB")\fR
467 for each address,
468 and the addresses without real names
469 from the respective header field.
470 Criteria can be nested using parentheses.
472 \fB(\fIcriterion1 criterion2\fR .\|.\|. \fIcriterionN\fB)\fR
473 All messages that satisfy all of the given criteria.
475 .BI (or " criterion1 criterion2" )
476 All messages that satisfy either
477 .I criterion1
479 .IR criterion2 ,
480 or both.
481 To connect more than two criteria using `or',
482 (or) specifications have to be nested using additional parentheses,
483 as with `(or\ a\ (or\ b\ c))';
484 `(or\ a\ b\ c)' means ((a or b) and c).
485 For a simple `or' operation of independent criteria
486 on the lowest nesting level,
487 it is possible to achieve similar effects by using
488 three separate criteria, as with
489 `(a)\ (b)\ (c)'.
491 .BI (not " criterion" )
492 All messages that do not satisfy
493 .IR criterion .
495 .BI (bcc " string" )
496 All messages that contain
497 .I string
498 in the `envelope' representation of the
499 .I Bcc:
500 field.
502 .BI (cc " string" )
503 All messages that contain
504 .I string
505 in the `envelope' representation of the
506 .I Cc:
507 field.
509 .BI (from " string" )
510 All messages that contain
511 .I string
512 in the `envelope' representation of the
513 .I From:
514 field.
516 .BI (subject " string" )
517 All messages that contain
518 .I string
519 in the
520 .I Subject:
521 field.
523 .BI (to " string" )
524 All messages that contain
525 .I string
526 in the `envelope' representation of the
527 .I To:
528 field.
530 .BI (header " name string" )
531 All messages that contain
532 .I string
533 in the specified
534 .I Name:
535 field.
537 .BI (body " string" )
538 All messages that contain
539 .I string
540 in their body.
542 .BI (text " string" )
543 All messages that contain
544 .I string
545 in their header or body.
547 .BI (larger " size" )
548 All messages that are larger than
549 .I size
550 (in bytes).
552 .BI (smaller " size" )
553 All messages that are smaller than
554 .I size
555 (in bytes).
557 .BI (before " date" )
558 All messages that were received before
559 .IR date ;
560 .I date
561 must be in the form
562 \fId\fR[\fId\fR]\fB-\fImon\fB-\fIyyyy\fR,
563 where \fId\fR[\fId\fR] is the day of the month
564 as one or two digits,
565 .I mon
566 is the name of the month\(emone of
567 `Jan', `Feb', `Mar',
568 `Apr', `May', `Jun',
569 `Jul', `Aug', `Sep',
570 `Oct', `Nov', or `Dec',
572 .I yyyy
573 is the year as four digits;
574 e.\|g. "30-Aug-2004".
576 .BI (on " date" )
577 All messages that were received on the specified date.
579 .BI (since " date" )
580 All messages that were received since the specified date.
582 .BI (sentbefore " date" )
583 All messages that were sent on the specified date.
585 .BI (senton " date" )
586 All messages that were sent on the specified date.
588 .BI (sentsince " date" )
589 All messages that were sent since the specified date.
591 .B ()
592 The same criterion as for the previous search.
593 This specification cannot be used as part of another criterion.
594 If the previous command line contained more than one independent criterion,
595 the last of those criteria is used.
597 A practical method to read a set of messages
598 is to issue a
599 .I from
600 command with the search criteria first
601 to check for appropriate messages,
602 and to read each single message then by typing `\fB`\fR' repeatedly.
603 .SS "Replying to or originating mail"
605 .I reply
606 command can be used
607 to set up a response to a message,
608 sending it back to the person who it was from.
609 Text the user types in then,
610 up to an end-of-file,
611 defines the contents of the message.
612 While the user is composing a message,
613 \fIs-nail\fR treats lines beginning with the character `~' specially.
614 For instance, typing `~m' (alone on a line)
615 will place a copy of the current message into the response
616 right shifting it by a tabstop
617 (see
618 .I indentprefix
619 variable, below).
620 Other escapes will set up subject fields,
621 add and delete recipients to the message,
622 attach files to it
623 and allow the user to escape to an editor
624 to revise the message
625 or to a shell to run some commands.
626 (These options are given in the summary below.)
627 .SS "Ending a mail processing session"
628 The user can end a \fIs-nail\fR session
629 with the quit (`q') command.
630 Messages which have been examined
631 go to the user's mbox file
632 unless they have been deleted
633 in which case they are discarded.
634 Unexamined messages go back
635 to the post office.
636 (See the \-f option above).
637 .SS "Personal and systemwide distribution lists"
638 It is also possible to create
639 a personal distribution lists so that,
640 for instance, the user can send mail
641 to `\fIcohorts\fR' and have it go
642 to a group of people.
643 Such lists can be defined by placing a line like
646         \fBalias\fI cohorts bill ozalp jkf mark kridle@ucbcory\fR
649 in the file .mailrc in the user's home directory.
650 The current list of such aliases
651 can be displayed with the alias command in \fIs-nail\fR.
652 System wide distribution lists can be created
653 by editing /etc/aliases, see
654 .IR aliases (5)
656 .IR sendmail (8);
657 these are kept in a different syntax.
658 In mail the user sends,
659 personal aliases will be expanded
660 in mail sent to others so that
661 they will be able to reply to the recipients.
662 System wide aliases are not expanded when the mail is sent,
663 but any reply returned to the machine
664 will have the system wide alias expanded
665 as all mail goes through sendmail.
666 .SS "Recipient address specifications"
667 When an address is used to name a recipient
668 (in any of To, Cc, or Bcc),
669 names of local mail folders
670 and pipes to external commands
671 can also be specified;
672 the message text is then written to them.
673 The rules are: Any name which starts with a
674 .RB ` | '
675 character specifies a pipe,
676 the command string following the `|'
677 is executed and the message is sent to its standard input;
678 any other name which contains a
679 .RB ` @ '
680 character is treated as a mail address;
681 any other name which starts with a
682 .RB ` + '
683 character specifies a folder name;
684 any other name which contains a
685 .RB ` / '
686 character
687 but no
688 .RB ` ! '
690 .RB ` % '
691 character before also specifies a folder name;
692 what remains is treated as a mail address.
693 Compressed folders are handled as described for the
694 .I folder
695 command below.
696 .SS "Network mail (Internet / ARPA, UUCP, Berknet)"
698 .IR mailaddr (7)
699 for a description of network addresses.
700 \fIS-nail\fR has a number of options
701 which can be set in the .mailrc file
702 to alter its behavior;
703 thus `\fIset askcc\fR' enables the askcc feature.
704 (These options are summarized below).
705 .SS "MIME types"
706 For any outgoing attachment,
707 \fIs-nail\fR tries to determine the content type.
708 It does this by reading MIME type files
709 whose lines have the following syntax:
712         \fItype\fB/\fIsubtype      extension \fR[\fIextension \fR.\ .\ .]\fR
715 where type/subtype are strings describing the file contents,
716 and extension is the part of a filename starting after the last dot.
717 Any line not immediately beginning with an ASCII alphabetical character is
718 ignored by \fIs-nail\fR.
719 If there is a match with the extension of the file to attach,
720 the given type/subtype pair is used.
721 Otherwise, or if the filename has no extension,
722 the content types text/plain or application/octet-stream are used,
723 the first for text or international text files,
724 the second for any file that contains formatting characters
725 other than newlines and horizontal tabulators.
726 .SS "Character sets"
727 .I S-nail
728 normally detects the character set of the terminal
729 using the LC_CTYPE locale setting.
730 If the locale cannot be used appropriately,
731 the \fIttycharset\fR variable should be set
732 to provide an explicit value.
733 When reading messages,
734 their text is converted to the terminal character set if possible.
735 Unprintable characters and illegal byte sequences are detected
736 and replaced by Unicode substitute characters or question marks
737 unless the
738 .I print-all-chars
739 is set at initialization time.
741 The character set for outgoing messages
742 is not necessarily the same
743 as the one used on the terminal.
744 If an outgoing text message
745 contains characters not representable in US-ASCII,
746 the character set being used
747 must be declared within its header.
748 Permissible values can be declared
749 using the \fIsendcharsets\fR variable,
750 separated by commas;
751 .I s-nail
752 tries each of the values in order
753 and uses the first appropriate one.
754 If the message contains characters that cannot be represented
755 in any of the given character sets,
756 the message will not be sent,
757 and its text will be saved to the `dead.letter' file.
758 Messages that contain NUL bytes are not converted.
760 Outgoing attachments are converted if they are plain text.
761 If the
762 .I sendcharsets
763 variable contains more than one character set name,
765 .I ~@
766 tilde escape will ask for the character sets for individual attachments
767 if it is invoked without arguments.
769 Best results are usually achieved
770 when
771 .I s-nail
772 is run in a UTF-8 locale
773 on a UTF-8 capable terminal.
774 In this setup,
775 characters from various countries can be displayed,
776 while it is still possible to use more simple
777 character sets for sending
778 to retain maximum compatibility with older mail clients.
779 .SS "Commands"
780 Each command is typed on a line by itself,
781 and may take arguments following the command word.
782 The command need not be typed in its entirety \(en
783 the first command which matches the typed prefix is used.
784 For commands which take message lists as arguments,
785 if no message list is given,
786 then the next message forward which satisfies
787 the command's requirements is used.
788 If there are no messages forward of the current message,
789 the search proceeds backwards,
790 and if there are no good messages at all,
791 \fIs-nail\fR types `\fIapplicable messages\fR' and aborts the command.
792 If the command begins with a \fI#\fR sign,
793 the line is ignored.
795 The arguments to commands can be quoted, using the following methods:
796 .IP \(bu
797 An argument can be enclosed between paired double-quotes
798 "\|" or single-quotes '\|'; any white space, shell
799 word expansion, or backslash characters within the quotes
800 are treated literally as part of the argument.
801 A double-quote will be treated literally within
802 single-quotes and vice versa. These special properties of
803 the quote marks occur only when they are paired at the
804 beginning and end of the argument.
805 .IP \(bu
806 A backslash outside of the enclosing quotes is discarded
807 and the following character is treated literally as part of
808 the argument.
809 .IP \(bu
810 An unquoted backslash at the end of a command line is
811 discarded and the next line continues the command.
813 Filenames, where expected, are subjected to the following
814 transformations, in sequence:
815 .IP \(bu
816 If the filename begins with an unquoted plus sign, and
818 .I folder
819 variable is defined,
820 the plus sign will be replaced by the value of the
821 .I folder
822 variable followed by a slash. If the
823 .I folder
824 variable is
825 unset or is set to null, the filename will be unchanged.
826 .IP \(bu
827 Shell word expansions are applied to the filename.
828 If more than a single pathname results
829 from this expansion and the command is expecting one
830 file, an error results.
832 The following commands are provided:
834 .B \-
835 Print out the preceding message.
836 If given a numeric argument n,
837 goes to the n'th previous message and prints it.
839 .B ?
840 Prints a brief summary of commands.
842 .B !
843 Executes the shell (see
844 .IR sh (1)
846 .IR csh (1))
847 command which follows.
849 .B |
850 A synonym for the \fIpipe\fR command.
852 .B account
853 (ac) Creates, selects or lists
854 an email account.
855 An account is formed by a group of commands,
856 primarily of those to set variables.
857 With two arguments,
858 of which the second is a `{',
859 the first argument gives an account name,
860 and the following lines create a group of commands for that account
861 until a line containing a single `}' appears.
862 With one argument,
863 the previously created group of commands
864 for the account name is executed,
865 and a
866 .I folder
867 command is executed for the system mailbox or inbox
868 of that account.
869 Without arguments,
870 the list of accounts and their contents are printed.
871 As an example,
874     \fBaccount\fI myisp\fR \fB{\fR
875         set folder=imaps://mylogin@imap.myisp.example
876         set record=+Sent
877         set from="myname@myisp.example (My Name)"
878         set smtp=smtp.myisp.example
879     \fB}\fR
882 creates an account named `myisp'
883 which can later be selected by specifying `account myisp'.
885 .B alias
886 (a) With no arguments,
887 prints out all currently-defined aliases.
888 With one argument, prints out that alias.
889 With more than one argument,
890 creates a new alias or changes an old one.
892 .B alternates
893 (alt) The alternates command is useful
894 if the user has accounts on several machines.
895 It can be used to inform \fIs-nail\fR
896 that the listed addresses all belong to the invoking user.
897 When he replies to messages,
898 \fIs-nail\fR will not send a copy of the message
899 to any of the addresses
900 listed on the alternates list.
901 If the alternates command is given
902 with no argument,
903 the current set of alternate names is displayed.
905 .B answered
906 (ans) Takes a message list and marks each message
907 as a having been answered.
908 This mark has no technical meaning in the mail system;
909 it just causes messages to be marked in the header summary,
910 and makes them specially addressable.
912 .B cache
913 Only applicable to cached IMAP mailboxes;
914 takes a message list and reads the specified messages
915 into the IMAP cache.
917 .B call
918 Calls a macro (see the
919 .I define
920 command).
922 .B cd
923 Same as chdir.
925 .B certsave
926 Only applicable to S/MIME signed messages.
927 Takes a message list and a file name
928 and saves the certificates contained within the message signatures
929 to the named file in both human-readable and PEM format.
930 The certificates can later be used to send encrypted messages
931 to the messages' originators by setting the
932 .I smime-encrypt-user@host
933 variable.
935 .B chdir
936 (ch) Changes the user's working directory to that specified,
937 if given.
938 If no directory is given,
939 then changes to the user's login directory.
941 .B classify
942 (cl) Takes a list of messages and
943 examines their contents for characteristics of junk mail
944 using Bayesian filtering.
945 Messages considered to be junk are then marked as such.
946 The junk mail database is not changed.
948 .B collapse
949 (coll)
950 Only applicable to threaded mode.
951 Takes a message list
952 and makes all replies to these messages invisible
953 in header summaries,
954 unless they are in state `new'.
956 .B connect
957 (conn) If operating in disconnected mode on an IMAP mailbox,
958 switch to online mode and connect to the mail server
959 while retaining the mailbox status.
960 See the description of the
961 .I disconnected
962 variable for more information.
964 .B copy
965 (c) The copy command does the same thing that
966 .I save
967 does,
968 except that it does not mark the messages
969 it is used on for deletion when the user quits.
970 Compressed files and IMAP mailboxes are handled as described for the
971 .I folder
972 command.
974 .B Copy
975 (C) Similar to
976 .IR copy ,
977 but saves the messages in a file named after the local part
978 of the sender address of the first message.
980 .B decrypt
981 (dec) For unencrypted messages,
982 this command is identical to
983 .IR copy .
984 Encrypted messages are first decrypted, if possible,
985 and then copied.
987 .B Decrypt
988 (Dec) Similar to
989 .IR decrypt ,
990 but saves the messages in a file named after the local part
991 of the sender address of the first message.
993 .B define
994 (def) Defines a macro.
995 A macro definition is a sequence of commands in the following form:
998     \fBdefine\fR \fIname\fB {\fR
999         \fIcommand1\fR
1000         \fIcommand2\fR
1001         .\|.\|.
1002         \fIcommandN\fR
1003     \fB}\fR
1006 Once defined, a macro can be explicitly invoked using the
1007 .I call
1008 command,
1009 or can be implicitly invoked by setting the
1010 .I folder-hook
1012 .I folder-hook-fullname
1013 variables.
1015 .B defines
1016 Prints the currently defined macros including their contents.
1018 .B delete
1019 (d) Takes a list of messages as argument
1020 and marks them all as deleted.
1021 Deleted messages will not be saved in mbox,
1022 nor will they be available for most other commands.
1024 .B discard
1025 Same as ignore.
1027 .B disconnect
1028 (disco) If operating in online mode on an IMAP mailbox,
1029 switch to disconnected mode while retaining the mailbox status.
1030 See the description of the
1031 .I disconnected
1032 variable for more information.
1033 A list of messages may optionally be given as argument;
1034 the respective messages are then read into the cache
1035 before the connection is closed.
1036 Thus `disco *' makes the entire current mailbox
1037 available for disconnected use.
1039 .BR dp \ or \ dt
1040 Deletes the current message
1041 and prints the next message.
1042 If there is no next message,
1043 \fIs-nail\fR says `\fIat EOF\fR'.
1045 .B draft
1046 Takes a message list and marks each message
1047 as a draft.
1048 This mark has no technical meaning in the mail system;
1049 it just causes messages to be marked in the header summary,
1050 and makes them specially addressable.
1052 .B echo
1053 Echoes its arguments,
1054 resolving special names
1055 as documented for the folder command.
1056 The escape sequences
1057 `\fB\ea\fR',
1058 `\fB\eb\fR',
1059 `\fB\ec\fR',
1060 `\fB\ef\fR',
1061 `\fB\en\fR',
1062 `\fB\er\fR',
1063 `\fB\et\fR',
1064 `\fB\ev\fR',
1065 `\fB\e\e\fR', and
1066 `\fB\e0\fInum\fR'
1067 are interpreted
1068 as with the
1069 .IR echo (1)
1070 command.
1072 .B edit
1073 (e) Takes a list of messages
1074 and points the text editor
1075 at each one in turn.
1076 Modified contents are discarded
1077 unless the
1078 .I writebackedited
1079 variable is set.
1081 .B else
1082 Marks the end of the then-part
1083 of an if statement
1084 and the beginning of the part
1085 to take effect if the condition
1086 of the if statement is false.
1088 .B endif
1089 Marks the end of an if statement.
1091 .B exit
1092 (ex or x) Effects an immediate return to the Shell
1093 without modifying the user's system mailbox,
1094 his mbox file,
1095 or his edit file in \-f.
1097 .B file
1098 (fi) The same as folder.
1100 .B flag
1101 (fl) Takes a message list
1102 and marks the messages as `flagged' for urgent/special attention.
1103 This mark has no technical meaning in the mail system;
1104 it just causes messages to be highlighted in the header summary,
1105 and makes them specially addressable.
1107 .B folders
1108 With no arguments,
1109 list the names of the folders in the folder directory.
1110 With an existing folder as an argument,
1111 lists then names of folders below the named folder;
1112 e.\|g. the command `folders @'
1113 lists the folders on the base level of the current IMAP server.
1114 See also the
1115 .I imap-list-depth
1116 variable.
1118 .B folder
1119 (fold) The folder command switches
1120 to a new mail file or folder.
1121 With no arguments, it tells the user
1122 which file he is currently reading.
1123 If an argument is given,
1124 it will write out changes
1125 (such as deletions) the user has made
1126 in the current file and read in
1127 the new file.
1128 Some special conventions are recognized for the name.
1129 \fB#\fR means the previous file,
1130 \fB%\fR means the invoking user's system mailbox,
1131 \fB%\fIuser\fR means \fIuser's\fR system mailbox,
1132 \fB&\fR means the invoking user's mbox file,
1133 and \fB+\fIfile\fI means a \fIfile\fR in the folder directory.
1134 \fB%:\fIfilespec\fR expands to the same value as \fIfilespec\fR,
1135 but the file is handled as a system mailbox
1136 e.\ g. by the mbox and save commands.
1137 If the name matches one of the strings defined with the
1138 .I shortcut
1139 command,
1140 it is replaced by its long form and expanded.
1141 If the name ends with \fB.gz\fR or \fB.bz2\fR,
1142 it is treated as compressed with
1143 .IR gzip (1)
1145 .IR bzip2 (1),
1146 respectively.
1147 Likewise, if \fIname\fR does not exist,
1148 but either \fIname\fB.gz\fR or \fIname\fB.bz2\fR exists,
1149 the compressed file is used.
1150 If \fIname\fR refers to a directory
1151 with the subdirectories `tmp', `new', and `cur',
1152 it is treated as a folder in
1153 .I maildir
1154 format.
1155 A name of the form
1158        \fIprotocol\fB://\fR[\fIuser\fB@\fR]\fIhost\fR[\fB:\fIport\fR][\fB/\fIfile\fR]
1161 is taken as an Internet mailbox specification.
1162 The supported protocols are currently
1163 .B imap
1164 (IMAP v4r1),
1165 .B imaps
1166 (IMAP with SSL/TLS encryption),
1167 .B pop3
1168 (POP3),
1170 .B pop3s
1171 (POP3 with SSL/TLS encryption).
1173 .I user
1174 contains special characters, in particular `/' or `%',
1175 they must be escaped in URL notation,
1176 as `%2F' or `%25'.
1177 The optional
1178 .I file
1179 part applies to IMAP only;
1180 if it is omitted,
1181 the default `INBOX' is used.
1182 If \fIs-nail\fR is connected to an IMAP server,
1183 a name of the form \fB@\fImailbox\fR
1184 refers to the \fImailbox\fR on that server.
1185 If the `folder' variable refers to an IMAP account,
1186 the special name `%' selects the `INBOX' on that account.
1188 .B Followup
1189 (F) Similar to
1190 .IR Respond ,
1191 but saves the message in a file
1192 named after the local part of the first recipient's address.
1194 .B followup
1195 (fo) Similar to
1196 .IR respond ,
1197 but saves the message in a file
1198 named after the local part of the first recipient's address.
1200 .B followupall
1201 Similar to
1202 .IR followup ,
1203 but responds to all recipients regardless of the
1204 .I flipr
1206 .I Replyall
1207 variables.
1209 .B followupsender
1210 Similar to
1211 .IR Followup ,
1212 but responds to the sender only regardless of the
1213 .I flipr
1215 .I Replyall
1216 variables.
1218 .B forward
1219 (fwd)
1220 Takes a message and the address of a recipient
1221 and forwards the message to him.
1222 The text of the original message is included in the new one,
1223 with the value of the
1224 .I fwdheading
1225 variable printed before.
1227 .I fwdignore
1229 .I fwdretain
1230 commands specify which header fields are included in the new message.
1231 Only the first part of a multipart message is included unless the
1232 .I forward-as-attachment
1233 option is set.
1235 .B Forward
1236 (Fwd)
1237 Similar to
1238 .IR forward ,
1239 but saves the message in a file named after
1240 the local part of the recipient's address.
1242 .B from
1243 (f) Takes a list of messages
1244 and prints their message headers,
1245 piped through the pager if the output does not fit on the screen.
1247 .B fwdignore
1248 Specifies which header fields are to be ignored with the
1249 .I forward
1250 command.
1251 This command has no effect when the
1252 .I forward-as-attachment
1253 option is set.
1255 .B fwdretain
1256 Specifies which header fields are to be retained with the
1257 .I forward
1258 command.
1259 .I fwdretain
1260 overrides
1261 .IR fwdignore .
1262 This command has no effect when the
1263 .I forward-as-attachment
1264 option is set.
1266 .B good
1267 (go) Takes a list of messages
1268 and marks all of them as not being junk mail.
1269 Data from these messages is then inserted
1270 into the junk mail database for future classification.
1272 .B headers
1273 (h) Lists the current range of headers,
1274 which is an 18-message group.
1275 If a `+' argument is given,
1276 then the next 18-message group is printed,
1277 and if a `\-' argument is given,
1278 the previous 18-message group is printed.
1280 .B help
1281 A synonym for ?.
1283 .B hold
1284 (ho, also preserve) Takes a message list
1285 and marks each message therein to be saved
1286 in the user's system mailbox
1287 instead of in mbox.
1288 Does not override the delete command.
1289 .I S-nail
1290 deviates from the POSIX standard with this command,
1291 as a `next' command issued after `hold'
1292 will display the following message,
1293 not the current one.
1295 .B if
1296 Commands in \fIs-nail\fR's startup files
1297 can be executed conditionally
1298 depending on whether the user is sending
1299 or receiving mail with the if command.
1300 For example:
1303         \fBif \fIreceive\fR
1304                 \fIcommands .\ .\ .\fR
1305         \fBendif\fR
1308 An else form is also available:
1311         \fBif \fIreceive\fR
1312                 \fIcommands .\ .\ .\fR
1313         \fBelse\fR
1314                 \fIcommands .\ .\ .\fR
1315         \fBendif\fR
1318 Note that the only allowed conditions are
1319 .BR receive ,
1320 .BR send ,
1322 .B term
1323 (execute command if standard input is a tty).
1325 .B ignore
1326 Add the list of header fields named to the ignored list.
1327 Header fields in the ignore list are not printed
1328 on the terminal when a message is printed.
1329 This command is very handy for suppression
1330 of certain machine-generated header fields.
1331 The Type and Print commands can be used
1332 to print a message in its entirety,
1333 including ignored fields.
1334 If ignore is executed with no arguments,
1335 it lists the current set of ignored fields.
1337 .B imap
1338 Sends command strings directly to the current IMAP server.
1339 \fIS-nail\fR operates always in IMAP \fIselected state\fR
1340 on the current mailbox;
1341 commands that change this
1342 will produce undesirable results
1343 and should be avoided.
1344 Useful IMAP commands are:
1347 .B create
1348 Takes the name of an IMAP mailbox as an argument
1349 and creates it.
1351 .B getquotaroot
1352 .\" RFC 2087
1353 Takes the name of an IMAP mailbox as an argument
1354 and prints the quotas that apply to the mailbox.
1355 Not all IMAP servers support this command.
1357 .B namespace
1358 .\" RFC 2342
1359 Takes no arguments and prints the Personal Namespaces,
1360 the Other User's Namespaces,
1361 and the Shared Namespaces.
1362 Each namespace type is printed in parentheses;
1363 if there are multiple namespaces of the same type,
1364 inner parentheses separate them.
1365 For each namespace,
1366 a namespace prefix and a hierarchy separator is listed.
1367 Not all IMAP servers support this command.
1370 .B inc
1371 Same as
1372 .IR newmail .
1374 .B junk
1375 (j) Takes a list of messages
1376 and marks all of them as junk mail.
1377 Data from these messages is then inserted
1378 into the junk mail database for future classification.
1380 .B kill
1381 (k) Takes a list of messages and `kills' them.
1382 Killed messages are not printed in header summaries,
1383 and are ignored by the
1384 .I next
1385 command.
1387 .I kill
1388 command also sets the score of the messages to negative infinity,
1389 so that subsequent
1390 .I score
1391 commands will not unkill them again.
1392 Killing is only effective for the current session on a folder;
1393 when it is quit, all messages are automatically unkilled.
1395 .B list
1396 Prints the names of all available commands.
1398 .B Mail
1399 (M) Similar to
1400 .IR mail ,
1401 but saves the message in a file
1402 named after the local part of the first recipient's address.
1404 .B mail
1405 (m) Takes as argument login names
1406 and distribution group names
1407 and sends mail to those people.
1409 .B mbox
1410 Indicate that a list of messages be sent
1411 to mbox in the user's home directory when
1412 .I s-nail
1413 is quit.
1414 This is the default action for messages
1415 if unless the
1416 .I hold
1417 option is set.
1418 .I S-nail
1419 deviates from the POSIX standard with this command,
1420 as a `next' command issued after `mbox'
1421 will display the following message,
1422 not the current one.
1424 .B move
1425 (mv) Acts like
1426 .IR copy ,
1427 but marks the messages for deletion
1428 if they were transferred successfully.
1430 .B Move
1431 (Mv) Similar to
1432 .IR move ,
1433 but moves the messages to a file named after the local part
1434 of the sender address of the first message.
1436 .B newmail
1437 Checks for new mail in the current folder
1438 without committing any changes before.
1439 If new mail is present, a message is printed.
1440 If the
1441 .I header
1442 variable is set,
1443 the headers of each new message are also printed.
1445 .B next
1446 (n) like + or CR) Goes to the next message
1447 in sequence and types it.
1448 With an argument list, types the next matching message.
1450 .B New
1451 Same as
1452 .IR unread .
1454 .B new
1455 Same as
1456 .IR unread .
1458 .B online
1459 Same as
1460 .IR connect .
1462 .B noop
1463 If the current folder is located on an IMAP or POP3 server,
1464 a NOOP command is sent.
1465 Otherwise, no operation is performed.
1467 .B Pipe
1468 (Pi) Like
1469 .I pipe
1470 but also
1471 pipes ignored header fields
1472 and all parts of MIME
1473 .I multipart/alternative
1474 messages.
1476 .B pipe
1477 (pi) Takes a message list and a shell command
1478 and pipes the messages through the command.
1479 Without an argument,
1480 the current message is piped
1481 through the command given by the \fIcmd\fR variable.
1482 If the \fI page\fR variable is set,
1483 every message is followed by a formfeed character.
1485 .B preserve
1486 (pre) A synonym for
1487 .IR hold .
1489 .B Print
1490 (P) Like
1491 .I print
1492 but also
1493 prints out ignored header fields
1494 and all parts of MIME
1495 .I multipart/alternative
1496 messages.
1497 See also
1498 .IR print ,
1499 .IR ignore ,
1501 .IR retain .
1503 .B print
1504 (p) Takes a message list and types out each message
1505 on the user's terminal.
1506 If the message is a MIME multipart message,
1507 all parts with a content type of `text' or `message' are shown,
1508 the other are hidden except for their headers.
1509 Messages are decrypted and converted to the terminal character set
1510 if necessary.
1512 .B probability
1513 (prob) For each word given as argument,
1514 the contents of its junk mail database entry are printed.
1516 .B quit
1517 (q) Terminates the session, saving all undeleted,
1518 unsaved messages in the user's mbox file in his login directory,
1519 preserving all messages marked with hold or preserve
1520 or never referenced in his system mailbox,
1521 and removing all other messages from his system mailbox.
1522 If new mail has arrived during the session,
1523 the message `\fIYou have new mail\fR' is given.
1524 If given while editing a mailbox file with the \-f flag,
1525 then the edit file is rewritten.
1526 A return to the Shell is effected,
1527 unless the rewrite of edit file fails,
1528 in which case the user can escape
1529 with the exit command.
1531 .B redirect
1532 (red) Same as
1533 .IR resend .
1535 .B Redirect
1536 (Red) Same as
1537 .IR Resend .
1539 .B remove
1540 (rem) Removes the named folders.
1541 The user is asked for confirmation
1542 in interactive mode.
1544 .B rename
1545 (ren) Takes the name of an existing folder
1546 and the name for the new folder
1547 and renames the first to the second one.
1548 Both folders must be of the same type
1549 and must be located on the current server for IMAP.
1551 .B Reply
1552 (R) Reply to originator.
1553 Does not reply to other recipients
1554 of the original message.
1556 .BR reply
1557 (r) Takes a message list and sends mail
1558 to the sender and all recipients of the specified message.
1559 The default message must not be deleted.
1561 .B replyall
1562 Similar to
1563 .IR reply ,
1564 but responds to all recipients regardless of the
1565 .I flipr
1567 .I Replyall
1568 variables.
1570 .B replysender
1571 Similar to
1572 .IR Reply ,
1573 but responds to the sender only regardless of the
1574 .I flipr
1576 .I Replyall
1577 variables.
1579 .B Resend
1580 Like
1581 .IR resend ,
1582 but does not add any header lines.
1583 This is not a way to hide the sender's identity,
1584 but useful for sending a message again
1585 to the same recipients.
1587 .B resend
1588 Takes a list of messages and a user name
1589 and sends each message to the named user.
1590 `Resent-From:' and related header fields are prepended
1591 to the new copy of the message.
1593 .B Respond
1594 Same as
1595 .IR Reply .
1597 .B respond
1598 Same as
1599 .IR reply .
1601 .B respondall
1602 Same as
1603 .IR replyall .
1605 .B respondsender
1606 Same as
1607 .IR replysender .
1609 .B retain
1610 Add the list of header fields named to the retained list.
1611 Only the header fields in the retain list are shown
1612 on the terminal when a message is printed.
1613 All other header fields are suppressed.
1614 The Type and Print commands can be used
1615 to print a message in its entirety.
1616 If retain is executed with no arguments,
1617 it lists the current set of retained fields.
1619 .B Save
1621 Similar to
1622 .IR save ,
1623 but saves the messages
1624 in a file named after the local part
1625 of the sender of the first message
1626 instead of taking a filename argument.
1628 .B save
1629 (s) Takes a message list and a filename
1630 and appends each message
1631 in turn to the end of the file.
1632 If no filename is given,
1633 the mbox file is used.
1634 The filename in quotes,
1635 followed by the line count and character count
1636 is echoed on the user's terminal.
1637 If editing a system mailbox,
1638 the messages are marked for deletion.
1639 Compressed files and IMAP mailboxes are handled as described for the
1640 .I \-f
1641 command line option above.
1643 .B savediscard
1644 Same as saveignore.
1646 .B saveignore
1647 Saveignore is to save what ignore is to print and type.
1648 Header fields thus marked are filtered out
1649 when saving a message by save
1650 or when automatically saving to mbox.
1651 This command should only be applied to header fields
1652 that do not contain information needed to decode the message,
1653 as MIME content fields do.
1654 If saving messages on an IMAP account,
1655 ignoring fields makes it impossible
1656 to copy the data directly on the server,
1657 thus operation usually becomes much slower.
1659 .B saveretain
1660 Saveretain is to save what retain is to print and type.
1661 Header fields thus marked are the only ones
1662 saved with a message when saving by save
1663 or when automatically saving to mbox.
1664 Saveretain overrides saveignore.
1665 The use of this command is strongly discouraged
1666 since it may strip header fields
1667 that are needed to decode the message correctly.
1669 .B score
1670 (sc) Takes a message list and a floating point number
1671 and adds the number to the score of each given message.
1672 All messages start at score 0 when a folder is opened.
1673 When the score of a message becomes negative, it is `killed'
1674 with the effects described for the
1675 .I kill
1676 command;
1677 otherwise if it was negative before and becomes positive,
1678 it is `unkilled'.
1679 Scores only refer to the currently opened instance of a folder.
1681 .B set
1682 (se) With no arguments, prints all variable values,
1683 piped through the pager if the output does not fit on the screen.
1684 Otherwise, sets option.
1685 Arguments are of the form option=value
1686 (no space before or after =)
1687 or option.
1688 Quotation marks may be placed around any part of the
1689 assignment statement to quote blanks
1690 or tabs, i.\|e. `\fIset indentprefix="\->"\fR'.
1691 If an argument begins with
1692 .BR no ,
1693 as in `\fBset no\fIsave\fR',
1694 the effect is the same as invoking the
1695 .I unset
1696 command with the remaining part of the variable
1697 (`\fIunset \fIsave\fR').
1699 .B seen
1700 Takes a message list and marks all messages as having been read.
1702 .B shell
1703 (sh) Invokes an interactive version of the shell.
1705 .B shortcut
1706 Defines a shortcut name and its string for expansion,
1707 as described for the
1708 .I folder
1709 command.
1710 With no arguments,
1711 a list of defined shortcuts is printed.
1713 .B show
1714 (Sh) Like
1715 .IR print ,
1716 but performs neither MIME decoding nor decryption
1717 so that the raw message text is shown.
1719 .B size
1720 Takes a message list and prints out
1721 the size in characters of each message.
1723 .B sort
1724 Create a sorted representation of the current folder,
1725 and change the
1726 .I next
1727 command and the addressing modes
1728 such that they refer to messages in the sorted order.
1729 Message numbers are the same as in regular mode.
1730 If the
1731 .I header
1732 variable is set,
1733 a header summary in the new order is also printed.
1734 Possible sorting criteria are:
1737 .B date
1738 Sort the messages by their `Date:' field,
1739 that is by the time they were sent.
1741 .B from
1742 Sort messages by the value of their `From:' field,
1743 that is by the address of the sender.
1744 If the
1745 .I showname
1746 variable is set,
1747 the sender's real name (if any) is used.
1749 .B size
1750 Sort the messages by their size.
1752 .B score
1753 Sort the messages by their score.
1755 .B status
1756 Sort the messages by their message status
1757 (new, read, old, etc.).
1759 .B subject
1760 Sort the messages by their subject.
1762 .B thread
1763 Create a threaded order,
1764 as with the
1765 .I thread
1766 command.
1768 .B to
1769 Sort messages by the value of their `To:' field,
1770 that is by the address of the recipient.
1771 If the
1772 .I showname
1773 variable is set,
1774 the recipient's real name (if any) is used.
1777 If no argument is given,
1778 the current sorting criterion is printed.
1780 .B source
1781 The source command reads commands from a file.
1783 .B thread
1784 (th) Create a threaded representation of the current folder,
1785 i.\|e. indent messages that are replies to other messages
1786 in the header display,
1787 and change the
1788 .I next
1789 command and the addressing modes
1790 such that they refer to messages in the threaded order.
1791 Message numbers are the same as in unthreaded mode.
1792 If the
1793 .I header
1794 variable is set,
1795 a header summary in threaded order is also printed.
1797 .B top
1798 Takes a message list and prints the top few lines of each.
1799 The number of lines printed is controlled
1800 by the variable toplines
1801 and defaults to five.
1803 .B touch
1804 Takes a message list
1805 and marks the messages for saving in the
1806 .I mbox
1807 file.
1808 .I S-nail
1809 deviates from the POSIX standard with this command,
1810 as a `next' command issued after `mbox'
1811 will display the following message,
1812 not the current one.
1814 .B Type
1815 (T) Identical to the Print command.
1817 .B type
1818 (t) A synonym for print.
1820 .B unalias
1821 Takes a list of names defined by alias commands
1822 and discards the remembered groups of users.
1823 The group names no longer have any significance.
1825 .B unanswered
1826 Takes a message list and marks each message
1827 as not having been answered.
1829 .B uncollapse
1830 (unc)
1831 Only applicable to threaded mode.
1832 Takes a message list
1833 and makes the message and all replies to it visible
1834 in header summaries again.
1835 When a message becomes the current message,
1836 it is automatically made visible.
1837 Also when a message with collapsed replies is printed,
1838 all of these are automatically uncollapsed.
1840 .B undef
1841 Undefines each of the named macros.
1842 It is not an error to use a name that does not belong to
1843 one of the currently defined macros.
1845 .B undelete
1846 (u) Takes a message list and marks each message as not being deleted.
1848 .B undraft
1849 Takes a message list and marks each message
1850 as a draft.
1852 .B unflag
1853 Takes a message list and marks each message as not being `flagged'.
1855 .B unfwdignore
1856 Removes the header field names
1857 from the list of ignored fields for the
1858 .I forward
1859 command.
1861 .B unfwdretain
1862 Removes the header field names
1863 from the list of retained fields for the
1864 .I forward
1865 command.
1867 .B ungood
1868 Takes a message list and undoes the effect of a
1869 .I good
1870 command that was previously applied on exactly these messages.
1872 .B unignore
1873 Removes the header field names
1874 from the list of ignored fields.
1876 .B unjunk
1877 Takes a message list and undoes the effect of a
1878 .I junk
1879 command that was previously applied on exactly these messages.
1881 .B unkill
1882 Takes a message list and `unkills' each message.
1883 Also sets the score of the messages to 0.
1885 .B Unread
1886 Same as
1887 .IR unread .
1889 .B unread
1890 (U) Takes a message list and marks each message
1891 as not having been read.
1893 .B unretain
1894 Removes the header field names
1895 from the list of retained fields.
1897 .B unsaveignore
1898 Removes the header field names
1899 from the list of ignored fields for saving.
1901 .B unsaveretain
1902 Removes the header field names
1903 from the list of retained fields for saving.
1905 .B unset
1906 Takes a list of option names and discards their remembered
1907 values;
1908 the inverse of set.
1910 .B unshortcut
1911 Deletes the shortcut names given as arguments.
1913 .B unsort
1914 Disable sorted or threaded mode (see the
1915 .I sort
1917 .I thread
1918 commands), return to normal message order
1919 and,
1920 if the
1921 .I header
1922 variable is set,
1923 print a header summary.
1925 .B unthread
1926 (unth) Same as
1927 .IR unsort .
1929 .B verify
1930 (verif)
1931 Takes a message list and verifies each message.
1932 If a message is not an S/MIME signed message,
1933 verification will fail for it.
1934 The verification process checks
1935 if the message was signed using a valid certificate,
1936 if the message sender's email address matches
1937 one of those contained within the certificate,
1938 and if the message content has been altered.
1940 .B visual
1941 (v) Takes a message list and invokes the display editor
1942 on each message.
1943 Modified contents are discarded
1944 unless the
1945 .I writebackedited
1946 variable is set.
1948 .B write
1949 (w) For conventional messages,
1950 the body without all headers is written.
1951 The output is decrypted and converted
1952 to its native format, if necessary.
1953 If the output file exists,
1954 the text is appended.\(emIf a message is in MIME multipart format,
1955 its first part is written to the specified file
1956 as for conventional messages,
1957 and the user is asked for a filename
1958 to save each other part;
1959 if the contents of the first part are not to be saved,
1960 `write /dev/null' can be used.
1961 For the second and subsequent parts,
1962 if the filename given starts with a `|' character,
1963 the part is piped through the remainder of the filename
1964 interpreted as a shell command.
1965 In non-interactive mode, only the parts of the multipart message
1966 that have a filename given in the part header are written,
1967 the other are discarded.
1968 The original message is never marked for deletion
1969 in the originating mail folder.
1970 For attachments,
1971 the contents of the destination file are overwritten
1972 if the file previously existed.
1973 No special handling of compressed files is performed.
1975 .B xit
1976 (x) A synonym for exit.
1978 .B z
1979 \fIS-nail\fR presents message headers in windowfuls
1980 as described under the headers command.
1981 The z command scrolls to the next window of messages.
1982 If an argument is given,
1983 it specifies the window to use.
1984 A number prefixed by `+' or `\-' indicates
1985 that the window is calculated in relation
1986 to the current position.
1987 A number without a prefix specifies an
1988 absolute window number,
1989 and a `$' lets \fIs-nail\fR scroll
1990 to the last window of messages.
1992 .B Z
1993 Similar to
1994 .IR z ,
1995 but scrolls to the next or previous window
1996 that contains at least one new or `flagged' message.
1997 .SS "Tilde escapes"
1998 Here is a summary of the tilde escapes,
1999 which are used when composing
2000 messages to perform special functions.
2001 Tilde escapes are only recognized
2002 at the beginning of lines.
2003 The name `\fItilde escape\fR' is somewhat of a misnomer
2004 since the actual escape character can be set
2005 by the option escape.
2007 .BI ~! command
2008 Execute the indicated shell command,
2009 then return to the message.
2011 .B ~.
2012 Same effect as typing the end-of-file character.
2014 .BI ~< filename
2015 Identical to ~r.
2017 .BI ~<! command
2018 Command is executed using the shell.
2019 Its standard output is inserted into the message.
2021 \fB~@\fR [\fIfilename\fR .\ .\ . ]
2022 With no arguments, edit the attachment list.
2023 First, the user can edit all existing attachment data.
2024 If an attachment's file name is left empty,
2025 that attachment is deleted from the list.
2026 When the end of the attachment list is reached,
2027 .I s-nail
2028 will ask for further attachments,
2029 until an empty file name is given.
2030 If \fIfilename\fP arguments are specified,
2031 all of them are appended to the end of the attachment list.
2032 Filenames which contain white space
2033 can only be specified
2034 with the first method (no \fIfilename\fP arguments).
2036 .B ~A
2037 Inserts the string contained in the
2038 .I Sign
2039 variable
2040 (same as `~i Sign').
2041 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
2042 are understood.
2044 .B ~a
2045 Inserts the string contained in the
2046 .B sign
2047 variable
2048 (same as `~i sign').
2049 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
2050 are understood.
2052 .BI ~b "name .\ .\ ."
2053 Add the given names to the list of carbon copy recipients
2054 but do not make the names visible in the Cc: line
2055 (`blind' carbon copy).
2057 .BI ~c "name .\ .\ ."
2058 Add the given names to the list of carbon copy recipients.
2060 .B ~d
2061 Read the file `dead.letter' from the user's home directory
2062 into the message.
2064 .B ~e
2065 Invoke the text editor on the message collected so far.
2066 After the editing session is finished,
2067 the user may continue appending text
2068 to the message.
2070 .BI ~f messages
2071 Read the named messages into the message being sent.
2072 If no messages are specified,
2073 read in the current message.
2074 Message headers currently being ignored
2075 (by the ignore or retain command)
2076 are not included.
2077 For MIME multipart messages,
2078 only the first printable part is included.
2080 .BI ~F messages
2081 Identical to ~f, except all message headers and
2082 all MIME parts are included.
2084 .B ~h
2085 Edit the message header fields
2086 `To:', `Cc:', `Bcc:', and `Subject:'
2087 by typing each one in turn
2088 and allowing the user to append text
2089 to the end or modify the field
2090 by using the current terminal erase and kill characters.
2092 .B ~H
2093 Edit the message header fields
2094 `From:', `Reply-To:', `Sender:', and `Organization:'
2095 in the same manner as described for
2096 .IR ~h .
2097 The default values for these fields originate from the
2098 .IR from ,
2099 .IR replyto ,
2101 .I ORGANIZATION
2102 variables.
2103 If this tilde command has been used,
2104 changing the variables has no effect on the current message anymore.
2106 .BI ~i variable
2107 Insert the value of the specified variable
2108 into the message adding a newline character at the end.
2109 If the variable is unset or empty,
2110 the message remains unaltered.
2111 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
2112 are understood.
2114 .BI ~m messages
2115 Read the named messages into the message being sent,
2116 indented by a tab or by the value of indentprefix.
2117 If no messages are specified,
2118 read the current message.
2119 Message headers currently being ignored
2120 (by the ignore or retain command)
2121 are not included.
2122 For MIME multipart messages,
2123 only the first printable part is included.
2125 .BI ~M messages
2126 Identical to ~m, except all message headers and
2127 all MIME parts are included.
2129 .B ~p
2130 Print out the message collected so far,
2131 prefaced by the message header fields
2132 and followed by the attachment list, if any.
2133 If the message text is longer than the screen size,
2134 it is piped through the pager.
2136 .B ~q
2137 Abort the message being sent,
2138 copying the message to
2139 `dead.letter' in the user's home directory
2140 if save is set.
2142 .BI ~r filename
2143 Read the named file into the message.
2145 .BI ~s string
2146 Cause the named string to become the current subject field.
2148 .BI ~t "name .\ .\ ."
2149 Add the given names to the direct recipient list.
2151 .B ~v
2152 Invoke an alternate editor
2153 (defined by the VISUAL option)
2154 on the message collected so far.
2155 Usually, the alternate editor
2156 will be a screen editor.
2157 After the editor is quit,
2158 the user may resume appending text
2159 to the end of the message.
2161 .BI ~w filename
2162 Write the message onto the named file.
2163 If the file exists,
2164 the message is appended to it.
2166 .B ~x
2167 Same as ~q,
2168 except that the message is not saved to the `dead.letter' file.
2170 .BI ~| command
2171 Pipe the message through the command as a filter.
2172 If the command gives no output or terminates abnormally,
2173 retain the original text of the message.
2174 The command
2175 .IR fmt (1)
2176 is often used
2177 as command to rejustify the message.
2179 .BI ~: s-nail-command
2180 Execute the given \fIs-nail\fR command.
2181 Not all commands, however, are allowed.
2183 .BI ~_ s-nail-command
2184 Identical to ~:.
2186 .BI ~~ string
2187 Insert the string of text in the message
2188 prefaced by a single ~.
2189 If the escape character has been changed,
2190 that character must be doubled
2191 in order to send it at the beginning of a line.
2192 .SS "Variable options"
2193 Options are controlled via set and unset commands,
2194 see their entries for a syntax description.
2195 An option is also set
2196 if it is passed to \fIs-nail\fR
2197 as part of the environment
2198 (this is not restricted to specific variables as in the POSIX standard).
2199 A value given in a startup file overrides
2200 a value imported from the environment.
2201 Options may be either binary,
2202 in which case it is only significant
2203 to see whether they are set or not;
2204 or string, in which case the actual value is of interest.
2205 .SS "Binary options"
2207 The binary options include the following:
2209 .B allnet
2210 Causes only the local part to be evaluated
2211 when comparing addresses.
2213 .B append
2214 Causes messages saved in mbox to be appended to the end
2215 rather than prepended.
2216 This should always be set.
2218 .BR ask \ or \ asksub
2219 Causes \fIs-nail\fR to prompt for the subject
2220 of each message sent.
2221 If the user responds with simply a newline,
2222 no subject field will be sent.
2224 .B askatend
2225 Causes the prompts for `Cc:' and `Bcc:' lists
2226 to appear after the message has been edited.
2228 .B askattach
2229 If set, \fIs-nail\fR asks for files to attach at the end of each message.
2230 Responding with a newline indicates not to include an attachment.
2232 .B askcc
2233 Causes the user to be prompted
2234 for additional carbon copy recipients
2235 (at the end of each message if
2236 .I askatend
2238 .I bsdcompat
2239 is set).
2240 Responding with a newline
2241 indicates the user's satisfaction with the current list.
2243 .B askbcc
2244 Causes the user to be prompted
2245 for additional blind carbon copy recipients
2246 (at the end of each message if
2247 .I askatend
2249 .I bsdcompat
2250 is set).
2251 Responding with a newline
2252 indicates the user's satisfaction with the current list.
2254 .B asksign
2255 Causes the user to be prompted
2256 if the message is to be signed
2257 at the end of each message.
2259 .I smime-sign
2260 variable is ignored when this variable is set.
2262 .B autocollapse
2263 Causes threads to be collapsed automatically when
2264 threaded mode is entered
2265 (see the
2266 .I collapse
2267 command).
2269 .B autoinc
2270 Same as
2271 .IR newmail .
2273 .B autoprint
2274 Causes the delete command to behave like dp \-
2275 thus, after deleting a message,
2276 the next one will be typed automatically.
2278 .B autothread
2279 Causes threaded mode (see the
2280 .I thread
2281 command) to be entered automatically
2282 when a folder is opened.
2284 .B bang
2285 Enables the substitution of `\fB!\fR'
2286 by the contents of the last command line
2287 in shell escapes.
2289 .B bsdannounce
2290 Causes automatic display of a header summary after executing a
2291 .I folder
2292 command.
2294 .B bsdcompat
2295 Sets some cosmetical features to traditional BSD style;
2296 has the same affect as setting `askatend' and
2297 all other variables prefixed with `bsd',
2298 setting prompt to `&\ ', and changing the default pager to
2299 .IR more .
2301 .B bsdflags
2302 Changes the letters printed in the first column of a header summary
2303 to traditional BSD style.
2305 .B bsdheadline
2306 Changes the display of columns in a header summary
2307 to traditional BSD style.
2309 .B bsdmsgs
2310 Changes some informational messages
2311 to traditional BSD style.
2313 .B bsdorder
2314 Causes the `Subject:' field to appear
2315 immediately after the `To:' field
2316 in message headers and with the
2317 .I ~h
2318 tilde command.
2320 .B bsdset
2321 Changes the output format of the
2322 .I set
2323 command to traditional BSD style.
2325 .B chained-junk-tokens
2326 Normally, the Bayesian junk mail filter bases its classifications
2327 on single word tokens extracted from messages.
2328 If this option is set,
2329 adjacent words are combined to pairs,
2330 which are then used as additional tokens.
2331 This usually improves the accuracy of the filter,
2332 but also increases the junk mail database
2333 five- to tenfold.
2335 .B datefield
2336 The date in a header summary
2337 is normally the date of the mailbox `From\ ' line of the message.
2338 If this variable is set,
2339 the date as given in the `Date:' header field is used,
2340 converted to local time.
2342 .B debug
2343 Prints debugging messages and disables the actual delivery of messages.
2344 Unlike
2345 .IR verbose ,
2346 this option is intended for
2347 .I s-nail
2348 development only.
2350 .B disconnected
2351 When an IMAP mailbox is selected and this variable is set,
2352 no connection to the server is initiated.
2353 Instead, data is obtained from the local cache (see
2354 .IR imap-cache ).
2355 Mailboxes that are not present in the cache
2356 and messages that have not yet entirely been fetched from the server
2357 are not available;
2358 to fetch all messages in a mailbox at once,
2359 the command `copy * /dev/null' can be used
2360 while still in
2361 .I online
2362 mode.
2363 Changes that are made to IMAP mailboxes in disconnected mode
2364 are queued and committed later
2365 when a connection to that server is opened in online mode.
2366 This procedure is not completely reliable
2367 since it cannot be guaranteed that the IMAP unique identifiers (UIDs)
2368 on the server still match the ones in the cache at that time.
2369 Data is saved to `dead.letter' when this problem occurs.
2371 \fBdisconnected-\fIuser\fB@\fIhost\fR
2372 The specified account is handled as described for the
2373 .I disconnected
2374 variable above,
2375 but other accounts are not affected.
2377 .B dot
2378 The binary option dot causes \fIs-nail\fR to interpret
2379 a period alone on a line
2380 as the terminator of a message the user is sending.
2382 .B editheaders
2383 When a message is edited while being composed,
2384 its header is included in the editable text.
2385 `To:', `Cc:', `Bcc:', `Subject:', `From:', `Reply-To:', `Sender:',
2386 and 'Organization:'
2387 fields are accepted within the header,
2388 other fields are ignored.
2390 .B emptybox
2391 If set, an empty mailbox file is not removed.
2392 This may improve the interoperability with other mail user agents
2393 when using a common folder directory.
2395 .B emptystart
2396 If the mailbox is empty,
2397 \fIs-nail\fR normally prints \fI`No mail for user'\fR
2398 and exits immediately.
2399 If this option is set,
2400 \fIs-nail\fR starts even with an empty mailbox.
2402 .B flipr
2403 Exchanges the
2404 .I Respond
2405 with the
2406 .I respond
2407 commands and vice-versa.
2409 .B forward-as-attachment
2410 Original messages are normally sent as inline text with the
2411 .I forward
2412 command,
2413 and only the first part of a multipart message is included.
2414 With this option,
2415 messages are sent as MIME
2416 .I message/rfc822
2417 attachments,
2418 and all of their parts are included.
2420 .I fwdignore
2422 .I fwdretain
2423 options are ignored when the
2424 .I forward-as-attachment
2425 option is set.
2427 .B fullnames
2428 When replying to a message,
2429 \fIs-nail\fR normally removes the comment parts of email addresses,
2430 which by convention contain the full names of the recipients.
2431 If this variable is set,
2432 such stripping is not performed,
2433 and comments are retained.
2435 .B header
2436 Causes the header summary to be written at startup
2437 and after commands that affect the number of messages
2438 or the order of messages in the current folder;
2439 enabled by default.
2441 .B hold
2442 This option is used to hold messages
2443 in the system mailbox by default.
2445 .B ignore
2446 Causes interrupt signals from the terminal
2447 to be ignored and echoed as @'s.
2449 .B ignoreeof
2450 An option related to dot is ignoreeof
2451 which makes \fIs-nail\fR refuse to
2452 accept a control-d as the end of a message.
2453 Ignoreeof also applies to \fIs-nail\fR command mode.
2455 .B imap-use-starttls
2456 Causes
2457 .I s-nail
2458 to issue a STARTTLS command
2459 to make an unencrypted IMAP session SSL/TLS encrypted.
2460 This functionality is not supported by all servers,
2461 and is not used if the session is already encrypted by the IMAPS method.
2463 \fBimap-use-starttls-\fIuser\fB@\fIhost\fR
2464 Activates
2465 .I imap-use-starttls
2466 for a specific account.
2468 .B keep
2469 This option causes \fIs-nail\fR to truncate the user's system mailbox
2470 instead of deleting it when it is empty.
2471 This should always be set,
2472 since it prevents malicious users
2473 from creating fake mail folders
2474 in a world-writable spool directory.
2476 .B keepsave
2477 When a message is saved,
2478 it is usually discarded
2479 from the originating folder
2480 when
2481 .I s-nail
2482 is quit.
2483 Setting this option
2484 causes all saved message to be retained.
2486 .B markanswered
2487 When a message is replied to
2488 and this variable is set,
2489 it is marked as having been answered.
2490 This mark has no technical meaning in the mail system;
2491 it just causes messages to be marked in the header summary,
2492 and makes them specially addressable.
2494 .B metoo
2495 Usually, when a group is expanded
2496 that contains the sender,
2497 the sender is removed from the expansion.
2498 Setting this option causes
2499 the sender to be included in the group.
2501 .B newmail
2502 Checks for new mail in the current folder
2503 each time the prompt is printed.
2504 For IMAP mailboxes,
2505 the server is then polled for new mail,
2506 which may result in delayed operation
2507 if the connection to the server is slow.
2509 .I maildir
2510 folder must be re-scanned to determine
2511 if new mail has arrived.
2513 If this variable is set to the special value
2514 .BR nopoll ,
2515 an IMAP server is not actively asked for new mail,
2516 but new mail may still be detected and announced
2517 with any other IMAP command that is sent to the server.
2519 .I maildir
2520 folder is not scanned then.
2522 In any case,
2523 the IMAP server may send notifications about messages
2524 that have been deleted on the server
2525 by another process or client.
2526 In this case, `Expunged \fIn\fR messages' is printed
2527 regardless of this variable,
2528 and message numbers may have changed.
2530 .B noheader
2531 Setting the option noheader is the same
2532 as giving the \-N flag on the command line.
2534 .B outfolder
2535 Causes the filename given in the
2536 .I record
2537 variable
2538 and the sender-based filenames for the
2539 .I Copy
2541 .I Save
2542 commands
2543 to be interpreted relative to the directory given in the
2544 .I folder
2545 variable rather than to the current directory
2546 unless it is an absolute pathname.
2548 .B page
2549 If set, each message the \fIpipe\fR command prints out
2550 is followed by a formfeed character.
2552 .B piperaw
2553 Send messages to the
2554 .I pipe
2555 command without performing MIME and character set conversions.
2557 .B pop3-use-apop
2558 If this variable is set,
2559 the APOP authentication method is used
2560 when a connection to a POP3 server is initiated.
2561 The advantage of this method over the usual USER/PASS authentication is
2562 that the password is not sent over the network in clear text.
2563 The connection fails
2564 if the server does not support the APOP command.
2566 \fBpop3-use-apop-\fIuser\fB@\fIhost\fR
2567 Enables
2568 .I pop3-use-apop
2569 for a specific account.
2571 .B pop3-use-starttls
2572 Causes
2573 .I s-nail
2574 to issue a STLS command
2575 to make an unencrypted POP3 session SSL/TLS encrypted.
2576 This functionality is not supported by all servers,
2577 and is not used if the session is already encrypted by the POP3S method.
2579 \fBpop3-use-starttls-\fIuser\fB@\fIhost\fR
2580 Activates
2581 .I pop3-use-starttls
2582 for a specific account.
2584 .B print-all-chars
2585 This option causes all characters to be considered printable.
2586 It is only effective if given in a startup file.
2587 With this option set,
2588 some character sequences in messages
2589 may put the user's terminal in an undefined state
2590 when printed;
2591 it should only be used as a last resort
2592 if no working system locale can be found.
2594 .B print-alternatives
2595 When a MIME message part of type
2596 .I multipart/alternative
2597 is displayed and it contains a subpart of type
2598 .IR text/plain ,
2599 other parts are normally discarded.
2600 Setting this variable causes all subparts to be displayed,
2601 just as if the surrounding part was of type
2602 .IR multipart/mixed .
2604 .B quiet
2605 Suppresses the printing of the version when first invoked.
2607 .B recipients-in-cc
2608 On group replies, specify only the sender of the original mail
2609 in \fI`To:'\fR and mention it's other recipients in the secondary
2610 \fI`Cc:'\fR.
2612 .B record-resent
2613 If both this variable and the
2614 .I record
2615 variable are set,
2617 .I resend
2619 .I Resend
2620 commands save messages to the
2621 .I record
2622 folder as it is normally only done for newly composed messages.
2624 .B reply-in-same-charset
2625 If this variable is set,
2626 .I s-nail
2627 first tries to use the same character set
2628 of the original message for replies.
2629 If this fails,
2631 .I sendcharsets
2632 variable is evaluated as usual.
2634 .B Replyall
2635 Reverses the sense of reply and Reply commands.
2637 .B save
2638 When the user aborts a message
2639 with two RUBOUT (interrupt characters)
2640 \fIs-nail\fR copies the partial letter
2641 to the file `dead.letter' in the home directory.
2642 This option is set by default.
2644 .B searchheaders
2645 If this option is set, then
2646 a message-list specifier in the form `\fI/x:y\fR'
2647 will expand to all messages containing
2648 the substring `\fIy\fR' in the header field `\fIx\fR'.
2649 The string search is case insensitive.
2651 .B sendwait
2652 When sending a message,
2653 wait until the mail transfer agent exits
2654 before accepting further commands.
2655 If the mail transfer agent returns a non-zero exit status,
2656 the exit status of s-nail will also be non-zero.
2658 .B showlast
2659 Setting this option causes \fIs-nail\fR to start at the
2660 last message instead of the first one when opening a mail folder.
2662 .B showname
2663 Causes
2664 .I s-nail
2665 to use the sender's real name instead of the plain address
2666 in the header field summary and in message specifications.
2668 .B showto
2669 Causes the recipient of the message to be shown in the header summary
2670 if the message was sent by the user.
2672 .B skipemptybody
2673 If an outgoing message does not contain any text
2674 in its first or only message part,
2675 do not send it but discard it silently
2676 (see also the
2677 .I \-E
2678 option).
2680 .B smime-force-encryption
2681 Causes
2682 .I s-nail
2683 to refuse sending unencrypted messages.
2685 .B smime-sign
2686 If this variable is set,
2687 outgoing messages are S/MIME signed with the user's private key.
2688 Signing a message enables a recipient to verify
2689 that the sender used a valid certificate,
2690 that the email addresses in the certificate
2691 match those in the message header,
2692 and that the message content has not been altered.
2693 It does not change the message text,
2694 and people will be able to read the message as usual.
2696 .B smime-no-default-ca
2697 Do not load the default CA locations
2698 when verifying S/MIME signed messages.
2699 Only applicable if S/MIME support is built using OpenSSL.
2701 .B smtp-use-starttls
2702 Causes \fIs-nail\fR to issue a STARTTLS command
2703 to make an SMTP session SSL/TLS encrypted.
2704 Not all servers support this command;
2705 because of common implementation defects,
2706 it cannot be automatically determined
2707 whether a server supports it or not.
2709 .B ssl-no-default-ca
2710 Do not load the default CA locations
2711 to verify SSL/TLS server certificates.
2712 Only applicable if SSL/TLS support is built using OpenSSL.
2714 .B ssl-v2-allow
2715 Accept SSLv2 connections.
2716 These are normally not allowed
2717 because this protocol version is insecure.
2719 .B stealthmua
2720 Inhibits the generation of
2721 the \fI`Message-Id:'\fR and \fI`User-Agent:'\fR
2722 header fields that include obvious references to \fIs-nail\fR.
2723 There are two pitfalls associated with this:
2724 First, the message id of outgoing messages is not known anymore.
2725 Second, an expert may still use the remaining information in the header
2726 to track down the originating mail user agent.
2728 .B verbose
2729 Setting the option verbose is the same
2730 as using the \-v flag on the command line.
2731 When \fIs-nail\fR runs in verbose mode,
2732 details of the actual message delivery
2733 and protocol conversations for IMAP, POP3, and SMTP,
2734 as well as of other internal processes,
2735 are displayed on the user's terminal,
2736 This is sometimes useful to debug problems.
2737 .I S-nail
2738 prints all data that is sent to remote servers in clear texts,
2739 including passwords,
2740 so care should be taken that no unauthorized option
2741 can view the screen if this option is enabled.
2743 .B writebackedited
2744 If this variable is set,
2745 messages modified using the
2746 .I edit
2748 .I visual
2749 commands are written back to the current folder when it is quit.
2750 This is only possible for writable folders in
2751 .I mbox
2752 format.
2753 Setting this variable also disables
2754 MIME decoding and decryption for the editing commands.
2755 .SS "String Options"
2757 The string options include the following:
2759 .B attrlist
2760 A sequence of characters to print in the `attribute'
2761 column of a header summary,
2762 each for one type of messages in the following order:
2763 new,
2764 unread but old,
2765 new but read,
2766 read and old,
2767 saved,
2768 preserved,
2769 mboxed,
2770 flagged,
2771 answered,
2772 draft,
2773 killed,
2774 start of a collapsed thread,
2775 collapsed,
2776 classified as junk.
2777 The default is `NUROSPMFATK+\-J',
2778 or `NU\ \ *HMFATK+\-J' if
2779 .I bsdflags
2780 or the
2781 .I SYSV3
2782 environment variable
2783 are set.
2785 .B autobcc
2786 Specifies a list of recipients to which
2787 a blind carbon copy of each outgoing message
2788 will be sent automatically.
2790 .B autocc
2791 Specifies a list of recipients to which
2792 a carbon copy of each outgoing message
2793 will be sent automatically.
2795 .B autosort
2796 Causes sorted mode (see the
2797 .I sort
2798 command) to be entered automatically
2799 with the value of this option as sorting method
2800 when a folder is opened.
2802 .B cmd
2803 The default value for the \fIpipe\fR command.
2805 .B crt
2806 The valued option crt is used as a threshold
2807 to determine how long a message must be
2808 before PAGER is used to read it.
2809 If crt is set without a value,
2810 then the height of the terminal screen stored in the system
2811 is used to compute the threshold (see
2812 .IR stty (1)).
2814 .B DEAD
2815 The name of the file to use
2816 for saving aborted messages.
2817 This defaults to `dead.letter'
2818 in the user's home directory.
2820 .B EDITOR
2821 Pathname of the text editor to use
2822 in the edit command and ~e escape.
2823 If not defined,
2824 then a default editor is used.
2826 .B encoding
2827 The default MIME encoding to use
2828 in outgoing text messages and message parts.
2829 Valid values are \fI8bit\fR or \fIquoted-printable\fR.
2830 The default is \fI8bit\fR.
2831 In case the mail transfer system
2832 is not ESMTP compliant,
2833 \fIquoted-printable\fR should be used instead.
2834 If there is no need to encode a message,
2835 \fI7bit\fR transfer mode is used,
2836 without regard to the value of this variable.
2837 Binary data is always encoded in \fIbase64\fR mode.
2839 .B escape
2840 If defined, the first character of this option
2841 gives the character to use in the place of ~ to denote escapes.
2843 .B folder
2844 The name of the directory to use
2845 for storing folders of messages.
2846 All folder names that begin with `+'
2847 refer to files below that directory.
2848 If the directory name begins with a `/',
2849 \fIs-nail\fR considers it to be an absolute pathname;
2850 otherwise, the folder directory is found
2851 relative to the user's home directory.
2853 The directory name may also refer to an IMAP account;
2854 any names that begin with `+'
2855 then refer to IMAP mailboxes on that account.
2856 An IMAP folder is normally given in the form
2859     imaps://mylogin@imap.myisp.example
2862 In this case,
2863 the `+' and `@' prefixes for folder names
2864 have the same effect
2865 (see the
2866 .I folder
2867 command).
2869 Some IMAP servers do not accept the creation of mailboxes
2870 in the hierarchy base;
2871 they require that they are created as subfolders of `INBOX'.
2872 With such servers,
2873 a folder name of the form
2876     imaps://mylogin@imap.myisp.example/INBOX.\&
2879 should be used
2880 (the last character is the server's hierarchy delimiter).
2881 Folder names prefixed by `+' will then refer to folders below `INBOX',
2882 while folder names prefixed by `@'
2883 refer to folders below the hierarchy base.
2884 See the
2885 .I imap namespace
2886 command for a method to detect the appropriate prefix and delimiter.
2888 .B folder-hook
2889 When a folder is opened and this variable is set,
2890 the macro corresponding to the value of this variable is executed.
2891 The macro is also invoked when new mail arrives,
2892 but message lists for commands executed from the macro
2893 only include newly arrived messages then.
2895 \fBfolder-hook-\fIfullname\fR
2896 When a folder named
2897 .I fullname
2898 is opened,
2899 the macro corresponding to the value of this variable is executed.
2900 Unlike other folder specifications,
2901 the fully expanded name of a folder, without metacharacters,
2902 is used to avoid ambiguities.
2903 The macro specified with
2904 .I folder-hook
2905 is not executed if this variable is effective for a folder
2906 (unless it is explicitly invoked within the called macro).
2908 .B from
2909 The address (or a list of addresses)
2910 to put into the \fI`From:'\fR field of the message header.
2911 If replying to a message,
2912 these addresses are handled as if they were in the alternates list.
2913 .\" If this variable is set,
2914 .\" a \fI`Sender:'\fR field containing the user's name
2915 .\" is also generated,
2916 .\" unless the variable \fIsmtp\fR is set
2917 .\" and its value differs from \fIlocalhost\fR.
2918 If the machine's hostname is not valid at the Internet
2919 (for example at a dialup machine),
2920 either this variable or
2921 .I hostname
2922 have to be set
2923 to get correct Message-ID header fields.
2925 .I from
2926 contains more than one address,
2928 .I sender
2929 variable must also be set.
2931 .B fwdheading
2932 The string to print before the text of a message
2933 with the
2934 .I forward
2935 command
2936 (unless the
2937 .I forward-as-attachment
2938 variable is set).
2939 Defaults to ``-------- Original Message --------'' if unset.
2940 If it is set to the empty string,
2941 no heading is printed.
2943 .B headline
2944 A format string to use for the header summary,
2945 similar to
2946 .I printf
2947 formats.
2948 A `%' character introduces a format specifier.
2949 It may be followed by a number indicating the field width.
2950 If the field is a number,
2951 the width may be negative,
2952 which indicates that it is to be left-aligned.
2953 Valid format specifiers are:
2955 .in +4m
2957 l4fB l.
2958 %a      Message attributes.
2959 %c      The score of the message.
2960 %d      The date when the message was received.
2961 %e      The indenting level in threaded mode.
2962 %f      The address of the message sender.
2963 %i      The message thread structure.
2964 %l      The number of lines of the message.
2965 %m      Message number.
2966 %o      The number of octets (bytes) in the message.
2967 %s      Message subject (if any).
2968 %S      Message subject (if any) in double quotes.
2969 %t      The position in threaded/sorted order.
2970 %>      A `>' for the current message, otherwise ` '.
2971 %<      A `<' for the current message, otherwise ` '.
2972 %%      A `%' character.
2974 .in -4m
2976 The default is `%>\&%a\&%m\ %18f\ %16d\ %4l/%\-5o\ %i%s',
2977 or `%>\&%a\&%m\ %20f\ \ %16d\ %3l/%\-5o\ %i%S' if
2978 .I bsdcompat
2979 is set.
2981 .B hostname
2982 Use this string as hostname
2983 when expanding local addresses
2984 instead of the value obtained from
2985 .IR uname (2)
2987 .IR getaddrinfo (3).
2989 .B imap-auth
2990 Sets the IMAP authentication method.
2991 Valid values are `login' for the usual password-based authentication
2992 (the default),
2993 `cram-md5', which is a password-based authentication
2994 that does not send the password over the network in clear text,
2995 and `gssapi' for GSSAPI-based authentication.
2997 \fBimap-auth-\fIuser\fB@\fIhost\fR
2998 Sets the IMAP authentication method for a specific account.
3000 .B imap-cache
3001 Enables caching of IMAP mailboxes.
3002 The value of this variable must point to a directory
3003 that is either existent or can be created by
3004 .IR s-nail .
3005 All contents of the cache can be deleted by
3006 .I s-nail
3007 at any time;
3008 it is not safe to make assumptions about them.
3010 .B imap-keepalive
3011 IMAP servers may close the connection
3012 after a period of inactivity;
3013 the standard requires this to be at least 30 minutes,
3014 but practical experience may vary.
3015 Setting this variable to a numeric
3016 .I value
3017 greater than 0
3018 causes a NOOP command to be sent each
3019 .I value
3020 seconds if no other operation is performed.
3022 .B imap-list-depth
3023 When retrieving the list of folders on an IMAP server, the
3024 .I folders
3025 command stops after it has reached a certain depth
3026 to avoid possible infinite loops.
3027 The value of this variable sets the maximum depth allowed.
3028 The default is 2.
3029 If the folder separator on the current IMAP server is a slash `/',
3030 this variable has no effect,
3031 and the
3032 .I folders
3033 command does not descend to subfolders.
3035 .B indentprefix
3036 String used by the `\fI~m\fR' and `\fI~M\fR' tilde escapes
3037 and by the \fIquote\fR option
3038 for indenting messages,
3039 in place of the normal tab character (^I).
3040 Be sure to quote the value
3041 if it contains spaces or tabs.
3043 .B junkdb
3044 The location of the junk mail database.
3045 The string is treated like a folder name,
3046 as described for the
3047 .I folder
3048 command.
3050 The files in the junk mail database are normally stored in
3051 .IR compress (1)
3052 format for saving space.
3053 If processing time is considered more important,
3054 .IR uncompress (1)
3055 can be used to store them in plain form.
3056 .I S-nail
3057 will then work using the uncompressed files.
3059 .B LISTER
3060 Pathname of the directory lister
3061 to use in the
3062 .I folders
3063 command
3064 when operating on local mailboxes.
3065 Default is /bin/ls.
3067 .B MAIL
3068 Is used as the user's mailbox, if set.
3069 Otherwise, a system-dependent default is used.
3070 Can be a
3071 \fIprotocol\fB://\fR
3072 string (see the
3073 .I folder
3074 command for more information).
3076 .B SNAIL_HEAD
3077 A string to put at the beginning of each new message.
3078 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
3079 are understood.
3081 .B SNAIL_TAIL
3082 A string to put at the end of each new message.
3083 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
3084 are understood.
3086 .B maximum-unencoded-line-length
3087 Messages that contain lines longer than the value of this variable
3088 are encoded in quoted-printable
3089 even if they contain only ASCII characters.
3090 The maximum effective value is 950.
3091 If set to 0,
3092 all ASCII text messages are encoded in quoted-printable.
3093 S/MIME signed messages are always encoded
3094 in quoted-printable regardless of the value of this variable.
3096 .B MBOX
3097 The name of the mbox file.
3098 It can be the name of a folder.
3099 The default is `\fImbox\fR'
3100 in the user's home directory.
3102 .B SNAIL_EXTRA_RC
3103 The name of an optional startup file
3104 to be read after ~/.mailrc.
3105 This variable is ignored if it is imported from the environment;
3106 it has an effect only if it is set in /etc/nail.rc or ~/.mailrc
3107 to allow bypassing the configuration with e. g. `MAILRC=/dev/null'.
3108 Use this file for commands
3109 that are not understood by other s-nail implementations.
3111 .B newfolders
3112 If this variable has the value
3113 .BR maildir ,
3114 newly created local folders will be in
3115 .I maildir
3116 format.
3118 .B nss-config-dir
3119 A directory that contains the files
3120 .RI cert N .db
3121 to retrieve certificates,
3122 .RI key N .db
3123 to retrieve private keys,
3124 and secmod.db,
3125 where
3126 .I N
3127 is a digit.
3128 These are usually taken from Mozilla installations,
3129 so an appropriate value might be
3130 `~/.mozilla/firefox/default.clm'.
3131 .I S-nail
3132 opens these files read-only
3133 and does not modify them.
3134 However, if the files are modified by Mozilla
3135 while
3136 .I s-nail
3137 is running,
3138 it will print a `Bad database' message.
3139 It may be necessary to create copies of these files
3140 that are exclusively used by
3141 .I s-nail
3142 then.
3143 Only applicable if S/MIME and SSL/TLS support is built using
3144 Network Security Services (NSS).
3146 .B ORGANIZATION
3147 The value to put into the \fI`Organization:'\fR field of the message header.
3149 .B PAGER
3150 Pathname of the program to use
3151 in the more command
3152 or when crt variable is set.
3153 The default paginator
3154 .IR pg (1)
3155 or, in BSD compatibility mode,
3156 .IR more (1)
3157 is used
3158 if this option is not defined.
3160 \fBpassword-\fIuser\fB@\fIhost\fR
3161 Set the password for
3162 .I user
3163 when connecting to
3164 .IR host .
3165 If no such variable is defined for a host,
3166 the user will be asked for a password on standard input.
3167 Specifying passwords in a startup file
3168 is generally a security risk,
3169 the file should be readable
3170 by the invoking user only.
3172 .BI pipe- content/subcontent
3173 When a MIME message part of
3174 .I content/subcontent
3175 type is displayed or it is replied to,
3176 its text is filtered through the value of this variable
3177 interpreted as a shell command.
3178 Special care must be taken when using such commands
3179 as mail viruses may be distributed by this method;
3180 if messages of type
3181 .I application/x-sh
3182 were filtered through the shell, for example,
3183 a message sender could easily execute arbitrary code
3184 on the system
3185 .I s-nail
3186 is running on.
3188 .B pop3-keepalive
3189 POP3 servers may close the connection
3190 after a period of inactivity;
3191 the standard requires this to be at least 10 minutes,
3192 but practical experience may vary.
3193 Setting this variable to a numeric
3194 .I value
3195 greater than 0
3196 causes a NOOP command to be sent each
3197 .I value
3198 seconds if no other operation is performed.
3200 .B prompt
3201 The string printed when a command is accepted.
3202 Defaults to `\fB?\ \fR',
3203 or to `\fB&\ \fR' if the
3204 .I bsdcompat
3205 variable is set.
3207 .B quote
3208 If set, \fIs-nail\fR starts a replying message with the original message
3209 prefixed by the value of the variable \fIindentprefix\fR.
3210 Normally, a heading consisting of `Fromheaderfield wrote:' is printed
3211 before the quotation.
3212 If the string \fInoheading\fR is assigned to the \fIquote\fR variable,
3213 this heading is omitted.
3214 If the string \fIheaders\fR is assigned,
3215 the headers selected by the ignore/retain commands
3216 are printed above the message body,
3217 thus \fIquote\fR acts like an automatic ~m command then.
3218 If the string \fIallheaders\fR is assigned,
3219 all headers are printed above the message body,
3220 and all MIME parts are included,
3221 thus \fIquote\fR acts like an automatic ~M command then.
3223 .B quote-fold
3224 If set in addition to \fIindentprefix\fR, \fIs-nail\fR interprets this
3225 number as the maximum line length of the quotation when replying to a
3226 message.
3227 Setting this turns on a more fancy quotation algorithm in that leading
3228 quotation characters are compressed and overlong lines are folded to
3229 \fIquote-fold\fR characters each, breaking at whitespace as necessary
3230 and starting the follow lines with fillers to pad up to the last
3231 quotation markers width.
3232 The value of \fIquote-fold\fR can't be smaller than the length of
3233 \fIindentprefix\fR plus some additional pad.  It is automatically
3234 adjusted to the minimum as necessary.
3236 .B record
3237 If defined, gives the pathname of the folder
3238 used to record all outgoing mail.
3239 If not defined,
3240 then outgoing mail is not so saved.
3241 When saving to this folder fails,
3242 the message is not sent
3243 but saved to the `dead.letter' file instead.
3245 .B replyto
3246 A list of addresses to put into the \fI`Reply-To:'\fR field
3247 of the message header.
3248 If replying to a message, such addresses are handled
3249 as if they were in the alternates list.
3251 .B screen
3252 When \fIs-nail\fR initially prints the message headers,
3253 it determines the number to print
3254 by looking at the speed of the terminal.
3255 The faster the terminal, the more it prints.
3256 This option overrides this calculation
3257 and specifies how many message headers
3258 are printed.
3259 This number is also used
3260 for scrolling with the z command.
3262 .B sendcharsets
3263 A comma-separated list of character set names
3264 that can be used in Internet mail.
3265 When a message that contains characters not representable in US-ASCII
3266 is prepared for sending,
3267 .I s-nail
3268 tries to convert its text
3269 to each of the given character sets in order
3270 and uses the first appropriate one.
3271 The default is `utf-8'.
3273 Character sets assigned to this variable should be ordered
3274 in ascending complexity.
3275 That is, the list should start with e.\|g.
3276 `iso-8859-1' for compatibility with older mail clients,
3277 might contain some other language-specific character sets,
3278 and should end with `utf-8'
3279 to handle messages that combine texts in multiple languages.
3281 .B sender
3282 An address that is put into the `Sender:' field
3283 of outgoing messages.
3284 This field needs not normally be present.
3285 It is, however, required
3286 if the `From:' field contains more than one address.
3287 It can also be used to indicate that a message
3288 was sent on behalf of somebody other;
3289 in this case, `From:' should contain the address
3290 of the person that took responsibility for the message,
3291 and `Sender:' should contain the address
3292 of the person that actually sent the message.
3294 .I sender
3295 address is handled as if it were in the
3296 .I alternates
3297 list.
3299 .B sendmail
3300 To use an alternate mail delivery system,
3301 set this option to the full pathname
3302 of the program to use.
3303 This should be used with care.
3305 .B SHELL
3306 Pathname of the shell to use
3307 in the ! command and the ~! escape.
3308 A default shell is used
3309 if this option is not defined.
3312 .B Sign
3313 A string for use with the
3314 .I ~A
3315 command.
3317 .B sign
3318 A string for use with the
3319 .I ~a
3320 command.
3322 .B signature
3323 Must correspond to the name of a readable file if set.
3324 The file's content is then appended to each singlepart message
3325 and to the first part of each multipart message.
3326 Be warned that there is no possibility
3327 to edit the signature for an individual message.
3329 .B smime-ca-dir
3330 Specifies a directory with CA certificates for verification
3331 of S/MIME signed messages.
3332 The format is the same as described in
3333 .IR SSL_CTX_load_verify_locations (3).
3334 Only applicable if S/MIME support is built using OpenSSL.
3336 .B smime-ca-file
3337 Specifies a file with CA certificates for verification
3338 of S/MIME signed messages.
3339 The format is the same as described in
3340 .IR SSL_CTX_load_verify_locations (3).
3341 Only applicable if S/MIME support is built using OpenSSL.
3343 \fBsmime-cipher-\fIuser@host\fR
3344 Specifies a cipher to use when generating S/MIME encrypted messages
3346 .IR user@host .
3347 Valid ciphers are
3348 .B rc2-40
3349 (RC2 with 40 bits),
3350 .B rc2-64
3351 (RC2 with 64 bits),
3352 .B des
3353 (DES, 56 bits)
3355 .B des-ede3
3356 (3DES, 112/168 bits).
3357 The default is 3DES.
3358 It is not recommended to use the other ciphers
3359 unless a recipient's client is actually unable to handle 3DES
3360 since they are comparatively weak;
3361 but even so, the recipient should upgrade his software in preference.
3363 .B smime-crl-file
3364 Specifies a file that contains a CRL in PEM format
3365 to use when verifying S/MIME messages.
3366 Only applicable if S/MIME support is built using OpenSSL.
3368 .B smime-crl-dir
3369 Specifies a directory that contains files with CRLs in PEM format
3370 to use when verifying S/MIME messages.
3371 Only applicable if S/MIME support is built using OpenSSL.
3373 \fBsmime-encrypt-\fIuser@host\fR
3374 If this variable is set,
3375 messages to
3376 .I user@host
3377 are encrypted before sending.
3378 If S/MIME support is built using OpenSSL,
3379 the value of the variable must be set to the name of a file
3380 that contains a certificate in PEM format.
3381 If S/MIME support is built using NSS,
3382 the value of this variable is ignored,
3383 but if multiple certificates for
3384 .I user@host
3385 are available, the
3386 .I smime-nickname-user@host
3387 variable should be set.
3388 Otherwise a certificate for the recipient
3389 is automatically retrieved from the certificate database,
3390 if possible.
3392 If a message is sent to multiple recipients,
3393 each of them for whom a corresponding variable is set
3394 will receive an individually encrypted message;
3395 other recipients will continue to receive the message in plain text
3396 unless the
3397 .I smime-force-encryption
3398 variable is set.
3399 It is recommended to sign encrypted messages,
3400 i.\|e. to also set the
3401 .I smime-sign
3402 variable.
3404 \fBsmime-nickname-\fIuser@host\fR
3405 Specifies the nickname of a certificate
3406 to be used when encrypting messages for
3407 .I user@host .
3408 Only applicable if S/MIME support is built using NSS.
3410 .B smime-sign-cert
3411 Points to a file in PEM format
3412 that contains the user's private key
3413 as well as his certificate.
3414 Both are used with S/MIME
3415 for signing and decrypting messages.
3416 Only applicable if S/MIME support is built using OpenSSL.
3418 \fBsmime-sign-cert-\fIuser@host\fR
3419 Overrides
3420 .I smime-sign-cert
3421 for the specific addresses.
3422 When signing messages and the value of the
3423 .I from
3424 variable is set
3426 .IR user@host ,
3427 the specific file is used.
3428 When decrypting messages,
3429 their recipient fields (To: and Cc:) are searched for addresses
3430 for which such a variable is set.
3431 .I S-nail
3432 always uses the first address that matches,
3433 so if the same message is sent to more than one
3434 of the user's addresses using different encryption keys,
3435 decryption might fail.
3436 Only applicable if S/MIME support is built using OpenSSL.
3438 .B smime-sign-include-certs
3439 If used, this must be set to a comma-separated list of files,
3440 each of which containing a single certificate in PEM format
3441 to be included in the S/MIME message in addition to the
3442 .IR smime-sign-cert
3443 certificate.
3444 This is most useful for long certificate chains if it is
3445 desired to aid the receiving party's verification process.
3446 Only applicable if S/MIME support is built using OpenSSL.
3448 \fBsmime-sign-include-certs-\fIuser@host\fR
3449 Overrides
3450 .I smime-sign-include-certs
3451 for the specific addresses.
3452 Refer to the discussion of \fBsmime-sign-cert-\fIuser@host\fR
3453 for more on this topic.
3455 .B smime-sign-nickname
3456 Specifies that the named certificate be used for signing mail.
3457 If this variable is not set,
3458 but a single certificate matching the current
3459 .I from
3460 address is found in the database,
3461 that one is used automatically.
3462 Only applicable if S/MIME support is built using NSS.
3464 \fBsmime-sign-nickname-\fIuser@host\fR
3465 Overrides
3466 .I smime-sign-nickname
3467 for a specific address.
3468 Only applicable if S/MIME support is built using NSS.
3470 .B smtp
3471 Normally, \fIs-nail\fR invokes
3472 .IR sendmail (8)
3473 directly to transfer messages.
3474 If the \fIsmtp\fR variable is set, a SMTP connection to
3475 the server specified by the value of this variable
3476 is used instead.
3477 If the SMTP server does not use the standard port,
3478 a value of \fIserver:port\fR can be given,
3479 with \fIport\fR as a name or as a number.
3481 There are two possible methods to get SSL/TLS encrypted SMTP sessions:
3482 First, the STARTTLS command can be used to encrypt a session
3483 after it has been initiated,
3484 but before any user-related data has been sent; see
3485 .I \%smtp-use-starttls
3486 above.
3487 Second, some servers accept sessions that are encrypted
3488 from their beginning on. This mode is configured by assigning
3489 \fBsmtps://\fIserver\fR[\fB:\fIport\fR]
3490 to the
3491 .I smtp
3492 variable.
3494 The SMTP transfer is executed in a child process;
3495 unless either the
3496 .I sendwait
3497 or the
3498 .I verbose
3499 variable is set,
3500 this process runs asynchronously.
3501 If it receives a TERM signal,
3502 it will abort and save the message to the `dead.letter' file.
3504 .B smtp-auth
3505 Sets the SMTP authentication method.
3506 If set to `login',
3507 or if unset and smtp-auth-user is set,
3508 AUTH LOGIN is used.
3509 If set to `cram-md5',
3510 AUTH CRAM-MD5 is used;
3511 if set to `plain',
3512 AUTH PLAIN is used.
3513 Otherwise,
3514 no SMTP authentication is performed.
3516 \fBsmtp-auth-\fIuser\fB@\fIhost\fR
3517 Overrides
3518 .I smtp-auth
3519 for specific values of sender addresses,
3520 depending on the
3521 .I from
3522 variable.
3524 .B smtp-auth-password
3525 Sets the global password for SMTP AUTH.
3526 Both user and password have to be given
3527 for AUTH LOGIN and AUTH CRAM-MD5.
3529 \fBsmtp-auth-password-\fIuser\fB@\fIhost\fR
3530 Overrides
3531 .I smtp-auth-password
3532 for specific values of sender addresses,
3533 depending on the
3534 .I from
3535 variable.
3537 .B smtp-auth-user
3538 Sets the global user name for SMTP AUTH.
3539 Both user and password have to be given
3540 for AUTH LOGIN and AUTH CRAM-MD5.
3542 If this variable is set but neither
3543 .I smtp-auth-password
3544 or a matching
3545 .I smtp-auth-password-user@host
3546 can be found,
3547 .I s-nail
3548 will as for a password on the user's terminal.
3550 \fBsmtp-auth-user-\fIuser\fB@\fIhost\fR
3551 Overrides
3552 .I smtp-auth-user
3553 for specific values of sender addresses,
3554 depending on the
3555 .I from
3556 variable.
3558 .B ssl-ca-dir
3559 Specifies a directory with CA certificates for verification
3560 of SSL/TLS server certificates.
3562 .IR SSL_CTX_load_verify_locations (3)
3563 for more information.
3564 Only applicable if SSL/TLS support is built using OpenSSL.
3566 .B ssl-ca-file
3567 Specifies a file with CA certificates for verification
3568 of SSL/TLS server certificates.
3570 .IR SSL_CTX_load_verify_locations (3)
3571 for more information.
3572 Only applicable if SSL/TLS support is built using OpenSSL.
3574 .B ssl-cert
3575 Sets the file name 
3576 for a SSL/TLS client certificate
3577 required by some servers.
3578 Only applicable if SSL/TLS support is built using OpenSSL.
3580 \fBssl-cert-\fIuser\fB@\fIhost\fR
3581 Sets an account-specific file name
3582 for a SSL/TLS client certificate
3583 required by some servers.
3584 Overrides
3585 .I ssl-cert
3586 for the specified account.
3587 Only applicable if SSL/TLS support is built using OpenSSL.
3589 .B ssl-cipher-list
3590 Specifies a list of ciphers for SSL/TLS connections.
3591 See ciphers(1) for more information.
3592 Only applicable if SSL/TLS support is built using OpenSSL.
3594 .B ssl-crl-file
3595 Specifies a file that contains a CRL in PEM format
3596 to use when verifying SSL/TLS server certificates.
3597 Only applicable if SSL/TLS support is built using OpenSSL.
3599 .B ssl-crl-dir
3600 Specifies a directory that contains files with CRLs in PEM format
3601 to use when verifying SSL/TLS server certificates.
3602 Only applicable if SSL/TLS support is built using OpenSSL.
3604 .B ssl-key
3605 Sets the file name
3606 for the private key of a SSL/TLS client certificate.
3607 If unset, the name of the certificate file is used.
3608 The file is expected to be in PEM format.
3609 Only applicable if SSL/TLS support is built using OpenSSL.
3611 \fBssl-key-\fIuser\fB@\fIhost\fR
3612 Sets an account-specific file name
3613 for the private key of a SSL/TLS client certificate.
3614 Overrides
3615 .I ssl-key
3616 for the specified account.
3617 Only applicable if SSL/TLS support is built using OpenSSL.
3619 .B ssl-method
3620 Selects a SSL/TLS protocol version;
3621 valid values are `ssl2', `ssl3', and `tls1'.
3622 If unset, the method is selected automatically,
3623 if possible.
3625 \fBssl-method-\fIuser\fB@\fIhost\fR
3626 Overrides
3627 .I ssl-method
3628 for a specific account.
3630 .B ssl-rand-egd
3631 Gives the pathname to an entropy daemon socket,
3633 .IR RAND_egd (3).
3635 .B ssl-rand-file
3636 Gives the pathname to a file with entropy data,
3638 .IR RAND_load_file (3).
3639 If the file is a regular file writable by the invoking user,
3640 new data is written to it after it has been loaded.
3641 Only applicable if SSL/TLS support is built using OpenSSL.
3643 .B ssl-verify
3644 Sets the action to be performed if an error occurs
3645 during SSL/TLS server certificate validation.
3646 Valid values are
3647 `strict' (fail and close connection immediately),
3648 `ask' (ask whether to continue on standard input),
3649 `warn' (print a warning and continue),
3650 `ignore' (do not perform validation).
3651 The default is `ask'.
3653 \fBssl-verify-\fIuser\fB@\fIhost\fR
3654 Overrides
3655 .I ssl-verify
3656 for a specific account.
3658 .B toplines
3659 If defined, gives the number of lines
3660 of a message to be printed out
3661 with the top command;
3662 normally, the first five
3663 lines are printed.
3665 .B ttycharset
3666 The character set of the terminal \fIs-nail\fR operates on.
3667 There is normally no need to set this variable
3668 since \fIs-nail\fR can determine this automatically
3669 by looking at the LC_CTYPE locale setting;
3670 if this succeeds, the value is assigned at startup
3671 and will be displayed by the \fIset\fP command.
3672 Note that this is not necessarily a character set name
3673 that can be used in Internet messages.
3675 .B VISUAL
3676 Pathname of the text editor to use
3677 in the visual command and ~v escape.
3678 .SH ENVIRONMENT VARIABLES
3679 Besides the variables described above, \fIs-nail\fR uses
3680 the following environment strings:
3682 .B HOME
3683 The user's home directory.
3685 \fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR
3687 .IR locale (7).
3689 .B MAILRC
3690 Is used as startup file instead of ~/.mailrc if set.
3691 When
3692 .I s-nail
3693 scripts are invoked on behalf of other users,
3694 this variable should be set to `/dev/null'
3695 to avoid side-effects from reading their configuration files.
3697 .B SNAILRC
3698 If this variable is set and
3699 .I MAILRC
3700 is not set,
3701 it is read as startup file.
3703 .B SYSV3
3704 Changes the letters printed in the first column of a header summary.
3706 .B TMPDIR
3707 Used as directory for temporary files instead of /tmp, if set.
3708 .SH FILES
3710 ~/.mailrc
3711 File giving initial commands.
3713 /etc/s-nail.rc
3714 System wide initialization file.
3716 ~/.mime.types
3717 Personal MIME types.
3719 /etc/mime.types
3720 System wide MIME types.
3721 .SH EXAMPLES
3722 .SS "Getting started"
3724 .I s-nail
3725 command has two distinct usages, according to whether one
3726 wants to send or receive mail.
3727 Sending mail is simple: to send a
3728 message to a user whose email address is, say,
3729 <bill@host.example>,
3730 use the shell
3731 command:
3734     $ \fBs-nail\fI bill@host.example\fR
3737 then type your message.
3738 .I S-nail
3739 will prompt you for a message
3740 .I subject 
3741 first;
3742 after that, lines typed by you form the body of the message.
3743 When you reach the end of the message, type
3744 an EOT (control\-d) at the beginning of a line, which will cause
3745 .I s-nail
3746 to echo `EOT' and return you to the shell.
3748 If, while you are composing the message
3749 you decide that you do not wish to send it after all, you can
3750 abort the letter with a \s-2RUBOUT\s0.  Typing a single \s-2RUBOUT\s0
3751 causes
3752 .I s-nail
3753 to print `(Interrupt -- one more to kill letter)'.
3754 Typing a second
3755 \s-2RUBOUT\s0 causes
3756 .I s-nail
3757 to save your partial letter on the file `dead.letter'
3758 in your home directory and abort the letter.
3759 Once you have
3760 sent mail to someone, there is no way to undo the act, so be
3761 careful.
3763 If you want to send the same message to several other people,
3764 you can list their email addresses on the command line.
3765 Thus,
3768     $ \fBs-nail\fI sam@workstation.example bob@server.example\fR
3769     Subject: Fees
3770     Tuition fees are due next Friday.  Don't forget!
3771     <Control\-d>
3772     EOT
3773     $
3776 will send the reminder to \fI<sam@workstation.example>\fR.
3778 \fI<bob@server.example>\fR.
3780 To read your mail, simply type
3783     $ \fBs-nail\fR
3786 .I S-nail
3787 will respond by typing its version number and date and then listing
3788 the messages you have waiting.
3789 Then it will type a prompt and await your command.
3790 The messages are assigned numbers starting with 1\(emyou
3791 refer to the messages with these numbers.
3792 .I S-nail
3793 keeps track of which messages are
3794 .I new
3795 (have been sent since you last read your mail) and
3796 .I read
3797 (have been read by you).  New messages have an
3798 .B N
3799 next to them in the header listing and old, but unread messages have
3801 .B U
3802 next to them.
3803 .I S-nail
3804 keeps track of new/old and read/unread messages by putting a
3805 header field called
3806 .I Status
3807 into your messages.
3809 To look at a specific message, use the
3810 .I type
3811 command, which may be abbreviated to simply
3812 .I t .
3813 For example, if you had the following messages:
3816     O 1 drfoo@myhost.example Wed Sep  1 19:52  18/631 "Fees"
3817     O 2 sam@friends.example  Thu Sep  2 00:08  30/895
3820 you could examine the first message by giving the command:
3823     \fBtype\fR 1
3826 which might cause
3827 .B s-nail
3828 to respond with, for example:
3831     Message  1:
3832     From drfoo@myhost.example Wed Sep  1 19:52:25 2004
3833     Subject: Fees
3834     Status: R
3836     Tuition fees are due next Wednesday.  Don't forget!
3840 Many
3841 .I s-nail
3842 commands that operate on messages take a message number as an
3843 argument like the
3844 .I type
3845 command.
3846 For these commands, there is a notion of a current message.
3847 When you enter the
3848 .I s-nail
3849 program, the current message is initially the first
3850 (or the first recent) one.
3851 Thus, you can often omit the message number and use, for example,
3854     \fBt\fR
3857 to type the current message.
3858 As a further shorthand, you can type a message
3859 by simply giving its message number.
3860 Hence,
3863     1
3866 would type the first message.
3868 Frequently, it is useful to read the messages in your mailbox in order,
3869 one after another.
3870 You can read the next message in
3871 .I s-nail
3872 by simply typing a newline.
3873 As a special case, you can type a newline as your first command to
3874 .I s-nail
3875 to type the first message.
3877 If, after typing a message, you wish to immediately send a reply,
3878 you can do so with the
3879 .I reply
3880 command.
3881 This command,
3882 like
3883 .IR type ,
3884 takes a message number as an argument.
3885 .I s-nail
3886 then begins a message addressed to the user who sent you the message.
3887 You may then type in your letter in reply, followed by a <control-d>
3888 at the beginning of a line, as before.
3890 Note that
3891 .I s-nail
3892 copies the subject header from the original message.
3893 This is useful in that correspondence
3894 about a particular matter will tend to retain the same subject heading,
3895 making it easy to recognize.
3896 If there are other header fields in the message,
3897 like `Cc:',
3898 the information found will also be used.
3900 Sometimes you will receive a message that has been sent to
3901 several people and wish to reply only
3902 to the person who sent it.
3903 .I Reply
3904 with a capital
3905 .I R
3906 replies to a message, but sends a copy to the sender only.
3908 If you wish, while reading your mail, to send a message to someone,
3909 but not as a reply to one of your messages, you can send the message
3910 directly with the
3911 .I mail
3912 command, which takes as arguments the names of the recipients you wish
3913 to send to.
3914 For example, to send a message to <frank@machine.example>,
3915 you would do:
3918     \fBmail\fI frank@machine.example\fR
3921 To delete a message from the mail folder,
3922 you can use the
3923 .I delete
3924 command.
3925 In addition to not saving deleted messages,
3926 .I s-nail
3927 will not let you type them, either.
3928 The effect is to make the message disappear
3929 altogether, along with its number.
3931 Many features of
3932 .I s-nail
3933 can be tailored to your liking with the
3934 .I set
3935 command.
3937 .I set
3938 command has two forms, depending on whether you are setting a
3939 .I binary
3940 option or a
3941 .I valued
3942 option.
3943 Binary options are either on or off.  For example, the
3944 .I askcc
3945 option informs
3946 .I s-nail
3947 that each time you send a message, you want it to prompt you for
3948 a `Cc:' header,
3949 to be included in the message.
3950 To set the
3951 .I askcc
3952 option, you would type
3955     \fBset\fR askcc
3958 Valued options are values which
3959 .I s-nail
3960 uses to adapt to your tastes.
3961 For example, the
3962 .I record
3963 option tells
3964 .I s-nail
3965 where to save messages sent by you,
3966 and is specified by
3969     \fBset\fR record=Sent
3972 for example.
3973 Note that no spaces are allowed in
3974 .I "set record=Sent".
3976 .I S-nail
3977 includes a simple facility for maintaining groups of messages together
3978 in folders.
3979 To use the folder facility, you must tell
3980 .I s-nail
3981 where you wish to keep your folders.
3982 Each folder of messages will be a single file.
3983 For convenience, all of your folders are kept in
3984 a single directory of your choosing.
3985 To tell
3986 .I s-nail
3987 where your folder directory is, put a line of the form
3990     \fBset folder=\fIletters\fR
3993 in your
3994 .I .mailrc
3995 file.
3996 If, as in the example above,
3997 your folder directory does not begin with a `/',
3998 .I s-nail
3999 will assume that your folder directory is to be found starting from
4000 your home directory.
4002 Anywhere a file name is expected, you can use a folder name, preceded
4003 with `+'.
4004 For example, to put a message into a folder with the
4005 .I save
4006 command, you can use:
4009     \fBsave +\fIclasswork\fR
4012 to save the current message in the
4013 .I classwork
4014 folder.
4015 If the
4016 .I classwork
4017 folder does not yet exist, it will be created.
4018 Note that messages which are saved with the
4019 .I save
4020 command are automatically removed from your system mailbox.
4022 In order to make a copy of a message in a folder without causing
4023 that message to be removed from your system mailbox, use the
4024 .I copy
4025 command, which is identical in all other respects to the
4026 .I save
4027 command.
4030 .I folder
4031 command
4032 can be used to direct
4033 .I s-nail
4034 to the contents of a different folder.
4035 For example,
4038     \fBfolder +\fIclasswork\fR
4041 directs
4042 .I s-nail
4043 to read the contents of the
4044 .I classwork
4045 folder.
4046 All of the commands that you can use on your system
4047 mailbox are also applicable to folders, including
4048 .IR type ,
4049 .IR delete ,
4051 .IR reply .
4052 To inquire which folder you are currently editing, use simply:
4055     \fBfolder\fR
4058 To list your current set of folders, use the
4059 .I folders
4060 command.
4062 Finally, the
4063 .I help
4064 command is available to print out a brief summary of the most important
4065 .I s-nail
4066 commands.
4068 While typing in a message to be sent to others, it is often
4069 useful to be able to invoke the text editor on the partial message,
4070 print the message, execute a shell command, or do some other
4071 auxiliary function. 
4072 .I S-nail
4073 provides these capabilities through
4074 .I "tilde escapes" ,
4075 which consist of a tilde (~) at the beginning of a line, followed by
4076 a single character which indicates the function to be performed.
4077 For example, to print the text of the message so far, use:
4080     \fB~p\fR
4083 which will print a line of dashes, the recipients of your message, and
4084 the text of the message so far.
4085 A list of the most important tilde escapes is available with `~?'.
4086 .SS "IMAP or POP3 client setup"
4087 First you need the following data from your ISP:
4088 the host name of the IMAP or POP3 server,
4089 user name and password for this server,
4090 and a notice whether the server uses SSL/TLS encryption.
4091 Assuming the host name is `server.myisp.example'
4092 and your user name for that server is `mylogin',
4093 you can refer to this account using the
4094 .I folder
4095 command or
4096 .I \-f
4097 command line option with
4100     \fBimaps://\fImylogin\fB@\fIserver.myisp.example\fR
4103 (This string is not necessarily the same as your Internet mail address.)
4104 You can replace `imaps://' with `imap://'
4105 if the server does not support SSL/TLS.
4106 (If SSL/TLS support is built using NSS, the
4107 .I nss-config-dir
4108 variable must be set before a connection can be initiated,
4109 see above).
4110 Use `pop3s://' or `pop3://' if the server does not offer IMAP.
4111 You should use IMAP if you can, though;
4112 first because it requires fewer network operations than POP3
4113 to get the contents of the mailbox
4114 and is thus faster;
4115 and second because message attributes
4116 are maintained by the IMAP server,
4117 so you can easily distinguish new and old messages
4118 each time you connect.
4119 Even if the server does not accept IMAPS or POP3S connections,
4120 it is possible that it supports the STARTTLS method
4121 to make a session SSL/TLS encrypted
4122 after the initial connection has been performed,
4123 but before authentication begins.
4124 The only reliable method to see if this works is to try it; enter one of
4127     \fBset imap-use-starttls\fR
4128     \fBset pop3-use-starttls\fR
4131 before you initiate the connection.
4133 As you probably want messages to be deleted from this account
4134 after saving them,
4135 prefix it with `\fI%:\fR'.
4137 .I shortcut
4138 command can be used to avoid typing that many characters
4139 every time you want to connect:
4142     \fBshortcut \fImyisp\fB \fB%:imaps://\fImylogin\fB@\fIserver.myisp.example\fR
4145 You might want to put this string into a startup file.
4146 As the
4147 .I shortcut
4148 command is specific to this implementation of
4149 .I s-nail
4150 and will confuse other implementations,
4151 it should not be used in
4152 .IR ~/.mailrc ,
4153 instead, put
4156     \fBset SNAIL_EXTRA_RC=\fI~/.s-nailrc\fR
4160 .I ~/.mailrc
4161 and create a file
4162 .I ~/.s-nailrc
4163 containing the
4164 .I shortcut
4165 command above.
4166 You can then access your remote mailbox by invoking
4167 `s-nail \-f \fImyisp\fR' on the command line,
4168 or by executing `fi \fImyisp\fR' within s-nail.
4170 If you want to use more than one IMAP mailbox on a server,
4171 or if you want to use the IMAP server for mail storage too,
4173 .I account
4174 command
4175 (which is also \fIs-nail-\fRspecific)
4176 is more appropriate than the
4177 .I shortcut
4178 command.
4179 You can put the following in
4180 .IR ~/.s-nailrc :
4183     \fBaccount \fImyisp \fB{\fR
4184         \fBset folder=imaps://\fImylogin\fB@\fIserver.myisp.example\fR
4185         \fBset record=+\fISent \fBMBOX=+\fImbox \fBoutfolder\fR
4186     \fB}\fR
4189 and can then access incoming mail for this account by invoking
4190 `s-nail \-A \fImyisp\fR' on the command line,
4191 or by executing `ac \fImyisp\fR' within s-nail.
4192 After that,
4193 a command like `copy \fI1\fR +\fIotherfolder\fR'
4194 will refer to \fIotherfolder\fR on the IMAP server.
4195 In particular,
4196 `fi &' will change to the
4197 .I mbox
4198 folder,
4200 `fi +Sent' will show your recorded sent mail,
4201 with both folders located on the IMAP server.
4203 .I S-nail
4204 will ask you for a password string
4205 each time you connect to a remote account.
4206 If you can reasonably trust the security
4207 of your workstation,
4208 you can give this password in the startup file as
4211     \fBset password-\fImylogin\fB@\fIserver.myisp.example\fB="\fISECRET\fB"\fR
4214 You should change the permissions of this file to 0600, see
4215 .IR chmod (1).
4217 .I S-nail
4218 supports different authentication methods for both IMAP and POP3.
4219 If Kerberos is used at your location,
4220 you can try to activate GSSAPI-based authentication by
4223     \fBset imap-auth=gssapi\fR
4226 The advantage of this method is that
4227 .I s-nail
4228 does not need to know your password at all,
4229 nor needs to send sensitive data over the network.
4230 Otherwise, the options
4233     \fBset imap-auth=cram-md5\fR
4234     \fBset pop3-use-apop\fR
4237 for IMAP and POP3, respectively,
4238 offer authentication methods
4239 that avoid to send the password in clear text over the network,
4240 which is especially important if SSL/TLS cannot be used.
4241 If the server does not offer any of these authentication methods,
4242 conventional user/password based authentication must be used.
4243 It is sometimes helpful to set the
4244 .I verbose
4245 option when authentication problems occur.
4246 .I S-nail
4247 will display all data sent to the server in clear text on the screen
4248 with this option,
4249 including passwords.
4250 You should thus take care that no unauthorized person
4251 can look at your terminal when this option is set.
4253 If you regularly use the same workstation
4254 to access IMAP accounts,
4255 you can greatly enhance performance
4256 by enabling local caching of IMAP messages.
4257 For any message that has been fully or partially fetched from the server,
4258 a local copy is made and is used when the message is accessed again,
4259 so most data is transferred over the network once only.
4260 To enable the IMAP cache,
4261 select a local directory name and put
4264     \fBset imap-cache=\fI~/localdirectory\fR
4267 in the startup file.
4268 All files within that directory
4269 can be overwritten or deleted by \fIs-nail\fR at any time,
4270 so you should not use the directory to store other information.
4272 Once the cache contains some messages,
4273 it is not strictly necessary anymore
4274 to open a connection to the IMAP server
4275 to access them.
4276 When \fIs-nail\fR is invoked with the \fI\-D\fR option,
4277 or when the
4278 .I disconnected
4279 variable is set,
4280 only cached data is used
4281 for any folder you open.
4282 Messages that have not yet been completely cached
4283 are not available then,
4284 but all other messages can be handled
4285 as usual.
4286 Changes made to IMAP mailboxes in
4287 .I disconnected
4288 mode are committed to the IMAP server
4289 next time it is used in
4290 .I online
4291 mode.
4292 Synchronizing the local status
4293 with the status on the server
4294 is thus partially within your responsibility;
4295 if you forget to initiate a connection to the server again
4296 before you leave your location,
4297 changes made on one workstation
4298 are not available on others.
4299 Also if you alter IMAP mailboxes from a workstation
4300 while uncommitted changes are still pending on another,
4301 the latter data may become invalid.
4302 The same might also happen because of internal server status changes.
4303 You should thus carefully evaluate this feature in your environment
4304 before you rely on it.
4306 Many servers will close the connection
4307 after a short period of inactivity. Use one of
4310     \fBset pop3-keepalive=\fI30\fR
4311     \fBset imap-keepalive=\fI240\fR
4314 to send a keepalive message each 30 seconds for POP3,
4315 or each 4 minutes for IMAP.
4317 If you encounter problems connecting to a SSL/TLS server,
4318 try the
4319 .I ssl-rand-egd
4321 .I ssl-rand-file
4322 variables (see the OpenSSL FAQ for more information)
4323 or specify the protocol version with
4324 .IR ssl-method .
4325 Contact your ISP
4326 if you need a client certificate
4327 or if verification of the server certificate fails.
4328 If the failed certificate is indeed valid,
4329 fetch its CA certificate by executing the shell command
4332     $ \fBopenssl s_client </dev/null \-showcerts \-connect \e
4333            \fIserver.myisp.example\fB:\fIimaps\fB 2>&1 | tee \fIlog\fR
4336 (see
4337 .IR s_client (1))
4338 and put it into the file specified with
4339 .IR ssl-ca-file .
4340 The data you need is located at the end of the certificate chain
4341 within (and including) the `BEGIN CERTIFICATE'
4342 and `END CERTIFICATE' lines.
4343 (Note that it is possible to fetch
4344 a forged certificate by this method.
4345 You can only completely rely
4346 on the authenticity of the CA certificate
4347 if you fetch it in a way that is trusted by other means,
4348 such as by personally receiving the certificate on storage media.)
4349 .SS "Creating a score file or message filter"
4350 The scoring commands are best separated
4351 from other configuration for clarity,
4352 and are mostly
4353 .I s-nail
4354 specific.
4355 It is thus recommended to put them in a separate file
4356 that is sourced from your SNAIL_EXTRA_RC as follows:
4359     \fBsource\fI ~/.scores\fR
4362 The \fI.scores\fR file could then look as follows:
4365     \fBdefine\fR \fIlist\fR {
4366         \fBscore\fR (subject "important discussion") +10
4367         \fBscore\fR (subject "annoying discussion") \-10
4368         \fBscore\fR (from "nicefellow@goodnet") +15
4369         \fBscore\fR (from "badguy@poornet") \-5
4370         \fBmove\fR (header x-spam-flag "+++++") \fI+junk\fR
4371     }
4372     \fBset folder-hook-\fRimap://user@host/public.list=\fIlist\fR
4375 In this scheme,
4376 you would see any mail from `nicefellow@goodnet',
4377 even if the surrounding discussion is annoying;
4378 but you normally would not see mail from `badguy@poornet',
4379 unless he participates in the important discussion.
4380 Messages that are marked with five or more plus characters
4381 in their `X-Spam-Flag' field
4382 (inserted by some server-side filtering software)
4383 are moved to the folder `junk' in the
4384 .I folder
4385 directory.
4387 Be aware that all criteria in (\|) lead to substring matches,
4388 so you would also score messages
4389 from e.\|g. `notsobadguy@poornetmakers' negative here.
4390 It is possible to select addresses exactly using \fI"address"\fR
4391 message specifications,
4392 but these cannot be executed remotely 
4393 and will thus cause all headers
4394 to be downloaded from IMAP servers while looking for matches.
4396 When searching messages on an IMAP server,
4397 best performance is usually achieved
4398 by sending as many criteria as possible
4399 in one large (\|) specification,
4400 because each single such specification
4401 will result in a separate network operation.
4402 .SS "Activating the Bayesian filter"
4403 The Bayesian junk mail filter works
4404 by examining the words contained in messages.
4405 You decide yourself what a good and what a bad message is.
4406 Thus the resulting filter is your very personal one;
4407 once it is correctly set up,
4408 it will filter only messages similar to those
4409 previously specified by you.
4411 To use the Bayesian filter,
4412 a location for the junk mail database must be defined first:
4415     \fBset junkdb=\fI~/.junkdb\fR
4418 The junk mail database does not contain
4419 actual words extracted from messages,
4420 but hashed representations of them.
4421 A foreign person who can read the database
4422 could only examine the frequency of previously known words
4423 in your mail.
4425 If you have sufficient disk space (several 10\ MB) available,
4426 it is recommended that you set the
4427 .I chained-junk-tokens
4428 option.
4429 The filter will then also consider two-word tokens,
4430 improving its accuracy.
4432 A set of good messages and junk messages must now be available;
4433 it is also possible to use the incoming new messages for this purpose,
4434 although it will of course take some time
4435 until the filter becomes useful then.
4436 Do not underestimate the amount of statistical data needed;
4437 some hundred messages are typically necessary
4438 to get satisfactory results,
4439 and many thousand messages for best operation.
4440 You have to pass the good messages to the
4441 .I good
4442 command,
4443 and the junk messages to the
4444 .I junk
4445 command.
4446 If you ever accidentally mark a good message as junk or vice-versa,
4447 call the
4448 .I ungood
4450 .I unjunk
4451 command to correct this.
4453 Once a reasonable amount of statistics has been collected,
4454 new messages can be classified automatically.
4456 .I classify
4457 command marks all messages that the filter considers to be junk,
4458 but it does not perform any action on them by default.
4459 It is recommended that you move these messages into a separate
4460 folder just for the case that false positives occur,
4461 or to pass them to the
4462 .I junk
4463 command later again to further improve the junk mail database.
4464 To automatically move incoming junk messages
4465 every time the inbox is opened,
4466 put lines like the following into your
4467 .I .scores
4468 file (or whatever name you gave to the file in the last example):
4471     \fBdefine\fR \fIjunkfilter\fR {
4472         \fBclassify (smaller \fI20000\fB) :n\fR
4473         \fBmove :j\fR \fI+junk\fR
4474     }
4475     \fBset folder-hook-\fRimap://user@host/INBOX=\fIjunkfilter\fR
4478 If you set the
4479 .I verbose
4480 option before running the
4481 .I classify
4482 command,
4483 .I s-nail
4484 prints the words it uses for calculating the junk status
4485 along with their statistical probabilities.
4486 This can help you to find out
4487 why some messages are not classified
4488 as you would like them to be.
4489 To see the statistical probability of a given word,
4490 use the
4491 .I probability
4492 command.
4494 If a junk message was not recognized as such,
4495 use the
4496 .I junk
4497 command to correct this.
4498 Also if you encounter a false positive
4499 (a good message that was wrongly classified as junk),
4500 pass it to the
4501 .I good
4502 command.
4504 Since the
4505 .I classify
4506 command must examine the entire text
4507 of all new messages in the respective folder,
4508 this will also cause all of them to be downloaded from the IMAP server.
4509 You should thus restrict the size of messages for automatic filtering.
4510 If server-based filtering is also available,
4511 you might try if that works for you first.
4512 .SS "Reading HTML mail"
4513 You need either the
4514 .I w3m
4516 .I lynx
4517 utility
4518 or another command-line web browser
4519 that can write plain text to standard output.
4522     \fBset pipe-text/html=\fR"w3m -dump -T text/html"
4528     \fBset pipe-text/html=\fR"lynx -dump -force_html /dev/stdin"
4531 will then cause HTML message parts to be converted into a more friendly form.
4532 .SS "Viewing PDF attachments"
4533 Most PDF viewers do not accept input directly from a pipe.
4534 It is thus necessary to store the attachment in a temporary file, as with
4537     \fBset pipe-application/pdf=\fR"cat >/tmp/s-nail$$.pdf; \e
4538            acroread /tmp/s-nail$$.pdf; rm /tmp/s-nail$$.pdf"
4541 Note that security defects are discovered in PDF viewers
4542 from time to time.
4543 Automatical command execution like this
4544 can compromise your system security,
4545 in particular if you stay not always informed
4546 about such issues.
4547 .SS "Signed and encrypted messages with S/MIME"
4548 S/MIME provides two central mechanisms:
4549 message signing and message encryption.
4550 A signed message contains some data in addition
4551 to the regular text.
4552 The data can be used to verify
4553 that the message was sent using a valid certificate,
4554 that the sender's address in the message header
4555 matches that in the certificate,
4556 and that the message text has not been altered.
4557 Signing a message does not change its regular text;
4558 it can be read regardless of whether the recipient's software
4559 is able to handle S/MIME.
4560 It is thus usually possible to sign all outgoing messages
4561 if so desired.\(emEncryption, in contrast,
4562 makes the message text invisible for all people
4563 except those who have access to the secret decryption key.
4564 To encrypt a message,
4565 the specific recipient's public encryption key must be known.
4566 It is thus not possible to send encrypted mail to people
4567 unless their key has been retrieved
4568 from either previous communication or public key directories.
4569 A message should always be signed before it is encrypted.
4570 Otherwise, it is still possible that the encrypted message text
4571 is altered.
4573 A central concept to S/MIME is that of the certification authority (CA).
4574 A CA is a trusted institution that issues certificates.
4575 For each of these certificates,
4576 it can be verified that it really originates from the CA,
4577 provided that the CA's own certificate is previously known.
4578 A set of CA certificates is usually delivered with OpenSSL
4579 and installed on your system.
4580 If you trust the source of your OpenSSL software installation,
4581 this offers reasonable security for S/MIME on the Internet.
4582 In general, a certificate cannot be more secure
4583 than the method its CA certificate has been retrieved with, though.
4584 Thus if you download a CA certificate from the Internet,
4585 you can only trust the messages you verify using that certificate
4586 as much as you trust the download process.
4588 The first thing you need for participating in S/MIME message exchange
4589 is your personal certificate,
4590 including a private key.
4591 The certificate contains public information,
4592 in particular your name and your email address,
4593 and the public key that is used by others
4594 to encrypt messages for you,
4595 and to verify signed messages they supposedly received from you.
4596 The certificate is included in each signed message you send.
4597 The private key must be kept secret.
4598 It is used to decrypt messages that were
4599 previously encrypted with your public key,
4600 and to sign messages.
4602 For personal use,
4603 it is recommended that you get a S/MIME certificate
4604 from one of the major CAs on the Internet using your WWW browser.
4605 (Many CAs offer such certificates for free.)
4606 You will usually receive
4607 a combined certificate and private key
4608 in PKCS#12 format which
4609 .I s-nail
4610 does not directly accept
4611 if S/MIME support is built using OpenSSL.
4612 To convert it to PEM format,
4613 use the following shell command:
4616     $ \fBopenssl pkcs12 \-in \fIcert.p12\fB \-out \fIcert.pem\fB \-clcerts \e
4617         \-nodes\fR
4620 If you omit the
4621 .I \-nodes
4622 parameter,
4623 you can specifiy an additional
4624 .I "PEM pass phrase"
4625 for protecting the private key.
4626 .I S-nail
4627 will then ask you for that pass phrase
4628 each time it signs or decrypts a message.
4629 You can then use
4632     \fBset smime-sign-cert-\fImyname@myisp.example\fB=\fIcert.pem\fR
4635 to make this private key and certificate known to
4636 .IR s-nail .
4638 If S/MIME support is built using NSS,
4639 the PKCS#12 file must be installed using Mozilla
4640 (provided that
4641 .I nss-config-dir
4642 is set appropriately,
4643 see above),
4644 and no further action is necessary
4645 unless multiple user certificates
4646 for the same email address are installed.
4647 In this case,
4649 .I smime-sign-nickname
4650 variable has to be set appropriately.
4652 You can now sign outgoing messages.
4653 Just use
4656     \fBset smime-sign\fR
4659 to do so.
4661 From each signed message you send,
4662 the recipient can fetch your certificate
4663 and use it to send encrypted mail back to you.
4664 Accordingly if somebody sends you a signed message,
4665 you can do the same.
4666 First use the
4667 .I verify
4668 command to check the validity of the certificate.
4669 After that,
4670 retrieve the certificate and tell
4671 .I s-nail
4672 that it should use it for encryption:
4675     \fBcertsave\fI filename\fR
4676     \fBset smime-encrypt-\fIuser@host\fB=\fIfilename\fR
4679 If S/MIME support is built using NSS,
4680 the saved certificate must be installed using Mozilla.
4681 The value of the
4682 .I smime-encrypt-user@host
4683 is ignored then,
4684 but if multiple certificates for the recipient are available,
4686 .I smime-nickname-user@host
4687 variable must be set.
4689 You should carefully consider
4690 if you prefer to store encrypted messages in decrypted form.
4691 If you do, anybody who has access to your mail folders can read them,
4692 but if you do not,
4693 you might be unable to read them yourself later
4694 if you happen to lose your private key.
4696 .I decrypt
4697 command saves messages in decrypted form,
4698 while the
4699 .IR save ,
4700 .IR copy ,
4702 .I move
4703 commands leave them encrypted.
4705 Note that neither S/MIME signing nor encryption
4706 applies to message subjects or other header fields.
4707 Thus they may not contain sensitive information
4708 for encrypted messages,
4709 and cannot be trusted even if the message content
4710 has been verified.
4711 When sending signed messages,
4712 it is recommended to repeat any important header information
4713 in the message text.
4714 .SS "Using CRLs with S/MIME or SSL/TLS"
4715 Certification authorities (CAs) issue
4716 certificate revocation lists (CRLs) on a regular basis.
4717 These lists contain the serial numbers of certificates
4718 that have been declared invalid after they have been issued.
4719 Such usually happens
4720 because the private key for the certificate has been compromised,
4721 because the owner of the certificate has left
4722 the organization that is mentioned in the certificate,
4723 etc.
4724 To seriously use S/MIME or SSL/TLS verification,
4725 an up-to-date CRL is required for each trusted CA.
4726 There is otherwise no method
4727 to distinguish between valid and invalidated certificates.
4728 .I S-nail
4729 currently offers no mechanism to fetch CRLs,
4730 or to access them on the Internet,
4731 so you have to retrieve them by some external mechanism.
4733 If S/MIME and SSL/TLS support are built using OpenSSL,
4734 .I s-nail
4735 accepts CRLs in PEM format only;
4736 CRLs in DER format must be converted,
4737 e.\|g. with the shell command
4740     $ \fBopenssl crl \-inform DER \-in \fIcrl.der\fB \-out \fIcrl.pem\fR
4743 To tell
4744 .I s-nail
4745 about the CRLs,
4746 a directory
4747 that contains all CRL files
4748 (and no other files)
4749 must be created.
4751 .I smime-crl-dir
4753 .I ssl-crl-dir
4754 variables, respectively,
4755 must then be set to point to that directory.
4756 After that,
4757 .I s-nail
4758 requires a CRL to be present
4759 for each CA that is used
4760 to verify a certificate.
4762 If S/MIME and SSL/TLS support are built using NSS,
4763 CRLs can be imported in Mozilla applications
4764 (provided that
4765 .I nss-config-dir
4766 is set appropriately).
4767 .SS "Sending mail from scripts"
4768 If you want to send mail from scripts,
4769 you must be aware that
4770 .I s-nail
4771 reads the user's configuration files by default.
4772 So unless your script is only intended for your own personal use
4773 (as e.g. a cron job),
4774 you need to circumvent this by invoking
4775 .I s-nail
4776 like
4779     \fBMAILRC=/dev/null s-nail \-n\fR
4782 You then need to create a configuration for
4783 .I s-nail
4784 for your script.
4785 This can be done by either pointing the
4786 .I MAILRC
4787 variable to a custom configuration file,
4788 or by passing the configuration in environment variables.
4789 Since many of the configuration options are not valid shell variables, the
4790 .I env
4791 command is useful in this situation.
4792 An invocation could thus look like
4795     \fBenv MAILRC=/dev/null\fR from=\fIscriptreply@domain\fR smtp=\fIhost\fR \e
4796           smtp-auth-user=\fIlogin\fR smtp-auth-password=\fIsecret\fR \e
4797           smtp-auth=\fIlogin\fR \fBs-nail \-n\fR \-s "\fIsubject\fR" \e
4798           \-a \fIattachment_file\fR \fIrecipient@domain\fR <\fIcontent_file\fR
4799 .SH "SEE ALSO"
4800 fmt(1),
4801 newaliases(1),
4802 openssl(1),
4803 pg(1),
4804 more(1),
4805 vacation(1),
4806 ssl(3),
4807 aliases(5),
4808 locale(7),
4809 mailaddr(7),
4810 sendmail(8)
4811 .SH NOTES
4813 Variables in the environment passed to
4814 .I s-nail
4815 cannot be unset.
4817 The character set conversion relies
4818 on the
4819 .IR iconv (3)
4820 function.
4821 Its functionality differs widely
4822 between the various system environments
4823 \fIs-nail\fR runs on.
4824 If the message `Cannot convert from \fIa\fR to \fIb\fR' appears,
4825 either some characters within the message header or text
4826 are not appropriate for the currently selected terminal character set,
4827 or the needed conversion is not supported by the system.
4828 In the first case,
4829 it is necessary to set
4830 an appropriate LC_CTYPE locale (e.\|g. \fIen_US\fR)
4831 or the
4832 .I ttycharset
4833 variable.
4834 In the second case, the
4835 .I sendcharsets
4837 .I ttycharset
4838 variables must be set to the same value
4839 to inhibit character set conversion.
4841 .I iconv()
4842 is not available at all,
4843 the value assigned to
4844 .I sendcharsets
4845 must match the character set that is used on the terminal.
4847 S-nail expects input text to be in Unix format,
4848 with lines separated by 
4849 .I newline
4850 (^J, \en) characters only.
4851 Non-Unix text files that use
4852 .I carriage return
4853 (^M, \er)
4854 characters in addition will be treated as binary data;
4855 to send such files as text, strip these characters e.\ g. by
4858 tr \-d '\e015' <input | s-nail .\ .\ .
4861 or fix the tools that generate them.
4863 Limitations with IMAP mailboxes are:
4864 It is not possible to edit messages,
4865 but it is possible to append them.
4866 Thus to edit a message,
4867 create a local copy of it,
4868 edit it, append it,
4869 and delete the original.
4870 The line count for the header display
4871 is only appropriate if the entire message has been downloaded
4872 from the server.
4873 The marking of messages as `new' is performed by the IMAP server;
4874 use of the
4875 .I exit
4876 command instead of
4877 .I quit
4878 will not cause it to be reset,
4879 and if the
4880 .IR autoinc / newmail
4881 variables are unset,
4882 messages that arrived during a session
4883 will not be in state `new' anymore
4884 when the folder is opened again.
4885 Also if commands queued in disconnected mode are committed,
4886 the IMAP server will delete the `new' flag
4887 for all messages in the changed folder,
4888 and new messages will appear as unread
4889 when it is selected for viewing later.
4890 The `flagged', `answered', and `draft' attributes are usually permanent,
4891 but some IMAP servers are known to drop them without notification.
4892 .\" This is why s-nail does not even check if storing them succeeds.
4893 Message numbers may change with IMAP
4894 every time before the prompt is printed
4895 if \fIs-nail\fR is notified by the server
4896 that messages have been deleted
4897 by some other client or process.
4898 In this case, `Expunged \fIn\fR messages' is printed,
4899 and message numbers may have changed.
4901 Limitations with POP3 mailboxes are:
4902 It is not possible to edit messages,
4903 they can only be copied and deleted.
4904 The line count for the header display
4905 is only appropriate if the entire message has been downloaded
4906 from the server.
4907 The status field of a message is maintained by the server
4908 between connections;
4909 some servers do not update it at all,
4910 and with a server that does,
4911 the `exit' command will not cause the message status to be reset.
4912 The `newmail' command and the `newmail' variable
4913 have no effect.
4914 It is not possible to rename or to remove POP3 mailboxes.
4916 If a
4917 .SM RUBOUT
4918 (interrupt) is typed while an IMAP or POP3 operation is in progress,
4919 .I s-nail
4920 will wait until the operation can be safely aborted,
4921 and will then return to the command loop
4922 and print the prompt again.
4923 When a second
4924 .I RUBOUT
4925 is typed while
4926 .I s-nail
4927 is waiting for the operation to complete,
4928 the operation itself will be canceled.
4929 In this case,
4930 data that has not been fetched yet
4931 will have to be fetched
4932 before the next command can be performed.
4933 If the canceled operation
4934 was using an SSL/TLS encrypted channel,
4935 an error in the SSL transport will very likely result,
4936 and the connection is no longer usable.
4938 As \fIs-nail\fR is a mail user agent,
4939 it provides only basic SMTP services.
4940 If it fails to contact its upstream SMTP server,
4941 it will not make further attempts to transfer the message
4942 at a later time,
4943 and it does not leave other information about this condition
4944 than an error message on the terminal
4945 and a `dead.letter' file.
4946 This is usually not a problem if the SMTP server
4947 is located in the same local network
4948 as the computer on which \fIs-nail\fR is run.
4949 However, care should be taken when using a remote server of an ISP;
4950 it might be better to set up a local SMTP server then
4951 which just acts as a proxy.
4953 \fIS-nail\fR immediately contacts the SMTP server (or
4954 .IR \%/usr/lib/sendmail )
4955 even when operating in
4956 .I disconnected
4957 mode.
4958 It would not make much sense for \fIs-nail\fR to defer outgoing mail
4959 since SMTP servers usually provide
4960 much more elaborated delay handling
4961 than \fIs-nail\fR could perform as a client.
4962 Thus the recommended setup for sending mail in
4963 .I disconnected
4964 mode is to configure a local SMTP server
4965 such that it sends outgoing mail
4966 as soon as an external network connection is available again,
4967 i.\|e. to advise it to do that from a network startup script.
4969 The junk mail filter follows the concepts developed by
4970 Paul Graham in his articles,
4971 ``A Plan for Spam'', August 2002,
4972 \%<http://www.paulgraham.com/spam.html>,
4973 and ``Better Bayesian Filtering'', January 2003,
4974 \%<http://www.paulgraham.com/better.html>.
4975 Chained tokens are due to a paper by
4976 Jonathan A. Zdziarski,
4977 ``Advanced Language Classification using Chained Tokens'',
4978 February 2004,
4979 \%<http://www.nuclearelephant.com/papers/chained.html>.
4981 A \fImail\fR command appeared in Version 1 AT&T Unix.
4982 Berkeley Mail was written in 1978 by Kurt Shoens.
4983 This man page is derived from
4984 from The Mail Reference Manual
4985 originally written by Kurt Shoens.
4986 \fIHeirloom Mailx\fR enhancements are maintained and documented
4987 by Gunnar Ritter.
4988 \fIS-nail\fR enhancements are maintained and documented
4989 by Steffen "Daode" Nurpmeso.
4991 Portions of this text are reprinted and reproduced in electronic form
4992 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
4993 \(em Operating System Interface (POSIX), The Open Group Base
4994 Specifications Issue 6, Copyright \(co 2001-2003 by the Institute of
4995 Electrical and Electronics Engineers, Inc and The Open Group. In the
4996 event of any discrepancy between this version and the original IEEE and
4997 The Open Group Standard, the original IEEE and The Open Group Standard
4998 is the referee document. The original Standard can be obtained online at
4999 \%http://www.opengroup.org/unix/online.html\ .
5000 Redistribution of this material is permitted so long as this notice remains
5001 intact.