Fix compilation with OPENSSL_NO_SSL2..
[s-mailx.git] / mailx.1
blob4c6812164e7d9e8af5ad7c5e2589b1b95c0b0780
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 Recipients specified on the command line are ignored.
245 .BI \-u \ user
246 Reads the mailbox of the given user name.
248 .B \-v
249 Verbose mode.
250 The details of
251 delivery are displayed on the user's terminal.
253 .B \-V
254 Print \fIs-nail\fR's version and exit.
256 .B \-~
257 Enable tilde escapes even if not in interactive mode.
258 .SS "Sending mail"
259 To send a message to one or more people,
260 \fIs-nail\fR can be invoked with arguments
261 which are the names of people
262 to whom the mail will be sent.
263 The user is then expected to type in his message,
264 followed by an `control-D' at the beginning of a line.
265 The section below Replying to
266 or originating mail,
267 describes some features of \fIs-nail\fR
268 available to help when composing letters.
269 .SS "Reading mail"
270 In normal usage \fIs-nail\fR is given no arguments
271 and checks the user's mail out of the post office,
272 then prints out a one line header
273 of each message found.
274 The current message is initially
275 the first message (numbered 1)
276 and can be printed using the print command
277 which can be abbreviated `p').
278 The user can move among the messages
279 much as he moves between lines in
280 .IR ed (1),
281 with the commands `+' and `\-' moving backwards and forwards,
282 and simple numbers.
283 .SS "Disposing of mail"
284 After examining a message
285 the user can delete `d') the message
286 or reply `r') to it.
287 Deletion causes the \fIs-nail\fR program
288 to forget about the message.
289 This is not irreversible;
290 the message can be undeleted `u')
291 by giving its number,
292 or the \fIs-nail\fR session can be aborted
293 by giving the exit `x') command.
294 Deleted messages will, however,
295 usually disappear never to be seen again.
296 .SS "Specifying messages"
297 Commands such as print and delete
298 can be given a list of message numbers
299 as arguments to apply to a number of messages at once.
300 Thus `\fIdelete 1 2\fR' deletes messages 1 and 2,
301 while `\fIdelete 1-5\fR' deletes messages 1 through 5.
302 In sorted or threaded mode (see the
303 .I sort
305 .I thread
306 commands),
307 `\fIdelete 1-5\fR' deletes the messages
308 that are located between (and including) messages 1 through 5
309 in the sorted/threaded order,
310 as shown in the header summary.
311 The following special message names exist:
313 .B :n
314 All new messages.
316 .B :o
317 All old messages (any not in state read or new).
319 .B :u
320 All unread messages.
322 .B :d
323 All deleted messages (for the
324 .I undelete
325 command).
327 .B :r
328 All read messages.
330 .B :f
331 All `flagged' messages.
333 .B :a
334 All answered messages
335 (cf. the
336 .I markanswered
337 variable).
339 .B :t
340 All messages marked as draft.
342 .B :k
343 All `killed' messages.
345 .B :j
346 All messages classified as junk.
348 .B .
349 The current message.
351 .B ;
352 The message that was previously the current message.
354 .B ,
355 The parent message of the current message,
356 that is the message with the Message-ID
357 given in the `In-Reply-To:' field
358 or the last entry of the `References:' field
359 of the current message.
361 .B \-
362 The next previous undeleted message,
363 or the next previous deleted message for the
364 .I undelete
365 command.
366 In sorted/threaded mode,
367 the next previous such message in the sorted/threaded order.
369 .B +
370 The next undeleted message,
371 or the next deleted message for the
372 .I undelete
373 command.
374 In sorted/threaded mode,
375 the next such message in the sorted/threaded order.
377 .B ^
378 The first undeleted message,
379 or the first deleted message
380 for the
381 .I undelete
382 command.
383 In sorted/threaded mode,
384 the first such message in the sorted/threaded order.
386 .B $
387 The last message.
388 In sorted/threaded mode,
389 the last message in the sorted/threaded order.
391 .BI & x
392 In threaded mode,
393 selects the message addressed with
394 .IR x ,
395 where
396 .I x
397 is any other message specification,
398 and all messages from the thread that begins at it.
399 Otherwise, it is identical to
400 .IR x .
402 .I x
403 is omitted,
404 the thread beginning with the current message is selected.
406 .B *
407 All messages.
409 .B `
410 All messages that were included in the message list
411 for the previous command.
413 .BI / string
414 All messages that contain
415 .I string
416 in the subject field (case ignored).
417 See also the
418 .I searchheaders
419 variable.
421 .I string
422 is empty,
423 the string from the previous specification of that type is used again.
425 .I address
426 All messages from
427 .IR address .
428 By default, this is a case-sensitive search
429 for the complete email address.
430 If the
431 .I allnet
432 variable is set,
433 only the local part of the addresses is evaluated for the comparison.
434 Otherwise if the
435 .I showname
436 variable is set,
437 a case-sensitive search for the complete real name
438 of a sender is performed.
439 The IMAP-style
440 .BI (from\  address)
441 expression can be used instead
442 if substring matches are desired.
444 .BI ( criterion )
445 All messages that satisfy the given IMAP-style SEARCH
446 .IR criterion .
447 This addressing mode is available with all types of folders;
448 for folders not located on IMAP servers,
449 or for servers unable to execute the SEARCH command,
450 .I s-nail
451 will perform the search locally.
452 Strings must be enclosed by double quotes `"' in their entirety
453 if they contain white space or parentheses;
454 within the quotes,
455 only backslash `\e' is recognized as an escape character.
456 All string searches are case-insensitive.
457 When the description indicates
458 that the `envelope' representation of an address field is used,
459 this means that the search string is checked against
460 both a list constructed as
463 \fB("\fIreal name\fB" "\fIsource-route\fB" "\fIlocal-part\fB" "\fIdomain-part\fB")\fR
466 for each address,
467 and the addresses without real names
468 from the respective header field.
469 Criteria can be nested using parentheses.
471 \fB(\fIcriterion1 criterion2\fR .\|.\|. \fIcriterionN\fB)\fR
472 All messages that satisfy all of the given criteria.
474 .BI (or " criterion1 criterion2" )
475 All messages that satisfy either
476 .I criterion1
478 .IR criterion2 ,
479 or both.
480 To connect more than two criteria using `or',
481 (or) specifications have to be nested using additional parentheses,
482 as with `(or\ a\ (or\ b\ c))';
483 `(or\ a\ b\ c)' means ((a or b) and c).
484 For a simple `or' operation of independent criteria
485 on the lowest nesting level,
486 it is possible to achieve similar effects by using
487 three separate criteria, as with
488 `(a)\ (b)\ (c)'.
490 .BI (not " criterion" )
491 All messages that do not satisfy
492 .IR criterion .
494 .BI (bcc " string" )
495 All messages that contain
496 .I string
497 in the `envelope' representation of the
498 .I Bcc:
499 field.
501 .BI (cc " string" )
502 All messages that contain
503 .I string
504 in the `envelope' representation of the
505 .I Cc:
506 field.
508 .BI (from " string" )
509 All messages that contain
510 .I string
511 in the `envelope' representation of the
512 .I From:
513 field.
515 .BI (subject " string" )
516 All messages that contain
517 .I string
518 in the
519 .I Subject:
520 field.
522 .BI (to " string" )
523 All messages that contain
524 .I string
525 in the `envelope' representation of the
526 .I To:
527 field.
529 .BI (header " name string" )
530 All messages that contain
531 .I string
532 in the specified
533 .I Name:
534 field.
536 .BI (body " string" )
537 All messages that contain
538 .I string
539 in their body.
541 .BI (text " string" )
542 All messages that contain
543 .I string
544 in their header or body.
546 .BI (larger " size" )
547 All messages that are larger than
548 .I size
549 (in bytes).
551 .BI (smaller " size" )
552 All messages that are smaller than
553 .I size
554 (in bytes).
556 .BI (before " date" )
557 All messages that were received before
558 .IR date ;
559 .I date
560 must be in the form
561 \fId\fR[\fId\fR]\fB-\fImon\fB-\fIyyyy\fR,
562 where \fId\fR[\fId\fR] is the day of the month
563 as one or two digits,
564 .I mon
565 is the name of the month\(emone of
566 `Jan', `Feb', `Mar',
567 `Apr', `May', `Jun',
568 `Jul', `Aug', `Sep',
569 `Oct', `Nov', or `Dec',
571 .I yyyy
572 is the year as four digits;
573 e.\|g. "30-Aug-2004".
575 .BI (on " date" )
576 All messages that were received on the specified date.
578 .BI (since " date" )
579 All messages that were received since the specified date.
581 .BI (sentbefore " date" )
582 All messages that were sent on the specified date.
584 .BI (senton " date" )
585 All messages that were sent on the specified date.
587 .BI (sentsince " date" )
588 All messages that were sent since the specified date.
590 .B ()
591 The same criterion as for the previous search.
592 This specification cannot be used as part of another criterion.
593 If the previous command line contained more than one independent criterion,
594 the last of those criteria is used.
596 A practical method to read a set of messages
597 is to issue a
598 .I from
599 command with the search criteria first
600 to check for appropriate messages,
601 and to read each single message then by typing `\fB`\fR' repeatedly.
602 .SS "Replying to or originating mail"
604 .I reply
605 command can be used
606 to set up a response to a message,
607 sending it back to the person who it was from.
608 Text the user types in then,
609 up to an end-of-file,
610 defines the contents of the message.
611 While the user is composing a message,
612 \fIs-nail\fR treats lines beginning with the character `~' specially.
613 For instance, typing `~m' (alone on a line)
614 will place a copy of the current message into the response
615 right shifting it by a tabstop
616 (see
617 .I indentprefix
618 variable, below).
619 Other escapes will set up subject fields,
620 add and delete recipients to the message,
621 attach files to it
622 and allow the user to escape to an editor
623 to revise the message
624 or to a shell to run some commands.
625 (These options are given in the summary below.)
626 .SS "Ending a mail processing session"
627 The user can end a \fIs-nail\fR session
628 with the quit (`q') command.
629 Messages which have been examined
630 go to the user's mbox file
631 unless they have been deleted
632 in which case they are discarded.
633 Unexamined messages go back
634 to the post office.
635 (See the \-f option above).
636 .SS "Personal and systemwide distribution lists"
637 It is also possible to create
638 a personal distribution lists so that,
639 for instance, the user can send mail
640 to `\fIcohorts\fR' and have it go
641 to a group of people.
642 Such lists can be defined by placing a line like
645         \fBalias\fI cohorts bill ozalp jkf mark kridle@ucbcory\fR
648 in the file .mailrc in the user's home directory.
649 The current list of such aliases
650 can be displayed with the alias command in \fIs-nail\fR.
651 System wide distribution lists can be created
652 by editing /etc/aliases, see
653 .IR aliases (5)
655 .IR sendmail (8);
656 these are kept in a different syntax.
657 In mail the user sends,
658 personal aliases will be expanded
659 in mail sent to others so that
660 they will be able to reply to the recipients.
661 System wide aliases are not expanded when the mail is sent,
662 but any reply returned to the machine
663 will have the system wide alias expanded
664 as all mail goes through sendmail.
665 .SS "Recipient address specifications"
666 When an address is used to name a recipient
667 (in any of To, Cc, or Bcc),
668 names of local mail folders
669 and pipes to external commands
670 can also be specified;
671 the message text is then written to them.
672 The rules are: Any name which starts with a
673 .RB ` | '
674 character specifies a pipe,
675 the command string following the `|'
676 is executed and the message is sent to its standard input;
677 any other name which contains a
678 .RB ` @ '
679 character is treated as a mail address;
680 any other name which starts with a
681 .RB ` + '
682 character specifies a folder name;
683 any other name which contains a
684 .RB ` / '
685 character
686 but no
687 .RB ` ! '
689 .RB ` % '
690 character before also specifies a folder name;
691 what remains is treated as a mail address.
692 Compressed folders are handled as described for the
693 .I folder
694 command below.
695 .SS "Network mail (Internet / ARPA, UUCP, Berknet)"
697 .IR mailaddr (7)
698 for a description of network addresses.
699 \fIS-nail\fR has a number of options
700 which can be set in the .mailrc file
701 to alter its behavior;
702 thus `\fIset askcc\fR' enables the askcc feature.
703 (These options are summarized below).
704 .SS "MIME types"
705 For any outgoing attachment,
706 \fIs-nail\fR tries to determine the content type.
707 It does this by reading MIME type files
708 whose lines have the following syntax:
711         \fItype\fB/\fIsubtype      extension \fR[\fIextension \fR.\ .\ .]\fR
714 where type/subtype are strings describing the file contents,
715 and extension is the part of a filename starting after the last dot.
716 Any line not immediately beginning with an ASCII alphabetical character is
717 ignored by \fIs-nail\fR.
718 If there is a match with the extension of the file to attach,
719 the given type/subtype pair is used.
720 Otherwise, or if the filename has no extension,
721 the content types text/plain or application/octet-stream are used,
722 the first for text or international text files,
723 the second for any file that contains formatting characters
724 other than newlines and horizontal tabulators.
725 .SS "Character sets"
726 .I S-nail
727 normally detects the character set of the terminal
728 using the LC_CTYPE locale setting.
729 If the locale cannot be used appropriately,
730 the \fIttycharset\fR variable should be set
731 to provide an explicit value.
732 When reading messages,
733 their text is converted to the terminal character set if possible.
734 Unprintable characters and illegal byte sequences are detected
735 and replaced by Unicode substitute characters or question marks
736 unless the
737 .I print-all-chars
738 is set at initialization time.
740 The character set for outgoing messages
741 is not necessarily the same
742 as the one used on the terminal.
743 If an outgoing text message
744 contains characters not representable in US-ASCII,
745 the character set being used
746 must be declared within its header.
747 Permissible values can be declared
748 using the \fIsendcharsets\fR variable,
749 separated by commas;
750 .I s-nail
751 tries each of the values in order
752 and uses the first appropriate one.
753 If the message contains characters that cannot be represented
754 in any of the given character sets,
755 the message will not be sent,
756 and its text will be saved to the `dead.letter' file.
757 Messages that contain NUL bytes are not converted.
759 Outgoing attachments are converted if they are plain text.
760 If the
761 .I sendcharsets
762 variable contains more than one character set name,
764 .I ~@
765 tilde escape will ask for the character sets for individual attachments
766 if it is invoked without arguments.
768 Best results are usually achieved
769 when
770 .I s-nail
771 is run in a UTF-8 locale
772 on a UTF-8 capable terminal.
773 In this setup,
774 characters from various countries can be displayed,
775 while it is still possible to use more simple
776 character sets for sending
777 to retain maximum compatibility with older mail clients.
778 .SS "Commands"
779 Each command is typed on a line by itself,
780 and may take arguments following the command word.
781 The command need not be typed in its entirety \(en
782 the first command which matches the typed prefix is used.
783 For commands which take message lists as arguments,
784 if no message list is given,
785 then the next message forward which satisfies
786 the command's requirements is used.
787 If there are no messages forward of the current message,
788 the search proceeds backwards,
789 and if there are no good messages at all,
790 \fIs-nail\fR types `\fIapplicable messages\fR' and aborts the command.
791 If the command begins with a \fI#\fR sign,
792 the line is ignored.
794 The arguments to commands can be quoted, using the following methods:
795 .IP \(bu
796 An argument can be enclosed between paired double-quotes
797 "\|" or single-quotes '\|'; any white space, shell
798 word expansion, or backslash characters within the quotes
799 are treated literally as part of the argument.
800 A double-quote will be treated literally within
801 single-quotes and vice versa. These special properties of
802 the quote marks occur only when they are paired at the
803 beginning and end of the argument.
804 .IP \(bu
805 A backslash outside of the enclosing quotes is discarded
806 and the following character is treated literally as part of
807 the argument.
808 .IP \(bu
809 An unquoted backslash at the end of a command line is
810 discarded and the next line continues the command.
812 Filenames, where expected, are subjected to the following
813 transformations, in sequence:
814 .IP \(bu
815 If the filename begins with an unquoted plus sign, and
817 .I folder
818 variable is defined,
819 the plus sign will be replaced by the value of the
820 .I folder
821 variable followed by a slash. If the
822 .I folder
823 variable is
824 unset or is set to null, the filename will be unchanged.
825 .IP \(bu
826 Shell word expansions are applied to the filename.
827 If more than a single pathname results
828 from this expansion and the command is expecting one
829 file, an error results.
831 The following commands are provided:
833 .B \-
834 Print out the preceding message.
835 If given a numeric argument n,
836 goes to the n'th previous message and prints it.
838 .B ?
839 Prints a brief summary of commands.
841 .B !
842 Executes the shell (see
843 .IR sh (1)
845 .IR csh (1))
846 command which follows.
848 .B |
849 A synonym for the \fIpipe\fR command.
851 .B account
852 (ac) Creates, selects or lists
853 an email account.
854 An account is formed by a group of commands,
855 primarily of those to set variables.
856 With two arguments,
857 of which the second is a `{',
858 the first argument gives an account name,
859 and the following lines create a group of commands for that account
860 until a line containing a single `}' appears.
861 With one argument,
862 the previously created group of commands
863 for the account name is executed,
864 and a
865 .I folder
866 command is executed for the system mailbox or inbox
867 of that account.
868 Without arguments,
869 the list of accounts and their contents are printed.
870 As an example,
873     \fBaccount\fI myisp\fR \fB{\fR
874         set folder=imaps://mylogin@imap.myisp.example
875         set record=+Sent
876         set from="myname@myisp.example (My Name)"
877         set smtp=smtp.myisp.example
878     \fB}\fR
881 creates an account named `myisp'
882 which can later be selected by specifying `account myisp'.
884 .B alias
885 (a) With no arguments,
886 prints out all currently-defined aliases.
887 With one argument, prints out that alias.
888 With more than one argument,
889 creates a new alias or changes an old one.
891 .B alternates
892 (alt) The alternates command is useful
893 if the user has accounts on several machines.
894 It can be used to inform \fIs-nail\fR
895 that the listed addresses all belong to the invoking user.
896 When he replies to messages,
897 \fIs-nail\fR will not send a copy of the message
898 to any of the addresses
899 listed on the alternates list.
900 If the alternates command is given
901 with no argument,
902 the current set of alternate names is displayed.
904 .B answered
905 (ans) Takes a message list and marks each message
906 as a having been answered.
907 This mark has no technical meaning in the mail system;
908 it just causes messages to be marked in the header summary,
909 and makes them specially addressable.
911 .B cache
912 Only applicable to cached IMAP mailboxes;
913 takes a message list and reads the specified messages
914 into the IMAP cache.
916 .B call
917 Calls a macro (see the
918 .I define
919 command).
921 .B cd
922 Same as chdir.
924 .B certsave
925 Only applicable to S/MIME signed messages.
926 Takes a message list and a file name
927 and saves the certificates contained within the message signatures
928 to the named file in both human-readable and PEM format.
929 The certificates can later be used to send encrypted messages
930 to the messages' originators by setting the
931 .I smime-encrypt-user@host
932 variable.
934 .B chdir
935 (ch) Changes the user's working directory to that specified,
936 if given.
937 If no directory is given,
938 then changes to the user's login directory.
940 .B classify
941 (cl) Takes a list of messages and
942 examines their contents for characteristics of junk mail
943 using Bayesian filtering.
944 Messages considered to be junk are then marked as such.
945 The junk mail database is not changed.
947 .B collapse
948 (coll)
949 Only applicable to threaded mode.
950 Takes a message list
951 and makes all replies to these messages invisible
952 in header summaries,
953 unless they are in state `new'.
955 .B connect
956 (conn) If operating in disconnected mode on an IMAP mailbox,
957 switch to online mode and connect to the mail server
958 while retaining the mailbox status.
959 See the description of the
960 .I disconnected
961 variable for more information.
963 .B copy
964 (c) The copy command does the same thing that
965 .I save
966 does,
967 except that it does not mark the messages
968 it is used on for deletion when the user quits.
969 Compressed files and IMAP mailboxes are handled as described for the
970 .I folder
971 command.
973 .B Copy
974 (C) Similar to
975 .IR copy ,
976 but saves the messages in a file named after the local part
977 of the sender address of the first message.
979 .B decrypt
980 (dec) For unencrypted messages,
981 this command is identical to
982 .IR copy .
983 Encrypted messages are first decrypted, if possible,
984 and then copied.
986 .B Decrypt
987 (Dec) Similar to
988 .IR decrypt ,
989 but saves the messages in a file named after the local part
990 of the sender address of the first message.
992 .B define
993 (def) Defines a macro.
994 A macro definition is a sequence of commands in the following form:
997     \fBdefine\fR \fIname\fB {\fR
998         \fIcommand1\fR
999         \fIcommand2\fR
1000         .\|.\|.
1001         \fIcommandN\fR
1002     \fB}\fR
1005 Once defined, a macro can be explicitly invoked using the
1006 .I call
1007 command,
1008 or can be implicitly invoked by setting the
1009 .I folder-hook
1011 .I folder-hook-fullname
1012 variables.
1014 .B defines
1015 Prints the currently defined macros including their contents.
1017 .B delete
1018 (d) Takes a list of messages as argument
1019 and marks them all as deleted.
1020 Deleted messages will not be saved in mbox,
1021 nor will they be available for most other commands.
1023 .B discard
1024 Same as ignore.
1026 .B disconnect
1027 (disco) If operating in online mode on an IMAP mailbox,
1028 switch to disconnected mode while retaining the mailbox status.
1029 See the description of the
1030 .I disconnected
1031 variable for more information.
1032 A list of messages may optionally be given as argument;
1033 the respective messages are then read into the cache
1034 before the connection is closed.
1035 Thus `disco *' makes the entire current mailbox
1036 available for disconnected use.
1038 .BR dp \ or \ dt
1039 Deletes the current message
1040 and prints the next message.
1041 If there is no next message,
1042 \fIs-nail\fR says `\fIat EOF\fR'.
1044 .B draft
1045 Takes a message list and marks each message
1046 as a draft.
1047 This mark has no technical meaning in the mail system;
1048 it just causes messages to be marked in the header summary,
1049 and makes them specially addressable.
1051 .B echo
1052 Echoes its arguments,
1053 resolving special names
1054 as documented for the folder command.
1055 The escape sequences
1056 `\fB\ea\fR',
1057 `\fB\eb\fR',
1058 `\fB\ec\fR',
1059 `\fB\ef\fR',
1060 `\fB\en\fR',
1061 `\fB\er\fR',
1062 `\fB\et\fR',
1063 `\fB\ev\fR',
1064 `\fB\e\e\fR', and
1065 `\fB\e0\fInum\fR'
1066 are interpreted
1067 as with the
1068 .IR echo (1)
1069 command.
1071 .B edit
1072 (e) Takes a list of messages
1073 and points the text editor
1074 at each one in turn.
1075 Modified contents are discarded
1076 unless the
1077 .I writebackedited
1078 variable is set.
1080 .B else
1081 Marks the end of the then-part
1082 of an if statement
1083 and the beginning of the part
1084 to take effect if the condition
1085 of the if statement is false.
1087 .B endif
1088 Marks the end of an if statement.
1090 .B exit
1091 (ex or x) Effects an immediate return to the Shell
1092 without modifying the user's system mailbox,
1093 his mbox file,
1094 or his edit file in \-f.
1096 .B file
1097 (fi) The same as folder.
1099 .B flag
1100 (fl) Takes a message list
1101 and marks the messages as `flagged' for urgent/special attention.
1102 This mark has no technical meaning in the mail system;
1103 it just causes messages to be highlighted in the header summary,
1104 and makes them specially addressable.
1106 .B folders
1107 With no arguments,
1108 list the names of the folders in the folder directory.
1109 With an existing folder as an argument,
1110 lists then names of folders below the named folder;
1111 e.\|g. the command `folders @'
1112 lists the folders on the base level of the current IMAP server.
1113 See also the
1114 .I imap-list-depth
1115 variable.
1117 .B folder
1118 (fold) The folder command switches
1119 to a new mail file or folder.
1120 With no arguments, it tells the user
1121 which file he is currently reading.
1122 If an argument is given,
1123 it will write out changes
1124 (such as deletions) the user has made
1125 in the current file and read in
1126 the new file.
1127 Some special conventions are recognized for the name.
1128 \fB#\fR means the previous file,
1129 \fB%\fR means the invoking user's system mailbox,
1130 \fB%\fIuser\fR means \fIuser's\fR system mailbox,
1131 \fB&\fR means the invoking user's mbox file,
1132 and \fB+\fIfile\fI means a \fIfile\fR in the folder directory.
1133 \fB%:\fIfilespec\fR expands to the same value as \fIfilespec\fR,
1134 but the file is handled as a system mailbox
1135 e.\ g. by the mbox and save commands.
1136 If the name matches one of the strings defined with the
1137 .I shortcut
1138 command,
1139 it is replaced by its long form and expanded.
1140 If the name ends with \fB.gz\fR or \fB.bz2\fR,
1141 it is treated as compressed with
1142 .IR gzip (1)
1144 .IR bzip2 (1),
1145 respectively.
1146 Likewise, if \fIname\fR does not exist,
1147 but either \fIname\fB.gz\fR or \fIname\fB.bz2\fR exists,
1148 the compressed file is used.
1149 If \fIname\fR refers to a directory
1150 with the subdirectories `tmp', `new', and `cur',
1151 it is treated as a folder in
1152 .I maildir
1153 format.
1154 A name of the form
1157        \fIprotocol\fB://\fR[\fIuser\fB@\fR]\fIhost\fR[\fB:\fIport\fR][\fB/\fIfile\fR]
1160 is taken as an Internet mailbox specification.
1161 The supported protocols are currently
1162 .B imap
1163 (IMAP v4r1),
1164 .B imaps
1165 (IMAP with SSL/TLS encryption),
1166 .B pop3
1167 (POP3),
1169 .B pop3s
1170 (POP3 with SSL/TLS encryption).
1172 .I user
1173 contains special characters, in particular `/' or `%',
1174 they must be escaped in URL notation,
1175 as `%2F' or `%25'.
1176 The optional
1177 .I file
1178 part applies to IMAP only;
1179 if it is omitted,
1180 the default `INBOX' is used.
1181 If \fIs-nail\fR is connected to an IMAP server,
1182 a name of the form \fB@\fImailbox\fR
1183 refers to the \fImailbox\fR on that server.
1184 If the `folder' variable refers to an IMAP account,
1185 the special name `%' selects the `INBOX' on that account.
1187 .B Followup
1188 (F) Similar to
1189 .IR Respond ,
1190 but saves the message in a file
1191 named after the local part of the first recipient's address.
1193 .B followup
1194 (fo) Similar to
1195 .IR respond ,
1196 but saves the message in a file
1197 named after the local part of the first recipient's address.
1199 .B followupall
1200 Similar to
1201 .IR followup ,
1202 but responds to all recipients regardless of the
1203 .I flipr
1205 .I Replyall
1206 variables.
1208 .B followupsender
1209 Similar to
1210 .IR Followup ,
1211 but responds to the sender only regardless of the
1212 .I flipr
1214 .I Replyall
1215 variables.
1217 .B forward
1218 (fwd)
1219 Takes a message and the address of a recipient
1220 and forwards the message to him.
1221 The text of the original message is included in the new one,
1222 with the value of the
1223 .I fwdheading
1224 variable printed before.
1226 .I fwdignore
1228 .I fwdretain
1229 commands specify which header fields are included in the new message.
1230 Only the first part of a multipart message is included unless the
1231 .I forward-as-attachment
1232 option is set.
1234 .B Forward
1235 (Fwd)
1236 Similar to
1237 .IR forward ,
1238 but saves the message in a file named after
1239 the local part of the recipient's address.
1241 .B from
1242 (f) Takes a list of messages
1243 and prints their message headers,
1244 piped through the pager if the output does not fit on the screen.
1246 .B fwdignore
1247 Specifies which header fields are to be ignored with the
1248 .I forward
1249 command.
1250 This command has no effect when the
1251 .I forward-as-attachment
1252 option is set.
1254 .B fwdretain
1255 Specifies which header fields are to be retained with the
1256 .I forward
1257 command.
1258 .I fwdretain
1259 overrides
1260 .IR fwdignore .
1261 This command has no effect when the
1262 .I forward-as-attachment
1263 option is set.
1265 .B good
1266 (go) Takes a list of messages
1267 and marks all of them as not being junk mail.
1268 Data from these messages is then inserted
1269 into the junk mail database for future classification.
1271 .B headers
1272 (h) Lists the current range of headers,
1273 which is an 18-message group.
1274 If a `+' argument is given,
1275 then the next 18-message group is printed,
1276 and if a `\-' argument is given,
1277 the previous 18-message group is printed.
1279 .B help
1280 A synonym for ?.
1282 .B hold
1283 (ho, also preserve) Takes a message list
1284 and marks each message therein to be saved
1285 in the user's system mailbox
1286 instead of in mbox.
1287 Does not override the delete command.
1288 .I S-nail
1289 deviates from the POSIX standard with this command,
1290 as a `next' command issued after `hold'
1291 will display the following message,
1292 not the current one.
1294 .B if
1295 Commands in \fIs-nail\fR's startup files
1296 can be executed conditionally
1297 depending on whether the user is sending
1298 or receiving mail with the if command.
1299 For example:
1302         \fBif \fIreceive\fR
1303                 \fIcommands .\ .\ .\fR
1304         \fBendif\fR
1307 An else form is also available:
1310         \fBif \fIreceive\fR
1311                 \fIcommands .\ .\ .\fR
1312         \fBelse\fR
1313                 \fIcommands .\ .\ .\fR
1314         \fBendif\fR
1317 Note that the only allowed conditions are
1318 .BR receive ,
1319 .BR send ,
1321 .B term
1322 (execute command if standard input is a tty).
1324 .B ignore
1325 Add the list of header fields named to the ignored list.
1326 Header fields in the ignore list are not printed
1327 on the terminal when a message is printed.
1328 This command is very handy for suppression
1329 of certain machine-generated header fields.
1330 The Type and Print commands can be used
1331 to print a message in its entirety,
1332 including ignored fields.
1333 If ignore is executed with no arguments,
1334 it lists the current set of ignored fields.
1336 .B imap
1337 Sends command strings directly to the current IMAP server.
1338 \fIS-nail\fR operates always in IMAP \fIselected state\fR
1339 on the current mailbox;
1340 commands that change this
1341 will produce undesirable results
1342 and should be avoided.
1343 Useful IMAP commands are:
1346 .B create
1347 Takes the name of an IMAP mailbox as an argument
1348 and creates it.
1350 .B getquotaroot
1351 .\" RFC 2087
1352 Takes the name of an IMAP mailbox as an argument
1353 and prints the quotas that apply to the mailbox.
1354 Not all IMAP servers support this command.
1356 .B namespace
1357 .\" RFC 2342
1358 Takes no arguments and prints the Personal Namespaces,
1359 the Other User's Namespaces,
1360 and the Shared Namespaces.
1361 Each namespace type is printed in parentheses;
1362 if there are multiple namespaces of the same type,
1363 inner parentheses separate them.
1364 For each namespace,
1365 a namespace prefix and a hierarchy separator is listed.
1366 Not all IMAP servers support this command.
1369 .B inc
1370 Same as
1371 .IR newmail .
1373 .B junk
1374 (j) Takes a list of messages
1375 and marks all of them as junk mail.
1376 Data from these messages is then inserted
1377 into the junk mail database for future classification.
1379 .B kill
1380 (k) Takes a list of messages and `kills' them.
1381 Killed messages are not printed in header summaries,
1382 and are ignored by the
1383 .I next
1384 command.
1386 .I kill
1387 command also sets the score of the messages to negative infinity,
1388 so that subsequent
1389 .I score
1390 commands will not unkill them again.
1391 Killing is only effective for the current session on a folder;
1392 when it is quit, all messages are automatically unkilled.
1394 .B list
1395 Prints the names of all available commands.
1397 .B Mail
1398 (M) Similar to
1399 .IR mail ,
1400 but saves the message in a file
1401 named after the local part of the first recipient's address.
1403 .B mail
1404 (m) Takes as argument login names
1405 and distribution group names
1406 and sends mail to those people.
1408 .B mbox
1409 Indicate that a list of messages be sent
1410 to mbox in the user's home directory when
1411 .I s-nail
1412 is quit.
1413 This is the default action for messages
1414 if unless the
1415 .I hold
1416 option is set.
1417 .I S-nail
1418 deviates from the POSIX standard with this command,
1419 as a `next' command issued after `mbox'
1420 will display the following message,
1421 not the current one.
1423 .B move
1424 (mv) Acts like
1425 .IR copy ,
1426 but marks the messages for deletion
1427 if they were transferred successfully.
1429 .B Move
1430 (Mv) Similar to
1431 .IR move ,
1432 but moves the messages to a file named after the local part
1433 of the sender address of the first message.
1435 .B newmail
1436 Checks for new mail in the current folder
1437 without committing any changes before.
1438 If new mail is present, a message is printed.
1439 If the
1440 .I header
1441 variable is set,
1442 the headers of each new message are also printed.
1444 .B next
1445 (n) like + or CR) Goes to the next message
1446 in sequence and types it.
1447 With an argument list, types the next matching message.
1449 .B New
1450 Same as
1451 .IR unread .
1453 .B new
1454 Same as
1455 .IR unread .
1457 .B online
1458 Same as
1459 .IR connect .
1461 .B noop
1462 If the current folder is located on an IMAP or POP3 server,
1463 a NOOP command is sent.
1464 Otherwise, no operation is performed.
1466 .B Pipe
1467 (Pi) Like
1468 .I pipe
1469 but also
1470 pipes ignored header fields
1471 and all parts of MIME
1472 .I multipart/alternative
1473 messages.
1475 .B pipe
1476 (pi) Takes a message list and a shell command
1477 and pipes the messages through the command.
1478 Without an argument,
1479 the current message is piped
1480 through the command given by the \fIcmd\fR variable.
1481 If the \fI page\fR variable is set,
1482 every message is followed by a formfeed character.
1484 .B preserve
1485 (pre) A synonym for
1486 .IR hold .
1488 .B Print
1489 (P) Like
1490 .I print
1491 but also
1492 prints out ignored header fields
1493 and all parts of MIME
1494 .I multipart/alternative
1495 messages.
1496 See also
1497 .IR print ,
1498 .IR ignore ,
1500 .IR retain .
1502 .B print
1503 (p) Takes a message list and types out each message
1504 on the user's terminal.
1505 If the message is a MIME multipart message,
1506 all parts with a content type of `text' or `message' are shown,
1507 the other are hidden except for their headers.
1508 Messages are decrypted and converted to the terminal character set
1509 if necessary.
1511 .B probability
1512 (prob) For each word given as argument,
1513 the contents of its junk mail database entry are printed.
1515 .B quit
1516 (q) Terminates the session, saving all undeleted,
1517 unsaved messages in the user's mbox file in his login directory,
1518 preserving all messages marked with hold or preserve
1519 or never referenced in his system mailbox,
1520 and removing all other messages from his system mailbox.
1521 If new mail has arrived during the session,
1522 the message `\fIYou have new mail\fR' is given.
1523 If given while editing a mailbox file with the \-f flag,
1524 then the edit file is rewritten.
1525 A return to the Shell is effected,
1526 unless the rewrite of edit file fails,
1527 in which case the user can escape
1528 with the exit command.
1530 .B redirect
1531 (red) Same as
1532 .IR resend .
1534 .B Redirect
1535 (Red) Same as
1536 .IR Resend .
1538 .B remove
1539 (rem) Removes the named folders.
1540 The user is asked for confirmation
1541 in interactive mode.
1543 .B rename
1544 (ren) Takes the name of an existing folder
1545 and the name for the new folder
1546 and renames the first to the second one.
1547 Both folders must be of the same type
1548 and must be located on the current server for IMAP.
1550 .B Reply
1551 (R) Reply to originator.
1552 Does not reply to other recipients
1553 of the original message.
1555 .BR reply
1556 (r) Takes a message list and sends mail
1557 to the sender and all recipients of the specified message.
1558 The default message must not be deleted.
1560 .B replyall
1561 Similar to
1562 .IR reply ,
1563 but responds to all recipients regardless of the
1564 .I flipr
1566 .I Replyall
1567 variables.
1569 .B replysender
1570 Similar to
1571 .IR Reply ,
1572 but responds to the sender only regardless of the
1573 .I flipr
1575 .I Replyall
1576 variables.
1578 .B Resend
1579 Like
1580 .IR resend ,
1581 but does not add any header lines.
1582 This is not a way to hide the sender's identity,
1583 but useful for sending a message again
1584 to the same recipients.
1586 .B resend
1587 Takes a list of messages and a user name
1588 and sends each message to the named user.
1589 `Resent-From:' and related header fields are prepended
1590 to the new copy of the message.
1592 .B Respond
1593 Same as
1594 .IR Reply .
1596 .B respond
1597 Same as
1598 .IR reply .
1600 .B respondall
1601 Same as
1602 .IR replyall .
1604 .B respondsender
1605 Same as
1606 .IR replysender .
1608 .B retain
1609 Add the list of header fields named to the retained list.
1610 Only the header fields in the retain list are shown
1611 on the terminal when a message is printed.
1612 All other header fields are suppressed.
1613 The Type and Print commands can be used
1614 to print a message in its entirety.
1615 If retain is executed with no arguments,
1616 it lists the current set of retained fields.
1618 .B Save
1620 Similar to
1621 .IR save ,
1622 but saves the messages
1623 in a file named after the local part
1624 of the sender of the first message
1625 instead of taking a filename argument.
1627 .B save
1628 (s) Takes a message list and a filename
1629 and appends each message
1630 in turn to the end of the file.
1631 If no filename is given,
1632 the mbox file is used.
1633 The filename in quotes,
1634 followed by the line count and character count
1635 is echoed on the user's terminal.
1636 If editing a system mailbox,
1637 the messages are marked for deletion.
1638 Compressed files and IMAP mailboxes are handled as described for the
1639 .I \-f
1640 command line option above.
1642 .B savediscard
1643 Same as saveignore.
1645 .B saveignore
1646 Saveignore is to save what ignore is to print and type.
1647 Header fields thus marked are filtered out
1648 when saving a message by save
1649 or when automatically saving to mbox.
1650 This command should only be applied to header fields
1651 that do not contain information needed to decode the message,
1652 as MIME content fields do.
1653 If saving messages on an IMAP account,
1654 ignoring fields makes it impossible
1655 to copy the data directly on the server,
1656 thus operation usually becomes much slower.
1658 .B saveretain
1659 Saveretain is to save what retain is to print and type.
1660 Header fields thus marked are the only ones
1661 saved with a message when saving by save
1662 or when automatically saving to mbox.
1663 Saveretain overrides saveignore.
1664 The use of this command is strongly discouraged
1665 since it may strip header fields
1666 that are needed to decode the message correctly.
1668 .B score
1669 (sc) Takes a message list and a floating point number
1670 and adds the number to the score of each given message.
1671 All messages start at score 0 when a folder is opened.
1672 When the score of a message becomes negative, it is `killed'
1673 with the effects described for the
1674 .I kill
1675 command;
1676 otherwise if it was negative before and becomes positive,
1677 it is `unkilled'.
1678 Scores only refer to the currently opened instance of a folder.
1680 .B set
1681 (se) With no arguments, prints all variable values,
1682 piped through the pager if the output does not fit on the screen.
1683 Otherwise, sets option.
1684 Arguments are of the form option=value
1685 (no space before or after =)
1686 or option.
1687 Quotation marks may be placed around any part of the
1688 assignment statement to quote blanks
1689 or tabs, i.\|e. `\fIset indentprefix="\->"\fR'.
1690 If an argument begins with
1691 .BR no ,
1692 as in `\fBset no\fIsave\fR',
1693 the effect is the same as invoking the
1694 .I unset
1695 command with the remaining part of the variable
1696 (`\fIunset \fIsave\fR').
1698 .B seen
1699 Takes a message list and marks all messages as having been read.
1701 .B shell
1702 (sh) Invokes an interactive version of the shell.
1704 .B shortcut
1705 Defines a shortcut name and its string for expansion,
1706 as described for the
1707 .I folder
1708 command.
1709 With no arguments,
1710 a list of defined shortcuts is printed.
1712 .B show
1713 (Sh) Like
1714 .IR print ,
1715 but performs neither MIME decoding nor decryption
1716 so that the raw message text is shown.
1718 .B size
1719 Takes a message list and prints out
1720 the size in characters of each message.
1722 .B sort
1723 Create a sorted representation of the current folder,
1724 and change the
1725 .I next
1726 command and the addressing modes
1727 such that they refer to messages in the sorted order.
1728 Message numbers are the same as in regular mode.
1729 If the
1730 .I header
1731 variable is set,
1732 a header summary in the new order is also printed.
1733 Possible sorting criteria are:
1736 .B date
1737 Sort the messages by their `Date:' field,
1738 that is by the time they were sent.
1740 .B from
1741 Sort messages by the value of their `From:' field,
1742 that is by the address of the sender.
1743 If the
1744 .I showname
1745 variable is set,
1746 the sender's real name (if any) is used.
1748 .B size
1749 Sort the messages by their size.
1751 .B score
1752 Sort the messages by their score.
1754 .B status
1755 Sort the messages by their message status
1756 (new, read, old, etc.).
1758 .B subject
1759 Sort the messages by their subject.
1761 .B thread
1762 Create a threaded order,
1763 as with the
1764 .I thread
1765 command.
1767 .B to
1768 Sort messages by the value of their `To:' field,
1769 that is by the address of the recipient.
1770 If the
1771 .I showname
1772 variable is set,
1773 the recipient's real name (if any) is used.
1776 If no argument is given,
1777 the current sorting criterion is printed.
1779 .B source
1780 The source command reads commands from a file.
1782 .B thread
1783 (th) Create a threaded representation of the current folder,
1784 i.\|e. indent messages that are replies to other messages
1785 in the header display,
1786 and change the
1787 .I next
1788 command and the addressing modes
1789 such that they refer to messages in the threaded order.
1790 Message numbers are the same as in unthreaded mode.
1791 If the
1792 .I header
1793 variable is set,
1794 a header summary in threaded order is also printed.
1796 .B top
1797 Takes a message list and prints the top few lines of each.
1798 The number of lines printed is controlled
1799 by the variable toplines
1800 and defaults to five.
1802 .B touch
1803 Takes a message list
1804 and marks the messages for saving in the
1805 .I mbox
1806 file.
1807 .I S-nail
1808 deviates from the POSIX standard with this command,
1809 as a `next' command issued after `mbox'
1810 will display the following message,
1811 not the current one.
1813 .B Type
1814 (T) Identical to the Print command.
1816 .B type
1817 (t) A synonym for print.
1819 .B unalias
1820 Takes a list of names defined by alias commands
1821 and discards the remembered groups of users.
1822 The group names no longer have any significance.
1824 .B unanswered
1825 Takes a message list and marks each message
1826 as not having been answered.
1828 .B uncollapse
1829 (unc)
1830 Only applicable to threaded mode.
1831 Takes a message list
1832 and makes the message and all replies to it visible
1833 in header summaries again.
1834 When a message becomes the current message,
1835 it is automatically made visible.
1836 Also when a message with collapsed replies is printed,
1837 all of these are automatically uncollapsed.
1839 .B undef
1840 Undefines each of the named macros.
1841 It is not an error to use a name that does not belong to
1842 one of the currently defined macros.
1844 .B undelete
1845 (u) Takes a message list and marks each message as not being deleted.
1847 .B undraft
1848 Takes a message list and marks each message
1849 as a draft.
1851 .B unflag
1852 Takes a message list and marks each message as not being `flagged'.
1854 .B unfwdignore
1855 Removes the header field names
1856 from the list of ignored fields for the
1857 .I forward
1858 command.
1860 .B unfwdretain
1861 Removes the header field names
1862 from the list of retained fields for the
1863 .I forward
1864 command.
1866 .B ungood
1867 Takes a message list and undoes the effect of a
1868 .I good
1869 command that was previously applied on exactly these messages.
1871 .B unignore
1872 Removes the header field names
1873 from the list of ignored fields.
1875 .B unjunk
1876 Takes a message list and undoes the effect of a
1877 .I junk
1878 command that was previously applied on exactly these messages.
1880 .B unkill
1881 Takes a message list and `unkills' each message.
1882 Also sets the score of the messages to 0.
1884 .B Unread
1885 Same as
1886 .IR unread .
1888 .B unread
1889 (U) Takes a message list and marks each message
1890 as not having been read.
1892 .B unretain
1893 Removes the header field names
1894 from the list of retained fields.
1896 .B unsaveignore
1897 Removes the header field names
1898 from the list of ignored fields for saving.
1900 .B unsaveretain
1901 Removes the header field names
1902 from the list of retained fields for saving.
1904 .B unset
1905 Takes a list of option names and discards their remembered
1906 values;
1907 the inverse of set.
1909 .B unshortcut
1910 Deletes the shortcut names given as arguments.
1912 .B unsort
1913 Disable sorted or threaded mode (see the
1914 .I sort
1916 .I thread
1917 commands), return to normal message order
1918 and,
1919 if the
1920 .I header
1921 variable is set,
1922 print a header summary.
1924 .B unthread
1925 (unth) Same as
1926 .IR unsort .
1928 .B verify
1929 (verif)
1930 Takes a message list and verifies each message.
1931 If a message is not an S/MIME signed message,
1932 verification will fail for it.
1933 The verification process checks
1934 if the message was signed using a valid certificate,
1935 if the message sender's email address matches
1936 one of those contained within the certificate,
1937 and if the message content has been altered.
1939 .B visual
1940 (v) Takes a message list and invokes the display editor
1941 on each message.
1942 Modified contents are discarded
1943 unless the
1944 .I writebackedited
1945 variable is set.
1947 .B write
1948 (w) For conventional messages,
1949 the body without all headers is written.
1950 The output is decrypted and converted
1951 to its native format, if necessary.
1952 If the output file exists,
1953 the text is appended.\(emIf a message is in MIME multipart format,
1954 its first part is written to the specified file
1955 as for conventional messages,
1956 and the user is asked for a filename
1957 to save each other part;
1958 if the contents of the first part are not to be saved,
1959 `write /dev/null' can be used.
1960 For the second and subsequent parts,
1961 if the filename given starts with a `|' character,
1962 the part is piped through the remainder of the filename
1963 interpreted as a shell command.
1964 In non-interactive mode, only the parts of the multipart message
1965 that have a filename given in the part header are written,
1966 the other are discarded.
1967 The original message is never marked for deletion
1968 in the originating mail folder.
1969 For attachments,
1970 the contents of the destination file are overwritten
1971 if the file previously existed.
1972 No special handling of compressed files is performed.
1974 .B xit
1975 (x) A synonym for exit.
1977 .B z
1978 \fIS-nail\fR presents message headers in windowfuls
1979 as described under the headers command.
1980 The z command scrolls to the next window of messages.
1981 If an argument is given,
1982 it specifies the window to use.
1983 A number prefixed by `+' or `\-' indicates
1984 that the window is calculated in relation
1985 to the current position.
1986 A number without a prefix specifies an
1987 absolute window number,
1988 and a `$' lets \fIs-nail\fR scroll
1989 to the last window of messages.
1991 .B Z
1992 Similar to
1993 .IR z ,
1994 but scrolls to the next or previous window
1995 that contains at least one new or `flagged' message.
1996 .SS "Tilde escapes"
1997 Here is a summary of the tilde escapes,
1998 which are used when composing
1999 messages to perform special functions.
2000 Tilde escapes are only recognized
2001 at the beginning of lines.
2002 The name `\fItilde escape\fR' is somewhat of a misnomer
2003 since the actual escape character can be set
2004 by the option escape.
2006 .BI ~! command
2007 Execute the indicated shell command,
2008 then return to the message.
2010 .B ~.
2011 Same effect as typing the end-of-file character.
2013 .BI ~< filename
2014 Identical to ~r.
2016 .BI ~<! command
2017 Command is executed using the shell.
2018 Its standard output is inserted into the message.
2020 \fB~@\fR [\fIfilename\fR .\ .\ . ]
2021 With no arguments, edit the attachment list.
2022 First, the user can edit all existing attachment data.
2023 If an attachment's file name is left empty,
2024 that attachment is deleted from the list.
2025 When the end of the attachment list is reached,
2026 .I s-nail
2027 will ask for further attachments,
2028 until an empty file name is given.
2029 If \fIfilename\fP arguments are specified,
2030 all of them are appended to the end of the attachment list.
2031 Filenames which contain white space
2032 can only be specified
2033 with the first method (no \fIfilename\fP arguments).
2035 .B ~A
2036 Inserts the string contained in the
2037 .I Sign
2038 variable
2039 (same as `~i Sign').
2040 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
2041 are understood.
2043 .B ~a
2044 Inserts the string contained in the
2045 .B sign
2046 variable
2047 (same as `~i sign').
2048 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
2049 are understood.
2051 .BI ~b "name .\ .\ ."
2052 Add the given names to the list of carbon copy recipients
2053 but do not make the names visible in the Cc: line
2054 (`blind' carbon copy).
2056 .BI ~c "name .\ .\ ."
2057 Add the given names to the list of carbon copy recipients.
2059 .B ~d
2060 Read the file `dead.letter' from the user's home directory
2061 into the message.
2063 .B ~e
2064 Invoke the text editor on the message collected so far.
2065 After the editing session is finished,
2066 the user may continue appending text
2067 to the message.
2069 .BI ~f messages
2070 Read the named messages into the message being sent.
2071 If no messages are specified,
2072 read in the current message.
2073 Message headers currently being ignored
2074 (by the ignore or retain command)
2075 are not included.
2076 For MIME multipart messages,
2077 only the first printable part is included.
2079 .BI ~F messages
2080 Identical to ~f, except all message headers and
2081 all MIME parts are included.
2083 .B ~h
2084 Edit the message header fields
2085 `To:', `Cc:', `Bcc:', and `Subject:'
2086 by typing each one in turn
2087 and allowing the user to append text
2088 to the end or modify the field
2089 by using the current terminal erase and kill characters.
2091 .B ~H
2092 Edit the message header fields
2093 `From:', `Reply-To:', `Sender:', and `Organization:'
2094 in the same manner as described for
2095 .IR ~h .
2096 The default values for these fields originate from the
2097 .IR from ,
2098 .IR replyto ,
2100 .I ORGANIZATION
2101 variables.
2102 If this tilde command has been used,
2103 changing the variables has no effect on the current message anymore.
2105 .BI ~i variable
2106 Insert the value of the specified variable
2107 into the message adding a newline character at the end.
2108 If the variable is unset or empty,
2109 the message remains unaltered.
2110 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
2111 are understood.
2113 .BI ~m messages
2114 Read the named messages into the message being sent,
2115 indented by a tab or by the value of indentprefix.
2116 If no messages are specified,
2117 read the current message.
2118 Message headers currently being ignored
2119 (by the ignore or retain command)
2120 are not included.
2121 For MIME multipart messages,
2122 only the first printable part is included.
2124 .BI ~M messages
2125 Identical to ~m, except all message headers and
2126 all MIME parts are included.
2128 .B ~p
2129 Print out the message collected so far,
2130 prefaced by the message header fields
2131 and followed by the attachment list, if any.
2132 If the message text is longer than the screen size,
2133 it is piped through the pager.
2135 .B ~q
2136 Abort the message being sent,
2137 copying the message to
2138 `dead.letter' in the user's home directory
2139 if save is set.
2141 .BI ~r filename
2142 Read the named file into the message.
2144 .BI ~s string
2145 Cause the named string to become the current subject field.
2147 .BI ~t "name .\ .\ ."
2148 Add the given names to the direct recipient list.
2150 .B ~v
2151 Invoke an alternate editor
2152 (defined by the VISUAL option)
2153 on the message collected so far.
2154 Usually, the alternate editor
2155 will be a screen editor.
2156 After the editor is quit,
2157 the user may resume appending text
2158 to the end of the message.
2160 .BI ~w filename
2161 Write the message onto the named file.
2162 If the file exists,
2163 the message is appended to it.
2165 .B ~x
2166 Same as ~q,
2167 except that the message is not saved to the `dead.letter' file.
2169 .BI ~| command
2170 Pipe the message through the command as a filter.
2171 If the command gives no output or terminates abnormally,
2172 retain the original text of the message.
2173 The command
2174 .IR fmt (1)
2175 is often used
2176 as command to rejustify the message.
2178 .BI ~: s-nail-command
2179 Execute the given \fIs-nail\fR command.
2180 Not all commands, however, are allowed.
2182 .BI ~_ s-nail-command
2183 Identical to ~:.
2185 .BI ~~ string
2186 Insert the string of text in the message
2187 prefaced by a single ~.
2188 If the escape character has been changed,
2189 that character must be doubled
2190 in order to send it at the beginning of a line.
2191 .SS "Variable options"
2192 Options are controlled via set and unset commands,
2193 see their entries for a syntax description.
2194 An option is also set
2195 if it is passed to \fIs-nail\fR
2196 as part of the environment
2197 (this is not restricted to specific variables as in the POSIX standard).
2198 A value given in a startup file overrides
2199 a value imported from the environment.
2200 Options may be either binary,
2201 in which case it is only significant
2202 to see whether they are set or not;
2203 or string, in which case the actual value is of interest.
2204 .SS "Binary options"
2206 The binary options include the following:
2208 .B allnet
2209 Causes only the local part to be evaluated
2210 when comparing addresses.
2212 .B append
2213 Causes messages saved in mbox to be appended to the end
2214 rather than prepended.
2215 This should always be set.
2217 .BR ask \ or \ asksub
2218 Causes \fIs-nail\fR to prompt for the subject
2219 of each message sent.
2220 If the user responds with simply a newline,
2221 no subject field will be sent.
2223 .B askatend
2224 Causes the prompts for `Cc:' and `Bcc:' lists
2225 to appear after the message has been edited.
2227 .B askattach
2228 If set, \fIs-nail\fR asks for files to attach at the end of each message.
2229 Responding with a newline indicates not to include an attachment.
2231 .B askcc
2232 Causes the user to be prompted
2233 for additional carbon copy recipients
2234 (at the end of each message if
2235 .I askatend
2237 .I bsdcompat
2238 is set).
2239 Responding with a newline
2240 indicates the user's satisfaction with the current list.
2242 .B askbcc
2243 Causes the user to be prompted
2244 for additional blind carbon copy recipients
2245 (at the end of each message if
2246 .I askatend
2248 .I bsdcompat
2249 is set).
2250 Responding with a newline
2251 indicates the user's satisfaction with the current list.
2253 .B asksign
2254 Causes the user to be prompted
2255 if the message is to be signed
2256 at the end of each message.
2258 .I smime-sign
2259 variable is ignored when this variable is set.
2261 .B autocollapse
2262 Causes threads to be collapsed automatically when
2263 threaded mode is entered
2264 (see the
2265 .I collapse
2266 command).
2268 .B autoinc
2269 Same as
2270 .IR newmail .
2272 .B autoprint
2273 Causes the delete command to behave like dp \-
2274 thus, after deleting a message,
2275 the next one will be typed automatically.
2277 .B autothread
2278 Causes threaded mode (see the
2279 .I thread
2280 command) to be entered automatically
2281 when a folder is opened.
2283 .B bang
2284 Enables the substitution of `\fB!\fR'
2285 by the contents of the last command line
2286 in shell escapes.
2288 .B bsdannounce
2289 Causes automatic display of a header summary after executing a
2290 .I folder
2291 command.
2293 .B bsdcompat
2294 Sets some cosmetical features to traditional BSD style;
2295 has the same affect as setting `askatend' and
2296 all other variables prefixed with `bsd',
2297 setting prompt to `&\ ', and changing the default pager to
2298 .IR more .
2300 .B bsdflags
2301 Changes the letters printed in the first column of a header summary
2302 to traditional BSD style.
2304 .B bsdheadline
2305 Changes the display of columns in a header summary
2306 to traditional BSD style.
2308 .B bsdmsgs
2309 Changes some informational messages
2310 to traditional BSD style.
2312 .B bsdorder
2313 Causes the `Subject:' field to appear
2314 immediately after the `To:' field
2315 in message headers and with the
2316 .I ~h
2317 tilde command.
2319 .B bsdset
2320 Changes the output format of the
2321 .I set
2322 command to traditional BSD style.
2324 .B chained-junk-tokens
2325 Normally, the Bayesian junk mail filter bases its classifications
2326 on single word tokens extracted from messages.
2327 If this option is set,
2328 adjacent words are combined to pairs,
2329 which are then used as additional tokens.
2330 This usually improves the accuracy of the filter,
2331 but also increases the junk mail database
2332 five- to tenfold.
2334 .B datefield
2335 The date in a header summary
2336 is normally the date of the mailbox `From\ ' line of the message.
2337 If this variable is set,
2338 the date as given in the `Date:' header field is used,
2339 converted to local time.
2341 .B debug
2342 Prints debugging messages and disables the actual delivery of messages.
2343 Unlike
2344 .IR verbose ,
2345 this option is intended for
2346 .I s-nail
2347 development only.
2349 .B disconnected
2350 When an IMAP mailbox is selected and this variable is set,
2351 no connection to the server is initiated.
2352 Instead, data is obtained from the local cache (see
2353 .IR imap-cache ).
2354 Mailboxes that are not present in the cache
2355 and messages that have not yet entirely been fetched from the server
2356 are not available;
2357 to fetch all messages in a mailbox at once,
2358 the command `copy * /dev/null' can be used
2359 while still in
2360 .I online
2361 mode.
2362 Changes that are made to IMAP mailboxes in disconnected mode
2363 are queued and committed later
2364 when a connection to that server is opened in online mode.
2365 This procedure is not completely reliable
2366 since it cannot be guaranteed that the IMAP unique identifiers (UIDs)
2367 on the server still match the ones in the cache at that time.
2368 Data is saved to `dead.letter' when this problem occurs.
2370 \fBdisconnected-\fIuser\fB@\fIhost\fR
2371 The specified account is handled as described for the
2372 .I disconnected
2373 variable above,
2374 but other accounts are not affected.
2376 .B dot
2377 The binary option dot causes \fIs-nail\fR to interpret
2378 a period alone on a line
2379 as the terminator of a message the user is sending.
2381 .B editheaders
2382 When a message is edited while being composed,
2383 its header is included in the editable text.
2384 `To:', `Cc:', `Bcc:', `Subject:', `From:', `Reply-To:', `Sender:',
2385 and 'Organization:'
2386 fields are accepted within the header,
2387 other fields are ignored.
2389 .B emptybox
2390 If set, an empty mailbox file is not removed.
2391 This may improve the interoperability with other mail user agents
2392 when using a common folder directory.
2394 .B emptystart
2395 If the mailbox is empty,
2396 \fIs-nail\fR normally prints \fI`No mail for user'\fR
2397 and exits immediately.
2398 If this option is set,
2399 \fIs-nail\fR starts even with an empty mailbox.
2401 .B flipr
2402 Exchanges the
2403 .I Respond
2404 with the
2405 .I respond
2406 commands and vice-versa.
2408 .B forward-as-attachment
2409 Original messages are normally sent as inline text with the
2410 .I forward
2411 command,
2412 and only the first part of a multipart message is included.
2413 With this option,
2414 messages are sent as MIME
2415 .I message/rfc822
2416 attachments,
2417 and all of their parts are included.
2419 .I fwdignore
2421 .I fwdretain
2422 options are ignored when the
2423 .I forward-as-attachment
2424 option is set.
2426 .B fullnames
2427 When replying to a message,
2428 \fIs-nail\fR normally removes the comment parts of email addresses,
2429 which by convention contain the full names of the recipients.
2430 If this variable is set,
2431 such stripping is not performed,
2432 and comments are retained.
2434 .B header
2435 Causes the header summary to be written at startup
2436 and after commands that affect the number of messages
2437 or the order of messages in the current folder;
2438 enabled by default.
2440 .B hold
2441 This option is used to hold messages
2442 in the system mailbox by default.
2444 .B ignore
2445 Causes interrupt signals from the terminal
2446 to be ignored and echoed as @'s.
2448 .B ignoreeof
2449 An option related to dot is ignoreeof
2450 which makes \fIs-nail\fR refuse to
2451 accept a control-d as the end of a message.
2452 Ignoreeof also applies to \fIs-nail\fR command mode.
2454 .B imap-use-starttls
2455 Causes
2456 .I s-nail
2457 to issue a STARTTLS command
2458 to make an unencrypted IMAP session SSL/TLS encrypted.
2459 This functionality is not supported by all servers,
2460 and is not used if the session is already encrypted by the IMAPS method.
2462 \fBimap-use-starttls-\fIuser\fB@\fIhost\fR
2463 Activates
2464 .I imap-use-starttls
2465 for a specific account.
2467 .B keep
2468 This option causes \fIs-nail\fR to truncate the user's system mailbox
2469 instead of deleting it when it is empty.
2470 This should always be set,
2471 since it prevents malicious users
2472 from creating fake mail folders
2473 in a world-writable spool directory.
2475 .B keepsave
2476 When a message is saved,
2477 it is usually discarded
2478 from the originating folder
2479 when
2480 .I s-nail
2481 is quit.
2482 Setting this option
2483 causes all saved message to be retained.
2485 .B markanswered
2486 When a message is replied to
2487 and this variable is set,
2488 it is marked as having been answered.
2489 This mark has no technical meaning in the mail system;
2490 it just causes messages to be marked in the header summary,
2491 and makes them specially addressable.
2493 .B metoo
2494 Usually, when a group is expanded
2495 that contains the sender,
2496 the sender is removed from the expansion.
2497 Setting this option causes
2498 the sender to be included in the group.
2500 .B newmail
2501 Checks for new mail in the current folder
2502 each time the prompt is printed.
2503 For IMAP mailboxes,
2504 the server is then polled for new mail,
2505 which may result in delayed operation
2506 if the connection to the server is slow.
2508 .I maildir
2509 folder must be re-scanned to determine
2510 if new mail has arrived.
2512 If this variable is set to the special value
2513 .BR nopoll ,
2514 an IMAP server is not actively asked for new mail,
2515 but new mail may still be detected and announced
2516 with any other IMAP command that is sent to the server.
2518 .I maildir
2519 folder is not scanned then.
2521 In any case,
2522 the IMAP server may send notifications about messages
2523 that have been deleted on the server
2524 by another process or client.
2525 In this case, `Expunged \fIn\fR messages' is printed
2526 regardless of this variable,
2527 and message numbers may have changed.
2529 .B noheader
2530 Setting the option noheader is the same
2531 as giving the \-N flag on the command line.
2533 .B outfolder
2534 Causes the filename given in the
2535 .I record
2536 variable
2537 and the sender-based filenames for the
2538 .I Copy
2540 .I Save
2541 commands
2542 to be interpreted relative to the directory given in the
2543 .I folder
2544 variable rather than to the current directory
2545 unless it is an absolute pathname.
2547 .B page
2548 If set, each message the \fIpipe\fR command prints out
2549 is followed by a formfeed character.
2551 .B piperaw
2552 Send messages to the
2553 .I pipe
2554 command without performing MIME and character set conversions.
2556 .B pop3-use-apop
2557 If this variable is set,
2558 the APOP authentication method is used
2559 when a connection to a POP3 server is initiated.
2560 The advantage of this method over the usual USER/PASS authentication is
2561 that the password is not sent over the network in clear text.
2562 The connection fails
2563 if the server does not support the APOP command.
2565 \fBpop3-use-apop-\fIuser\fB@\fIhost\fR
2566 Enables
2567 .I pop3-use-apop
2568 for a specific account.
2570 .B pop3-use-starttls
2571 Causes
2572 .I s-nail
2573 to issue a STLS command
2574 to make an unencrypted POP3 session SSL/TLS encrypted.
2575 This functionality is not supported by all servers,
2576 and is not used if the session is already encrypted by the POP3S method.
2578 \fBpop3-use-starttls-\fIuser\fB@\fIhost\fR
2579 Activates
2580 .I pop3-use-starttls
2581 for a specific account.
2583 .B print-all-chars
2584 This option causes all characters to be considered printable.
2585 It is only effective if given in a startup file.
2586 With this option set,
2587 some character sequences in messages
2588 may put the user's terminal in an undefined state
2589 when printed;
2590 it should only be used as a last resort
2591 if no working system locale can be found.
2593 .B print-alternatives
2594 When a MIME message part of type
2595 .I multipart/alternative
2596 is displayed and it contains a subpart of type
2597 .IR text/plain ,
2598 other parts are normally discarded.
2599 Setting this variable causes all subparts to be displayed,
2600 just as if the surrounding part was of type
2601 .IR multipart/mixed .
2603 .B quiet
2604 Suppresses the printing of the version when first invoked.
2606 .B recipients-in-cc
2607 On group replies, specify only the sender of the original mail
2608 in \fI`To:'\fR and mention it's other recipients in the secondary
2609 \fI`Cc:'\fR.
2611 .B record-resent
2612 If both this variable and the
2613 .I record
2614 variable are set,
2616 .I resend
2618 .I Resend
2619 commands save messages to the
2620 .I record
2621 folder as it is normally only done for newly composed messages.
2623 .B reply-in-same-charset
2624 If this variable is set,
2625 .I s-nail
2626 first tries to use the same character set
2627 of the original message for replies.
2628 If this fails,
2630 .I sendcharsets
2631 variable is evaluated as usual.
2633 .B Replyall
2634 Reverses the sense of reply and Reply commands.
2636 .B save
2637 When the user aborts a message
2638 with two RUBOUT (interrupt characters)
2639 \fIs-nail\fR copies the partial letter
2640 to the file `dead.letter' in the home directory.
2641 This option is set by default.
2643 .B searchheaders
2644 If this option is set, then
2645 a message-list specifier in the form `\fI/x:y\fR'
2646 will expand to all messages containing
2647 the substring `\fIy\fR' in the header field `\fIx\fR'.
2648 The string search is case insensitive.
2650 .B sendwait
2651 When sending a message,
2652 wait until the mail transfer agent exits
2653 before accepting further commands.
2654 If the mail transfer agent returns a non-zero exit status,
2655 the exit status of s-nail will also be non-zero.
2657 .B showlast
2658 Setting this option causes \fIs-nail\fR to start at the
2659 last message instead of the first one when opening a mail folder.
2661 .B showname
2662 Causes
2663 .I s-nail
2664 to use the sender's real name instead of the plain address
2665 in the header field summary and in message specifications.
2667 .B showto
2668 Causes the recipient of the message to be shown in the header summary
2669 if the message was sent by the user.
2671 .B skipemptybody
2672 If an outgoing message does not contain any text
2673 in its first or only message part,
2674 do not send it but discard it silently
2675 (see also the
2676 .I \-E
2677 option).
2679 .B smime-force-encryption
2680 Causes
2681 .I s-nail
2682 to refuse sending unencrypted messages.
2684 .B smime-sign
2685 If this variable is set,
2686 outgoing messages are S/MIME signed with the user's private key.
2687 Signing a message enables a recipient to verify
2688 that the sender used a valid certificate,
2689 that the email addresses in the certificate
2690 match those in the message header,
2691 and that the message content has not been altered.
2692 It does not change the message text,
2693 and people will be able to read the message as usual.
2695 .B smime-no-default-ca
2696 Do not load the default CA locations
2697 when verifying S/MIME signed messages.
2698 Only applicable if S/MIME support is built using OpenSSL.
2700 .B smtp-use-starttls
2701 Causes \fIs-nail\fR to issue a STARTTLS command
2702 to make an SMTP session SSL/TLS encrypted.
2703 Not all servers support this command;
2704 because of common implementation defects,
2705 it cannot be automatically determined
2706 whether a server supports it or not.
2708 .B ssl-no-default-ca
2709 Do not load the default CA locations
2710 to verify SSL/TLS server certificates.
2711 Only applicable if SSL/TLS support is built using OpenSSL.
2713 .B ssl-v2-allow
2714 Accept SSLv2 connections.
2715 These are normally not allowed
2716 because this protocol version is insecure.
2718 .B stealthmua
2719 Inhibits the generation of
2720 the \fI`Message-Id:'\fR and \fI`User-Agent:'\fR
2721 header fields that include obvious references to \fIs-nail\fR.
2722 There are two pitfalls associated with this:
2723 First, the message id of outgoing messages is not known anymore.
2724 Second, an expert may still use the remaining information in the header
2725 to track down the originating mail user agent.
2727 .B verbose
2728 Setting the option verbose is the same
2729 as using the \-v flag on the command line.
2730 When \fIs-nail\fR runs in verbose mode,
2731 details of the actual message delivery
2732 and protocol conversations for IMAP, POP3, and SMTP,
2733 as well as of other internal processes,
2734 are displayed on the user's terminal,
2735 This is sometimes useful to debug problems.
2736 .I S-nail
2737 prints all data that is sent to remote servers in clear texts,
2738 including passwords,
2739 so care should be taken that no unauthorized option
2740 can view the screen if this option is enabled.
2742 .B writebackedited
2743 If this variable is set,
2744 messages modified using the
2745 .I edit
2747 .I visual
2748 commands are written back to the current folder when it is quit.
2749 This is only possible for writable folders in
2750 .I mbox
2751 format.
2752 Setting this variable also disables
2753 MIME decoding and decryption for the editing commands.
2754 .SS "String Options"
2756 The string options include the following:
2758 .B attrlist
2759 A sequence of characters to print in the `attribute'
2760 column of a header summary,
2761 each for one type of messages in the following order:
2762 new,
2763 unread but old,
2764 new but read,
2765 read and old,
2766 saved,
2767 preserved,
2768 mboxed,
2769 flagged,
2770 answered,
2771 draft,
2772 killed,
2773 start of a collapsed thread,
2774 collapsed,
2775 classified as junk.
2776 The default is `NUROSPMFATK+\-J',
2777 or `NU\ \ *HMFATK+\-J' if
2778 .I bsdflags
2779 or the
2780 .I SYSV3
2781 environment variable
2782 are set.
2784 .B autobcc
2785 Specifies a list of recipients to which
2786 a blind carbon copy of each outgoing message
2787 will be sent automatically.
2789 .B autocc
2790 Specifies a list of recipients to which
2791 a carbon copy of each outgoing message
2792 will be sent automatically.
2794 .B autosort
2795 Causes sorted mode (see the
2796 .I sort
2797 command) to be entered automatically
2798 with the value of this option as sorting method
2799 when a folder is opened.
2801 .B cmd
2802 The default value for the \fIpipe\fR command.
2804 .B crt
2805 The valued option crt is used as a threshold
2806 to determine how long a message must be
2807 before PAGER is used to read it.
2808 If crt is set without a value,
2809 then the height of the terminal screen stored in the system
2810 is used to compute the threshold (see
2811 .IR stty (1)).
2813 .B DEAD
2814 The name of the file to use
2815 for saving aborted messages.
2816 This defaults to `dead.letter'
2817 in the user's home directory.
2819 .B EDITOR
2820 Pathname of the text editor to use
2821 in the edit command and ~e escape.
2822 If not defined,
2823 then a default editor is used.
2825 .B encoding
2826 The default MIME encoding to use
2827 in outgoing text messages and message parts.
2828 Valid values are \fI8bit\fR or \fIquoted-printable\fR.
2829 The default is \fI8bit\fR.
2830 In case the mail transfer system
2831 is not ESMTP compliant,
2832 \fIquoted-printable\fR should be used instead.
2833 If there is no need to encode a message,
2834 \fI7bit\fR transfer mode is used,
2835 without regard to the value of this variable.
2836 Binary data is always encoded in \fIbase64\fR mode.
2838 .B escape
2839 If defined, the first character of this option
2840 gives the character to use in the place of ~ to denote escapes.
2842 .B folder
2843 The name of the directory to use
2844 for storing folders of messages.
2845 All folder names that begin with `+'
2846 refer to files below that directory.
2847 If the directory name begins with a `/',
2848 \fIs-nail\fR considers it to be an absolute pathname;
2849 otherwise, the folder directory is found
2850 relative to the user's home directory.
2852 The directory name may also refer to an IMAP account;
2853 any names that begin with `+'
2854 then refer to IMAP mailboxes on that account.
2855 An IMAP folder is normally given in the form
2858     imaps://mylogin@imap.myisp.example
2861 In this case,
2862 the `+' and `@' prefixes for folder names
2863 have the same effect
2864 (see the
2865 .I folder
2866 command).
2868 Some IMAP servers do not accept the creation of mailboxes
2869 in the hierarchy base;
2870 they require that they are created as subfolders of `INBOX'.
2871 With such servers,
2872 a folder name of the form
2875     imaps://mylogin@imap.myisp.example/INBOX.\&
2878 should be used
2879 (the last character is the server's hierarchy delimiter).
2880 Folder names prefixed by `+' will then refer to folders below `INBOX',
2881 while folder names prefixed by `@'
2882 refer to folders below the hierarchy base.
2883 See the
2884 .I imap namespace
2885 command for a method to detect the appropriate prefix and delimiter.
2887 .B folder-hook
2888 When a folder is opened and this variable is set,
2889 the macro corresponding to the value of this variable is executed.
2890 The macro is also invoked when new mail arrives,
2891 but message lists for commands executed from the macro
2892 only include newly arrived messages then.
2894 \fBfolder-hook-\fIfullname\fR
2895 When a folder named
2896 .I fullname
2897 is opened,
2898 the macro corresponding to the value of this variable is executed.
2899 Unlike other folder specifications,
2900 the fully expanded name of a folder, without metacharacters,
2901 is used to avoid ambiguities.
2902 The macro specified with
2903 .I folder-hook
2904 is not executed if this variable is effective for a folder
2905 (unless it is explicitly invoked within the called macro).
2907 .B from
2908 The address (or a list of addresses)
2909 to put into the \fI`From:'\fR field of the message header.
2910 If replying to a message,
2911 these addresses are handled as if they were in the alternates list.
2912 .\" If this variable is set,
2913 .\" a \fI`Sender:'\fR field containing the user's name
2914 .\" is also generated,
2915 .\" unless the variable \fIsmtp\fR is set
2916 .\" and its value differs from \fIlocalhost\fR.
2917 If the machine's hostname is not valid at the Internet
2918 (for example at a dialup machine),
2919 either this variable or
2920 .I hostname
2921 have to be set
2922 to get correct Message-ID header fields.
2924 .I from
2925 contains more than one address,
2927 .I sender
2928 variable must also be set.
2930 .B fwdheading
2931 The string to print before the text of a message
2932 with the
2933 .I forward
2934 command
2935 (unless the
2936 .I forward-as-attachment
2937 variable is set).
2938 Defaults to ``-------- Original Message --------'' if unset.
2939 If it is set to the empty string,
2940 no heading is printed.
2942 .B headline
2943 A format string to use for the header summary,
2944 similar to
2945 .I printf
2946 formats.
2947 A `%' character introduces a format specifier.
2948 It may be followed by a number indicating the field width.
2949 If the field is a number,
2950 the width may be negative,
2951 which indicates that it is to be left-aligned.
2952 Valid format specifiers are:
2954 .in +4m
2956 l4fB l.
2957 %a      Message attributes.
2958 %c      The score of the message.
2959 %d      The date when the message was received.
2960 %e      The indenting level in threaded mode.
2961 %f      The address of the message sender.
2962 %i      The message thread structure.
2963 %l      The number of lines of the message.
2964 %m      Message number.
2965 %o      The number of octets (bytes) in the message.
2966 %s      Message subject (if any).
2967 %S      Message subject (if any) in double quotes.
2968 %t      The position in threaded/sorted order.
2969 %>      A `>' for the current message, otherwise ` '.
2970 %<      A `<' for the current message, otherwise ` '.
2971 %%      A `%' character.
2973 .in -4m
2975 The default is `%>\&%a\&%m\ %18f\ %16d\ %4l/%\-5o\ %i%s',
2976 or `%>\&%a\&%m\ %20f\ \ %16d\ %3l/%\-5o\ %i%S' if
2977 .I bsdcompat
2978 is set.
2980 .B hostname
2981 Use this string as hostname
2982 when expanding local addresses
2983 instead of the value obtained from
2984 .IR uname (2)
2986 .IR getaddrinfo (3).
2988 .B imap-auth
2989 Sets the IMAP authentication method.
2990 Valid values are `login' for the usual password-based authentication
2991 (the default),
2992 `cram-md5', which is a password-based authentication
2993 that does not send the password over the network in clear text,
2994 and `gssapi' for GSSAPI-based authentication.
2996 \fBimap-auth-\fIuser\fB@\fIhost\fR
2997 Sets the IMAP authentication method for a specific account.
2999 .B imap-cache
3000 Enables caching of IMAP mailboxes.
3001 The value of this variable must point to a directory
3002 that is either existent or can be created by
3003 .IR s-nail .
3004 All contents of the cache can be deleted by
3005 .I s-nail
3006 at any time;
3007 it is not safe to make assumptions about them.
3009 .B imap-keepalive
3010 IMAP servers may close the connection
3011 after a period of inactivity;
3012 the standard requires this to be at least 30 minutes,
3013 but practical experience may vary.
3014 Setting this variable to a numeric
3015 .I value
3016 greater than 0
3017 causes a NOOP command to be sent each
3018 .I value
3019 seconds if no other operation is performed.
3021 .B imap-list-depth
3022 When retrieving the list of folders on an IMAP server, the
3023 .I folders
3024 command stops after it has reached a certain depth
3025 to avoid possible infinite loops.
3026 The value of this variable sets the maximum depth allowed.
3027 The default is 2.
3028 If the folder separator on the current IMAP server is a slash `/',
3029 this variable has no effect,
3030 and the
3031 .I folders
3032 command does not descend to subfolders.
3034 .B indentprefix
3035 String used by the `\fI~m\fR' and `\fI~M\fR' tilde escapes
3036 and by the \fIquote\fR option
3037 for indenting messages,
3038 in place of the normal tab character (^I).
3039 Be sure to quote the value
3040 if it contains spaces or tabs.
3042 .B junkdb
3043 The location of the junk mail database.
3044 The string is treated like a folder name,
3045 as described for the
3046 .I folder
3047 command.
3049 The files in the junk mail database are normally stored in
3050 .IR compress (1)
3051 format for saving space.
3052 If processing time is considered more important,
3053 .IR uncompress (1)
3054 can be used to store them in plain form.
3055 .I S-nail
3056 will then work using the uncompressed files.
3058 .B LISTER
3059 Pathname of the directory lister
3060 to use in the
3061 .I folders
3062 command
3063 when operating on local mailboxes.
3064 Default is /bin/ls.
3066 .B MAIL
3067 Is used as the user's mailbox, if set.
3068 Otherwise, a system-dependent default is used.
3069 Can be a
3070 \fIprotocol\fB://\fR
3071 string (see the
3072 .I folder
3073 command for more information).
3075 .B SNAIL_HEAD
3076 A string to put at the beginning of each new message.
3077 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
3078 are understood.
3080 .B SNAIL_TAIL
3081 A string to put at the end of each new message.
3082 The escape sequences `\fB\et\fR' (tabulator) and `\fB\en\fR' (newline)
3083 are understood.
3085 .B maximum-unencoded-line-length
3086 Messages that contain lines longer than the value of this variable
3087 are encoded in quoted-printable
3088 even if they contain only ASCII characters.
3089 The maximum effective value is 950.
3090 If set to 0,
3091 all ASCII text messages are encoded in quoted-printable.
3092 S/MIME signed messages are always encoded
3093 in quoted-printable regardless of the value of this variable.
3095 .B MBOX
3096 The name of the mbox file.
3097 It can be the name of a folder.
3098 The default is `\fImbox\fR'
3099 in the user's home directory.
3101 .B SNAIL_EXTRA_RC
3102 The name of an optional startup file
3103 to be read after ~/.mailrc.
3104 This variable is ignored if it is imported from the environment;
3105 it has an effect only if it is set in /etc/nail.rc or ~/.mailrc
3106 to allow bypassing the configuration with e. g. `MAILRC=/dev/null'.
3107 Use this file for commands
3108 that are not understood by other s-nail implementations.
3110 .B newfolders
3111 If this variable has the value
3112 .BR maildir ,
3113 newly created local folders will be in
3114 .I maildir
3115 format.
3117 .B nss-config-dir
3118 A directory that contains the files
3119 .RI cert N .db
3120 to retrieve certificates,
3121 .RI key N .db
3122 to retrieve private keys,
3123 and secmod.db,
3124 where
3125 .I N
3126 is a digit.
3127 These are usually taken from Mozilla installations,
3128 so an appropriate value might be
3129 `~/.mozilla/firefox/default.clm'.
3130 .I S-nail
3131 opens these files read-only
3132 and does not modify them.
3133 However, if the files are modified by Mozilla
3134 while
3135 .I s-nail
3136 is running,
3137 it will print a `Bad database' message.
3138 It may be necessary to create copies of these files
3139 that are exclusively used by
3140 .I s-nail
3141 then.
3142 Only applicable if S/MIME and SSL/TLS support is built using
3143 Network Security Services (NSS).
3145 .B ORGANIZATION
3146 The value to put into the \fI`Organization:'\fR field of the message header.
3148 .B PAGER
3149 Pathname of the program to use
3150 in the more command
3151 or when crt variable is set.
3152 The default paginator
3153 .IR pg (1)
3154 or, in BSD compatibility mode,
3155 .IR more (1)
3156 is used
3157 if this option is not defined.
3159 \fBpassword-\fIuser\fB@\fIhost\fR
3160 Set the password for
3161 .I user
3162 when connecting to
3163 .IR host .
3164 If no such variable is defined for a host,
3165 the user will be asked for a password on standard input.
3166 Specifying passwords in a startup file
3167 is generally a security risk,
3168 the file should be readable
3169 by the invoking user only.
3171 .BI pipe- content/subcontent
3172 When a MIME message part of
3173 .I content/subcontent
3174 type is displayed or it is replied to,
3175 its text is filtered through the value of this variable
3176 interpreted as a shell command.
3177 Special care must be taken when using such commands
3178 as mail viruses may be distributed by this method;
3179 if messages of type
3180 .I application/x-sh
3181 were filtered through the shell, for example,
3182 a message sender could easily execute arbitrary code
3183 on the system
3184 .I s-nail
3185 is running on.
3187 .B pop3-keepalive
3188 POP3 servers may close the connection
3189 after a period of inactivity;
3190 the standard requires this to be at least 10 minutes,
3191 but practical experience may vary.
3192 Setting this variable to a numeric
3193 .I value
3194 greater than 0
3195 causes a NOOP command to be sent each
3196 .I value
3197 seconds if no other operation is performed.
3199 .B prompt
3200 The string printed when a command is accepted.
3201 Defaults to `\fB?\ \fR',
3202 or to `\fB&\ \fR' if the
3203 .I bsdcompat
3204 variable is set.
3206 .B quote
3207 If set, \fIs-nail\fR starts a replying message with the original message
3208 prefixed by the value of the variable \fIindentprefix\fR.
3209 Normally, a heading consisting of `Fromheaderfield wrote:' is printed
3210 before the quotation.
3211 If the string \fInoheading\fR is assigned to the \fIquote\fR variable,
3212 this heading is omitted.
3213 If the string \fIheaders\fR is assigned,
3214 the headers selected by the ignore/retain commands
3215 are printed above the message body,
3216 thus \fIquote\fR acts like an automatic ~m command then.
3217 If the string \fIallheaders\fR is assigned,
3218 all headers are printed above the message body,
3219 and all MIME parts are included,
3220 thus \fIquote\fR acts like an automatic ~M command then.
3222 .B quote-fold
3223 If set in addition to \fIindentprefix\fR, \fIs-nail\fR interprets this
3224 number as the maximum line length of the quotation when replying to a
3225 message.
3226 Setting this turns on a more fancy quotation algorithm in that leading
3227 quotation characters are compressed and overlong lines are folded to
3228 \fIquote-fold\fR characters each, breaking at whitespace as necessary
3229 and starting the follow lines with fillers to pad up to the last
3230 quotation markers width.
3231 The value of \fIquote-fold\fR can't be smaller than the length of
3232 \fIindentprefix\fR plus some additional pad.  It is automatically
3233 adjusted to the minimum as necessary.
3235 .B record
3236 If defined, gives the pathname of the folder
3237 used to record all outgoing mail.
3238 If not defined,
3239 then outgoing mail is not so saved.
3240 When saving to this folder fails,
3241 the message is not sent
3242 but saved to the `dead.letter' file instead.
3244 .B replyto
3245 A list of addresses to put into the \fI`Reply-To:'\fR field
3246 of the message header.
3247 If replying to a message, such addresses are handled
3248 as if they were in the alternates list.
3250 .B screen
3251 When \fIs-nail\fR initially prints the message headers,
3252 it determines the number to print
3253 by looking at the speed of the terminal.
3254 The faster the terminal, the more it prints.
3255 This option overrides this calculation
3256 and specifies how many message headers
3257 are printed.
3258 This number is also used
3259 for scrolling with the z command.
3261 .B sendcharsets
3262 A comma-separated list of character set names
3263 that can be used in Internet mail.
3264 When a message that contains characters not representable in US-ASCII
3265 is prepared for sending,
3266 .I s-nail
3267 tries to convert its text
3268 to each of the given character sets in order
3269 and uses the first appropriate one.
3270 The default is `utf-8'.
3272 Character sets assigned to this variable should be ordered
3273 in ascending complexity.
3274 That is, the list should start with e.\|g.
3275 `iso-8859-1' for compatibility with older mail clients,
3276 might contain some other language-specific character sets,
3277 and should end with `utf-8'
3278 to handle messages that combine texts in multiple languages.
3280 .B sender
3281 An address that is put into the `Sender:' field
3282 of outgoing messages.
3283 This field needs not normally be present.
3284 It is, however, required
3285 if the `From:' field contains more than one address.
3286 It can also be used to indicate that a message
3287 was sent on behalf of somebody other;
3288 in this case, `From:' should contain the address
3289 of the person that took responsibility for the message,
3290 and `Sender:' should contain the address
3291 of the person that actually sent the message.
3293 .I sender
3294 address is handled as if it were in the
3295 .I alternates
3296 list.
3298 .B sendmail
3299 To use an alternate mail delivery system,
3300 set this option to the full pathname
3301 of the program to use.
3302 This should be used with care.
3304 .B SHELL
3305 Pathname of the shell to use
3306 in the ! command and the ~! escape.
3307 A default shell is used
3308 if this option is not defined.
3311 .B Sign
3312 A string for use with the
3313 .I ~A
3314 command.
3316 .B sign
3317 A string for use with the
3318 .I ~a
3319 command.
3321 .B signature
3322 Must correspond to the name of a readable file if set.
3323 The file's content is then appended to each singlepart message
3324 and to the first part of each multipart message.
3325 Be warned that there is no possibility
3326 to edit the signature for an individual message.
3328 .B smime-ca-dir
3329 Specifies a directory with CA certificates for verification
3330 of S/MIME signed messages.
3331 The format is the same as described in
3332 .IR SSL_CTX_load_verify_locations (3).
3333 Only applicable if S/MIME support is built using OpenSSL.
3335 .B smime-ca-file
3336 Specifies a file with CA certificates for verification
3337 of S/MIME signed messages.
3338 The format is the same as described in
3339 .IR SSL_CTX_load_verify_locations (3).
3340 Only applicable if S/MIME support is built using OpenSSL.
3342 \fBsmime-cipher-\fIuser@host\fR
3343 Specifies a cipher to use when generating S/MIME encrypted messages
3345 .IR user@host .
3346 Valid ciphers are
3347 .B rc2-40
3348 (RC2 with 40 bits),
3349 .B rc2-64
3350 (RC2 with 64 bits),
3351 .B des
3352 (DES, 56 bits)
3354 .B des-ede3
3355 (3DES, 112/168 bits).
3356 The default is 3DES.
3357 It is not recommended to use the other ciphers
3358 unless a recipient's client is actually unable to handle 3DES
3359 since they are comparatively weak;
3360 but even so, the recipient should upgrade his software in preference.
3362 .B smime-crl-file
3363 Specifies a file that contains a CRL in PEM format
3364 to use when verifying S/MIME messages.
3365 Only applicable if S/MIME support is built using OpenSSL.
3367 .B smime-crl-dir
3368 Specifies a directory that contains files with CRLs in PEM format
3369 to use when verifying S/MIME messages.
3370 Only applicable if S/MIME support is built using OpenSSL.
3372 \fBsmime-encrypt-\fIuser@host\fR
3373 If this variable is set,
3374 messages to
3375 .I user@host
3376 are encrypted before sending.
3377 If S/MIME support is built using OpenSSL,
3378 the value of the variable must be set to the name of a file
3379 that contains a certificate in PEM format.
3380 If S/MIME support is built using NSS,
3381 the value of this variable is ignored,
3382 but if multiple certificates for
3383 .I user@host
3384 are available, the
3385 .I smime-nickname-user@host
3386 variable should be set.
3387 Otherwise a certificate for the recipient
3388 is automatically retrieved from the certificate database,
3389 if possible.
3391 If a message is sent to multiple recipients,
3392 each of them for whom a corresponding variable is set
3393 will receive an individually encrypted message;
3394 other recipients will continue to receive the message in plain text
3395 unless the
3396 .I smime-force-encryption
3397 variable is set.
3398 It is recommended to sign encrypted messages,
3399 i.\|e. to also set the
3400 .I smime-sign
3401 variable.
3403 \fBsmime-nickname-\fIuser@host\fR
3404 Specifies the nickname of a certificate
3405 to be used when encrypting messages for
3406 .I user@host .
3407 Only applicable if S/MIME support is built using NSS.
3409 .B smime-sign-cert
3410 Points to a file in PEM format
3411 that contains the user's private key
3412 as well as his certificate.
3413 Both are used with S/MIME
3414 for signing and decrypting messages.
3415 Only applicable if S/MIME support is built using OpenSSL.
3417 \fBsmime-sign-cert-\fIuser@host\fR
3418 Overrides
3419 .I smime-sign-cert
3420 for the specific addresses.
3421 When signing messages and the value of the
3422 .I from
3423 variable is set
3425 .IR user@host ,
3426 the specific file is used.
3427 When decrypting messages,
3428 their recipient fields (To: and Cc:) are searched for addresses
3429 for which such a variable is set.
3430 .I S-nail
3431 always uses the first address that matches,
3432 so if the same message is sent to more than one
3433 of the user's addresses using different encryption keys,
3434 decryption might fail.
3435 Only applicable if S/MIME support is built using OpenSSL.
3437 .B smime-sign-include-certs
3438 If used, this must be set to a comma-separated list of files,
3439 each of which containing a single certificate in PEM format
3440 to be included in the S/MIME message in addition to the
3441 .IR smime-sign-cert
3442 certificate.
3443 This is most useful for long certificate chains if it is
3444 desired to aid the receiving party's verification process.
3445 Only applicable if S/MIME support is built using OpenSSL.
3447 \fBsmime-sign-include-certs-\fIuser@host\fR
3448 Overrides
3449 .I smime-sign-include-certs
3450 for the specific addresses.
3451 Refer to the discussion of \fBsmime-sign-cert-\fIuser@host\fR
3452 for more on this topic.
3454 .B smime-sign-nickname
3455 Specifies that the named certificate be used for signing mail.
3456 If this variable is not set,
3457 but a single certificate matching the current
3458 .I from
3459 address is found in the database,
3460 that one is used automatically.
3461 Only applicable if S/MIME support is built using NSS.
3463 \fBsmime-sign-nickname-\fIuser@host\fR
3464 Overrides
3465 .I smime-sign-nickname
3466 for a specific address.
3467 Only applicable if S/MIME support is built using NSS.
3469 .B smtp
3470 Normally, \fIs-nail\fR invokes
3471 .IR sendmail (8)
3472 directly to transfer messages.
3473 If the \fIsmtp\fR variable is set, a SMTP connection to
3474 the server specified by the value of this variable
3475 is used instead.
3476 If the SMTP server does not use the standard port,
3477 a value of \fIserver:port\fR can be given,
3478 with \fIport\fR as a name or as a number.
3480 There are two possible methods to get SSL/TLS encrypted SMTP sessions:
3481 First, the STARTTLS command can be used to encrypt a session
3482 after it has been initiated,
3483 but before any user-related data has been sent; see
3484 .I \%smtp-use-starttls
3485 above.
3486 Second, some servers accept sessions that are encrypted
3487 from their beginning on. This mode is configured by assigning
3488 \fBsmtps://\fIserver\fR[\fB:\fIport\fR]
3489 to the
3490 .I smtp
3491 variable.
3493 The SMTP transfer is executed in a child process;
3494 unless either the
3495 .I sendwait
3496 or the
3497 .I verbose
3498 variable is set,
3499 this process runs asynchronously.
3500 If it receives a TERM signal,
3501 it will abort and save the message to the `dead.letter' file.
3503 .B smtp-auth
3504 Sets the SMTP authentication method.
3505 If set to `login',
3506 or if unset and smtp-auth-user is set,
3507 AUTH LOGIN is used.
3508 If set to `cram-md5',
3509 AUTH CRAM-MD5 is used;
3510 if set to `plain',
3511 AUTH PLAIN is used.
3512 Otherwise,
3513 no SMTP authentication is performed.
3515 \fBsmtp-auth-\fIuser\fB@\fIhost\fR
3516 Overrides
3517 .I smtp-auth
3518 for specific values of sender addresses,
3519 depending on the
3520 .I from
3521 variable.
3523 .B smtp-auth-password
3524 Sets the global password for SMTP AUTH.
3525 Both user and password have to be given
3526 for AUTH LOGIN and AUTH CRAM-MD5.
3528 \fBsmtp-auth-password-\fIuser\fB@\fIhost\fR
3529 Overrides
3530 .I smtp-auth-password
3531 for specific values of sender addresses,
3532 depending on the
3533 .I from
3534 variable.
3536 .B smtp-auth-user
3537 Sets the global user name for SMTP AUTH.
3538 Both user and password have to be given
3539 for AUTH LOGIN and AUTH CRAM-MD5.
3541 If this variable is set but neither
3542 .I smtp-auth-password
3543 or a matching
3544 .I smtp-auth-password-user@host
3545 can be found,
3546 .I s-nail
3547 will as for a password on the user's terminal.
3549 \fBsmtp-auth-user-\fIuser\fB@\fIhost\fR
3550 Overrides
3551 .I smtp-auth-user
3552 for specific values of sender addresses,
3553 depending on the
3554 .I from
3555 variable.
3557 .B ssl-ca-dir
3558 Specifies a directory with CA certificates for verification
3559 of SSL/TLS server certificates.
3561 .IR SSL_CTX_load_verify_locations (3)
3562 for more information.
3563 Only applicable if SSL/TLS support is built using OpenSSL.
3565 .B ssl-ca-file
3566 Specifies a file with CA certificates for verification
3567 of SSL/TLS server certificates.
3569 .IR SSL_CTX_load_verify_locations (3)
3570 for more information.
3571 Only applicable if SSL/TLS support is built using OpenSSL.
3573 .B ssl-cert
3574 Sets the file name 
3575 for a SSL/TLS client certificate
3576 required by some servers.
3577 Only applicable if SSL/TLS support is built using OpenSSL.
3579 \fBssl-cert-\fIuser\fB@\fIhost\fR
3580 Sets an account-specific file name
3581 for a SSL/TLS client certificate
3582 required by some servers.
3583 Overrides
3584 .I ssl-cert
3585 for the specified account.
3586 Only applicable if SSL/TLS support is built using OpenSSL.
3588 .B ssl-cipher-list
3589 Specifies a list of ciphers for SSL/TLS connections.
3590 See ciphers(1) for more information.
3591 Only applicable if SSL/TLS support is built using OpenSSL.
3593 .B ssl-crl-file
3594 Specifies a file that contains a CRL in PEM format
3595 to use when verifying SSL/TLS server certificates.
3596 Only applicable if SSL/TLS support is built using OpenSSL.
3598 .B ssl-crl-dir
3599 Specifies a directory that contains files with CRLs in PEM format
3600 to use when verifying SSL/TLS server certificates.
3601 Only applicable if SSL/TLS support is built using OpenSSL.
3603 .B ssl-key
3604 Sets the file name
3605 for the private key of a SSL/TLS client certificate.
3606 If unset, the name of the certificate file is used.
3607 The file is expected to be in PEM format.
3608 Only applicable if SSL/TLS support is built using OpenSSL.
3610 \fBssl-key-\fIuser\fB@\fIhost\fR
3611 Sets an account-specific file name
3612 for the private key of a SSL/TLS client certificate.
3613 Overrides
3614 .I ssl-key
3615 for the specified account.
3616 Only applicable if SSL/TLS support is built using OpenSSL.
3618 .B ssl-method
3619 Selects a SSL/TLS protocol version;
3620 valid values are `ssl2', `ssl3', and `tls1'.
3621 If unset, the method is selected automatically,
3622 if possible.
3624 \fBssl-method-\fIuser\fB@\fIhost\fR
3625 Overrides
3626 .I ssl-method
3627 for a specific account.
3629 .B ssl-rand-egd
3630 Gives the pathname to an entropy daemon socket,
3632 .IR RAND_egd (3).
3634 .B ssl-rand-file
3635 Gives the pathname to a file with entropy data,
3637 .IR RAND_load_file (3).
3638 If the file is a regular file writable by the invoking user,
3639 new data is written to it after it has been loaded.
3640 Only applicable if SSL/TLS support is built using OpenSSL.
3642 .B ssl-verify
3643 Sets the action to be performed if an error occurs
3644 during SSL/TLS server certificate validation.
3645 Valid values are
3646 `strict' (fail and close connection immediately),
3647 `ask' (ask whether to continue on standard input),
3648 `warn' (print a warning and continue),
3649 `ignore' (do not perform validation).
3650 The default is `ask'.
3652 \fBssl-verify-\fIuser\fB@\fIhost\fR
3653 Overrides
3654 .I ssl-verify
3655 for a specific account.
3657 .B toplines
3658 If defined, gives the number of lines
3659 of a message to be printed out
3660 with the top command;
3661 normally, the first five
3662 lines are printed.
3664 .B ttycharset
3665 The character set of the terminal \fIs-nail\fR operates on.
3666 There is normally no need to set this variable
3667 since \fIs-nail\fR can determine this automatically
3668 by looking at the LC_CTYPE locale setting;
3669 if this succeeds, the value is assigned at startup
3670 and will be displayed by the \fIset\fP command.
3671 Note that this is not necessarily a character set name
3672 that can be used in Internet messages.
3674 .B VISUAL
3675 Pathname of the text editor to use
3676 in the visual command and ~v escape.
3677 .SH ENVIRONMENT VARIABLES
3678 Besides the variables described above, \fIs-nail\fR uses
3679 the following environment strings:
3681 .B HOME
3682 The user's home directory.
3684 \fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR
3686 .IR locale (7).
3688 .B MAILRC
3689 Is used as startup file instead of ~/.mailrc if set.
3690 When
3691 .I s-nail
3692 scripts are invoked on behalf of other users,
3693 this variable should be set to `/dev/null'
3694 to avoid side-effects from reading their configuration files.
3696 .B SNAILRC
3697 If this variable is set and
3698 .I MAILRC
3699 is not set,
3700 it is read as startup file.
3702 .B SYSV3
3703 Changes the letters printed in the first column of a header summary.
3705 .B TMPDIR
3706 Used as directory for temporary files instead of /tmp, if set.
3707 .SH FILES
3709 ~/.mailrc
3710 File giving initial commands.
3712 /etc/s-nail.rc
3713 System wide initialization file.
3715 ~/.mime.types
3716 Personal MIME types.
3718 /etc/mime.types
3719 System wide MIME types.
3720 .SH EXAMPLES
3721 .SS "Getting started"
3723 .I s-nail
3724 command has two distinct usages, according to whether one
3725 wants to send or receive mail.
3726 Sending mail is simple: to send a
3727 message to a user whose email address is, say,
3728 <bill@host.example>,
3729 use the shell
3730 command:
3733     $ \fBs-nail\fI bill@host.example\fR
3736 then type your message.
3737 .I S-nail
3738 will prompt you for a message
3739 .I subject 
3740 first;
3741 after that, lines typed by you form the body of the message.
3742 When you reach the end of the message, type
3743 an EOT (control\-d) at the beginning of a line, which will cause
3744 .I s-nail
3745 to echo `EOT' and return you to the shell.
3747 If, while you are composing the message
3748 you decide that you do not wish to send it after all, you can
3749 abort the letter with a \s-2RUBOUT\s0.  Typing a single \s-2RUBOUT\s0
3750 causes
3751 .I s-nail
3752 to print `(Interrupt -- one more to kill letter)'.
3753 Typing a second
3754 \s-2RUBOUT\s0 causes
3755 .I s-nail
3756 to save your partial letter on the file `dead.letter'
3757 in your home directory and abort the letter.
3758 Once you have
3759 sent mail to someone, there is no way to undo the act, so be
3760 careful.
3762 If you want to send the same message to several other people,
3763 you can list their email addresses on the command line.
3764 Thus,
3767     $ \fBs-nail\fI sam@workstation.example bob@server.example\fR
3768     Subject: Fees
3769     Tuition fees are due next Friday.  Don't forget!
3770     <Control\-d>
3771     EOT
3772     $
3775 will send the reminder to \fI<sam@workstation.example>\fR.
3777 \fI<bob@server.example>\fR.
3779 To read your mail, simply type
3782     $ \fBs-nail\fR
3785 .I S-nail
3786 will respond by typing its version number and date and then listing
3787 the messages you have waiting.
3788 Then it will type a prompt and await your command.
3789 The messages are assigned numbers starting with 1\(emyou
3790 refer to the messages with these numbers.
3791 .I S-nail
3792 keeps track of which messages are
3793 .I new
3794 (have been sent since you last read your mail) and
3795 .I read
3796 (have been read by you).  New messages have an
3797 .B N
3798 next to them in the header listing and old, but unread messages have
3800 .B U
3801 next to them.
3802 .I S-nail
3803 keeps track of new/old and read/unread messages by putting a
3804 header field called
3805 .I Status
3806 into your messages.
3808 To look at a specific message, use the
3809 .I type
3810 command, which may be abbreviated to simply
3811 .I t .
3812 For example, if you had the following messages:
3815     O 1 drfoo@myhost.example Wed Sep  1 19:52  18/631 "Fees"
3816     O 2 sam@friends.example  Thu Sep  2 00:08  30/895
3819 you could examine the first message by giving the command:
3822     \fBtype\fR 1
3825 which might cause
3826 .B s-nail
3827 to respond with, for example:
3830     Message  1:
3831     From drfoo@myhost.example Wed Sep  1 19:52:25 2004
3832     Subject: Fees
3833     Status: R
3835     Tuition fees are due next Wednesday.  Don't forget!
3839 Many
3840 .I s-nail
3841 commands that operate on messages take a message number as an
3842 argument like the
3843 .I type
3844 command.
3845 For these commands, there is a notion of a current message.
3846 When you enter the
3847 .I s-nail
3848 program, the current message is initially the first
3849 (or the first recent) one.
3850 Thus, you can often omit the message number and use, for example,
3853     \fBt\fR
3856 to type the current message.
3857 As a further shorthand, you can type a message
3858 by simply giving its message number.
3859 Hence,
3862     1
3865 would type the first message.
3867 Frequently, it is useful to read the messages in your mailbox in order,
3868 one after another.
3869 You can read the next message in
3870 .I s-nail
3871 by simply typing a newline.
3872 As a special case, you can type a newline as your first command to
3873 .I s-nail
3874 to type the first message.
3876 If, after typing a message, you wish to immediately send a reply,
3877 you can do so with the
3878 .I reply
3879 command.
3880 This command,
3881 like
3882 .IR type ,
3883 takes a message number as an argument.
3884 .I s-nail
3885 then begins a message addressed to the user who sent you the message.
3886 You may then type in your letter in reply, followed by a <control-d>
3887 at the beginning of a line, as before.
3889 Note that
3890 .I s-nail
3891 copies the subject header from the original message.
3892 This is useful in that correspondence
3893 about a particular matter will tend to retain the same subject heading,
3894 making it easy to recognize.
3895 If there are other header fields in the message,
3896 like `Cc:',
3897 the information found will also be used.
3899 Sometimes you will receive a message that has been sent to
3900 several people and wish to reply only
3901 to the person who sent it.
3902 .I Reply
3903 with a capital
3904 .I R
3905 replies to a message, but sends a copy to the sender only.
3907 If you wish, while reading your mail, to send a message to someone,
3908 but not as a reply to one of your messages, you can send the message
3909 directly with the
3910 .I mail
3911 command, which takes as arguments the names of the recipients you wish
3912 to send to.
3913 For example, to send a message to <frank@machine.example>,
3914 you would do:
3917     \fBmail\fI frank@machine.example\fR
3920 To delete a message from the mail folder,
3921 you can use the
3922 .I delete
3923 command.
3924 In addition to not saving deleted messages,
3925 .I s-nail
3926 will not let you type them, either.
3927 The effect is to make the message disappear
3928 altogether, along with its number.
3930 Many features of
3931 .I s-nail
3932 can be tailored to your liking with the
3933 .I set
3934 command.
3936 .I set
3937 command has two forms, depending on whether you are setting a
3938 .I binary
3939 option or a
3940 .I valued
3941 option.
3942 Binary options are either on or off.  For example, the
3943 .I askcc
3944 option informs
3945 .I s-nail
3946 that each time you send a message, you want it to prompt you for
3947 a `Cc:' header,
3948 to be included in the message.
3949 To set the
3950 .I askcc
3951 option, you would type
3954     \fBset\fR askcc
3957 Valued options are values which
3958 .I s-nail
3959 uses to adapt to your tastes.
3960 For example, the
3961 .I record
3962 option tells
3963 .I s-nail
3964 where to save messages sent by you,
3965 and is specified by
3968     \fBset\fR record=Sent
3971 for example.
3972 Note that no spaces are allowed in
3973 .I "set record=Sent".
3975 .I S-nail
3976 includes a simple facility for maintaining groups of messages together
3977 in folders.
3978 To use the folder facility, you must tell
3979 .I s-nail
3980 where you wish to keep your folders.
3981 Each folder of messages will be a single file.
3982 For convenience, all of your folders are kept in
3983 a single directory of your choosing.
3984 To tell
3985 .I s-nail
3986 where your folder directory is, put a line of the form
3989     \fBset folder=\fIletters\fR
3992 in your
3993 .I .mailrc
3994 file.
3995 If, as in the example above,
3996 your folder directory does not begin with a `/',
3997 .I s-nail
3998 will assume that your folder directory is to be found starting from
3999 your home directory.
4001 Anywhere a file name is expected, you can use a folder name, preceded
4002 with `+'.
4003 For example, to put a message into a folder with the
4004 .I save
4005 command, you can use:
4008     \fBsave +\fIclasswork\fR
4011 to save the current message in the
4012 .I classwork
4013 folder.
4014 If the
4015 .I classwork
4016 folder does not yet exist, it will be created.
4017 Note that messages which are saved with the
4018 .I save
4019 command are automatically removed from your system mailbox.
4021 In order to make a copy of a message in a folder without causing
4022 that message to be removed from your system mailbox, use the
4023 .I copy
4024 command, which is identical in all other respects to the
4025 .I save
4026 command.
4029 .I folder
4030 command
4031 can be used to direct
4032 .I s-nail
4033 to the contents of a different folder.
4034 For example,
4037     \fBfolder +\fIclasswork\fR
4040 directs
4041 .I s-nail
4042 to read the contents of the
4043 .I classwork
4044 folder.
4045 All of the commands that you can use on your system
4046 mailbox are also applicable to folders, including
4047 .IR type ,
4048 .IR delete ,
4050 .IR reply .
4051 To inquire which folder you are currently editing, use simply:
4054     \fBfolder\fR
4057 To list your current set of folders, use the
4058 .I folders
4059 command.
4061 Finally, the
4062 .I help
4063 command is available to print out a brief summary of the most important
4064 .I s-nail
4065 commands.
4067 While typing in a message to be sent to others, it is often
4068 useful to be able to invoke the text editor on the partial message,
4069 print the message, execute a shell command, or do some other
4070 auxiliary function. 
4071 .I S-nail
4072 provides these capabilities through
4073 .I "tilde escapes" ,
4074 which consist of a tilde (~) at the beginning of a line, followed by
4075 a single character which indicates the function to be performed.
4076 For example, to print the text of the message so far, use:
4079     \fB~p\fR
4082 which will print a line of dashes, the recipients of your message, and
4083 the text of the message so far.
4084 A list of the most important tilde escapes is available with `~?'.
4085 .SS "IMAP or POP3 client setup"
4086 First you need the following data from your ISP:
4087 the host name of the IMAP or POP3 server,
4088 user name and password for this server,
4089 and a notice whether the server uses SSL/TLS encryption.
4090 Assuming the host name is `server.myisp.example'
4091 and your user name for that server is `mylogin',
4092 you can refer to this account using the
4093 .I folder
4094 command or
4095 .I \-f
4096 command line option with
4099     \fBimaps://\fImylogin\fB@\fIserver.myisp.example\fR
4102 (This string is not necessarily the same as your Internet mail address.)
4103 You can replace `imaps://' with `imap://'
4104 if the server does not support SSL/TLS.
4105 (If SSL/TLS support is built using NSS, the
4106 .I nss-config-dir
4107 variable must be set before a connection can be initiated,
4108 see above).
4109 Use `pop3s://' or `pop3://' if the server does not offer IMAP.
4110 You should use IMAP if you can, though;
4111 first because it requires fewer network operations than POP3
4112 to get the contents of the mailbox
4113 and is thus faster;
4114 and second because message attributes
4115 are maintained by the IMAP server,
4116 so you can easily distinguish new and old messages
4117 each time you connect.
4118 Even if the server does not accept IMAPS or POP3S connections,
4119 it is possible that it supports the STARTTLS method
4120 to make a session SSL/TLS encrypted
4121 after the initial connection has been performed,
4122 but before authentication begins.
4123 The only reliable method to see if this works is to try it; enter one of
4126     \fBset imap-use-starttls\fR
4127     \fBset pop3-use-starttls\fR
4130 before you initiate the connection.
4132 As you probably want messages to be deleted from this account
4133 after saving them,
4134 prefix it with `\fI%:\fR'.
4136 .I shortcut
4137 command can be used to avoid typing that many characters
4138 every time you want to connect:
4141     \fBshortcut \fImyisp\fB \fB%:imaps://\fImylogin\fB@\fIserver.myisp.example\fR
4144 You might want to put this string into a startup file.
4145 As the
4146 .I shortcut
4147 command is specific to this implementation of
4148 .I s-nail
4149 and will confuse other implementations,
4150 it should not be used in
4151 .IR ~/.mailrc ,
4152 instead, put
4155     \fBset SNAIL_EXTRA_RC=\fI~/.s-nailrc\fR
4159 .I ~/.mailrc
4160 and create a file
4161 .I ~/.s-nailrc
4162 containing the
4163 .I shortcut
4164 command above.
4165 You can then access your remote mailbox by invoking
4166 `s-nail \-f \fImyisp\fR' on the command line,
4167 or by executing `fi \fImyisp\fR' within s-nail.
4169 If you want to use more than one IMAP mailbox on a server,
4170 or if you want to use the IMAP server for mail storage too,
4172 .I account
4173 command
4174 (which is also \fIs-nail-\fRspecific)
4175 is more appropriate than the
4176 .I shortcut
4177 command.
4178 You can put the following in
4179 .IR ~/.s-nailrc :
4182     \fBaccount \fImyisp \fB{\fR
4183         \fBset folder=imaps://\fImylogin\fB@\fIserver.myisp.example\fR
4184         \fBset record=+\fISent \fBMBOX=+\fImbox \fBoutfolder\fR
4185     \fB}\fR
4188 and can then access incoming mail for this account by invoking
4189 `s-nail \-A \fImyisp\fR' on the command line,
4190 or by executing `ac \fImyisp\fR' within s-nail.
4191 After that,
4192 a command like `copy \fI1\fR +\fIotherfolder\fR'
4193 will refer to \fIotherfolder\fR on the IMAP server.
4194 In particular,
4195 `fi &' will change to the
4196 .I mbox
4197 folder,
4199 `fi +Sent' will show your recorded sent mail,
4200 with both folders located on the IMAP server.
4202 .I S-nail
4203 will ask you for a password string
4204 each time you connect to a remote account.
4205 If you can reasonably trust the security
4206 of your workstation,
4207 you can give this password in the startup file as
4210     \fBset password-\fImylogin\fB@\fIserver.myisp.example\fB="\fISECRET\fB"\fR
4213 You should change the permissions of this file to 0600, see
4214 .IR chmod (1).
4216 .I S-nail
4217 supports different authentication methods for both IMAP and POP3.
4218 If Kerberos is used at your location,
4219 you can try to activate GSSAPI-based authentication by
4222     \fBset imap-auth=gssapi\fR
4225 The advantage of this method is that
4226 .I s-nail
4227 does not need to know your password at all,
4228 nor needs to send sensitive data over the network.
4229 Otherwise, the options
4232     \fBset imap-auth=cram-md5\fR
4233     \fBset pop3-use-apop\fR
4236 for IMAP and POP3, respectively,
4237 offer authentication methods
4238 that avoid to send the password in clear text over the network,
4239 which is especially important if SSL/TLS cannot be used.
4240 If the server does not offer any of these authentication methods,
4241 conventional user/password based authentication must be used.
4242 It is sometimes helpful to set the
4243 .I verbose
4244 option when authentication problems occur.
4245 .I S-nail
4246 will display all data sent to the server in clear text on the screen
4247 with this option,
4248 including passwords.
4249 You should thus take care that no unauthorized person
4250 can look at your terminal when this option is set.
4252 If you regularly use the same workstation
4253 to access IMAP accounts,
4254 you can greatly enhance performance
4255 by enabling local caching of IMAP messages.
4256 For any message that has been fully or partially fetched from the server,
4257 a local copy is made and is used when the message is accessed again,
4258 so most data is transferred over the network once only.
4259 To enable the IMAP cache,
4260 select a local directory name and put
4263     \fBset imap-cache=\fI~/localdirectory\fR
4266 in the startup file.
4267 All files within that directory
4268 can be overwritten or deleted by \fIs-nail\fR at any time,
4269 so you should not use the directory to store other information.
4271 Once the cache contains some messages,
4272 it is not strictly necessary anymore
4273 to open a connection to the IMAP server
4274 to access them.
4275 When \fIs-nail\fR is invoked with the \fI\-D\fR option,
4276 or when the
4277 .I disconnected
4278 variable is set,
4279 only cached data is used
4280 for any folder you open.
4281 Messages that have not yet been completely cached
4282 are not available then,
4283 but all other messages can be handled
4284 as usual.
4285 Changes made to IMAP mailboxes in
4286 .I disconnected
4287 mode are committed to the IMAP server
4288 next time it is used in
4289 .I online
4290 mode.
4291 Synchronizing the local status
4292 with the status on the server
4293 is thus partially within your responsibility;
4294 if you forget to initiate a connection to the server again
4295 before you leave your location,
4296 changes made on one workstation
4297 are not available on others.
4298 Also if you alter IMAP mailboxes from a workstation
4299 while uncommitted changes are still pending on another,
4300 the latter data may become invalid.
4301 The same might also happen because of internal server status changes.
4302 You should thus carefully evaluate this feature in your environment
4303 before you rely on it.
4305 Many servers will close the connection
4306 after a short period of inactivity. Use one of
4309     \fBset pop3-keepalive=\fI30\fR
4310     \fBset imap-keepalive=\fI240\fR
4313 to send a keepalive message each 30 seconds for POP3,
4314 or each 4 minutes for IMAP.
4316 If you encounter problems connecting to a SSL/TLS server,
4317 try the
4318 .I ssl-rand-egd
4320 .I ssl-rand-file
4321 variables (see the OpenSSL FAQ for more information)
4322 or specify the protocol version with
4323 .IR ssl-method .
4324 Contact your ISP
4325 if you need a client certificate
4326 or if verification of the server certificate fails.
4327 If the failed certificate is indeed valid,
4328 fetch its CA certificate by executing the shell command
4331     $ \fBopenssl s_client </dev/null \-showcerts \-connect \e
4332            \fIserver.myisp.example\fB:\fIimaps\fB 2>&1 | tee \fIlog\fR
4335 (see
4336 .IR s_client (1))
4337 and put it into the file specified with
4338 .IR ssl-ca-file .
4339 The data you need is located at the end of the certificate chain
4340 within (and including) the `BEGIN CERTIFICATE'
4341 and `END CERTIFICATE' lines.
4342 (Note that it is possible to fetch
4343 a forged certificate by this method.
4344 You can only completely rely
4345 on the authenticity of the CA certificate
4346 if you fetch it in a way that is trusted by other means,
4347 such as by personally receiving the certificate on storage media.)
4348 .SS "Creating a score file or message filter"
4349 The scoring commands are best separated
4350 from other configuration for clarity,
4351 and are mostly
4352 .I s-nail
4353 specific.
4354 It is thus recommended to put them in a separate file
4355 that is sourced from your SNAIL_EXTRA_RC as follows:
4358     \fBsource\fI ~/.scores\fR
4361 The \fI.scores\fR file could then look as follows:
4364     \fBdefine\fR \fIlist\fR {
4365         \fBscore\fR (subject "important discussion") +10
4366         \fBscore\fR (subject "annoying discussion") \-10
4367         \fBscore\fR (from "nicefellow@goodnet") +15
4368         \fBscore\fR (from "badguy@poornet") \-5
4369         \fBmove\fR (header x-spam-flag "+++++") \fI+junk\fR
4370     }
4371     \fBset folder-hook-\fRimap://user@host/public.list=\fIlist\fR
4374 In this scheme,
4375 you would see any mail from `nicefellow@goodnet',
4376 even if the surrounding discussion is annoying;
4377 but you normally would not see mail from `badguy@poornet',
4378 unless he participates in the important discussion.
4379 Messages that are marked with five or more plus characters
4380 in their `X-Spam-Flag' field
4381 (inserted by some server-side filtering software)
4382 are moved to the folder `junk' in the
4383 .I folder
4384 directory.
4386 Be aware that all criteria in (\|) lead to substring matches,
4387 so you would also score messages
4388 from e.\|g. `notsobadguy@poornetmakers' negative here.
4389 It is possible to select addresses exactly using \fI"address"\fR
4390 message specifications,
4391 but these cannot be executed remotely 
4392 and will thus cause all headers
4393 to be downloaded from IMAP servers while looking for matches.
4395 When searching messages on an IMAP server,
4396 best performance is usually achieved
4397 by sending as many criteria as possible
4398 in one large (\|) specification,
4399 because each single such specification
4400 will result in a separate network operation.
4401 .SS "Activating the Bayesian filter"
4402 The Bayesian junk mail filter works
4403 by examining the words contained in messages.
4404 You decide yourself what a good and what a bad message is.
4405 Thus the resulting filter is your very personal one;
4406 once it is correctly set up,
4407 it will filter only messages similar to those
4408 previously specified by you.
4410 To use the Bayesian filter,
4411 a location for the junk mail database must be defined first:
4414     \fBset junkdb=\fI~/.junkdb\fR
4417 The junk mail database does not contain
4418 actual words extracted from messages,
4419 but hashed representations of them.
4420 A foreign person who can read the database
4421 could only examine the frequency of previously known words
4422 in your mail.
4424 If you have sufficient disk space (several 10\ MB) available,
4425 it is recommended that you set the
4426 .I chained-junk-tokens
4427 option.
4428 The filter will then also consider two-word tokens,
4429 improving its accuracy.
4431 A set of good messages and junk messages must now be available;
4432 it is also possible to use the incoming new messages for this purpose,
4433 although it will of course take some time
4434 until the filter becomes useful then.
4435 Do not underestimate the amount of statistical data needed;
4436 some hundred messages are typically necessary
4437 to get satisfactory results,
4438 and many thousand messages for best operation.
4439 You have to pass the good messages to the
4440 .I good
4441 command,
4442 and the junk messages to the
4443 .I junk
4444 command.
4445 If you ever accidentally mark a good message as junk or vice-versa,
4446 call the
4447 .I ungood
4449 .I unjunk
4450 command to correct this.
4452 Once a reasonable amount of statistics has been collected,
4453 new messages can be classified automatically.
4455 .I classify
4456 command marks all messages that the filter considers to be junk,
4457 but it does not perform any action on them by default.
4458 It is recommended that you move these messages into a separate
4459 folder just for the case that false positives occur,
4460 or to pass them to the
4461 .I junk
4462 command later again to further improve the junk mail database.
4463 To automatically move incoming junk messages
4464 every time the inbox is opened,
4465 put lines like the following into your
4466 .I .scores
4467 file (or whatever name you gave to the file in the last example):
4470     \fBdefine\fR \fIjunkfilter\fR {
4471         \fBclassify (smaller \fI20000\fB) :n\fR
4472         \fBmove :j\fR \fI+junk\fR
4473     }
4474     \fBset folder-hook-\fRimap://user@host/INBOX=\fIjunkfilter\fR
4477 If you set the
4478 .I verbose
4479 option before running the
4480 .I classify
4481 command,
4482 .I s-nail
4483 prints the words it uses for calculating the junk status
4484 along with their statistical probabilities.
4485 This can help you to find out
4486 why some messages are not classified
4487 as you would like them to be.
4488 To see the statistical probability of a given word,
4489 use the
4490 .I probability
4491 command.
4493 If a junk message was not recognized as such,
4494 use the
4495 .I junk
4496 command to correct this.
4497 Also if you encounter a false positive
4498 (a good message that was wrongly classified as junk),
4499 pass it to the
4500 .I good
4501 command.
4503 Since the
4504 .I classify
4505 command must examine the entire text
4506 of all new messages in the respective folder,
4507 this will also cause all of them to be downloaded from the IMAP server.
4508 You should thus restrict the size of messages for automatic filtering.
4509 If server-based filtering is also available,
4510 you might try if that works for you first.
4511 .SS "Reading HTML mail"
4512 You need either the
4513 .I w3m
4515 .I lynx
4516 utility
4517 or another command-line web browser
4518 that can write plain text to standard output.
4521     \fBset pipe-text/html=\fR"w3m -dump -T text/html"
4527     \fBset pipe-text/html=\fR"lynx -dump -force_html /dev/stdin"
4530 will then cause HTML message parts to be converted into a more friendly form.
4531 .SS "Viewing PDF attachments"
4532 Most PDF viewers do not accept input directly from a pipe.
4533 It is thus necessary to store the attachment in a temporary file, as with
4536     \fBset pipe-application/pdf=\fR"cat >/tmp/s-nail$$.pdf; \e
4537            acroread /tmp/s-nail$$.pdf; rm /tmp/s-nail$$.pdf"
4540 Note that security defects are discovered in PDF viewers
4541 from time to time.
4542 Automatical command execution like this
4543 can compromise your system security,
4544 in particular if you stay not always informed
4545 about such issues.
4546 .SS "Signed and encrypted messages with S/MIME"
4547 S/MIME provides two central mechanisms:
4548 message signing and message encryption.
4549 A signed message contains some data in addition
4550 to the regular text.
4551 The data can be used to verify
4552 that the message was sent using a valid certificate,
4553 that the sender's address in the message header
4554 matches that in the certificate,
4555 and that the message text has not been altered.
4556 Signing a message does not change its regular text;
4557 it can be read regardless of whether the recipient's software
4558 is able to handle S/MIME.
4559 It is thus usually possible to sign all outgoing messages
4560 if so desired.\(emEncryption, in contrast,
4561 makes the message text invisible for all people
4562 except those who have access to the secret decryption key.
4563 To encrypt a message,
4564 the specific recipient's public encryption key must be known.
4565 It is thus not possible to send encrypted mail to people
4566 unless their key has been retrieved
4567 from either previous communication or public key directories.
4568 A message should always be signed before it is encrypted.
4569 Otherwise, it is still possible that the encrypted message text
4570 is altered.
4572 A central concept to S/MIME is that of the certification authority (CA).
4573 A CA is a trusted institution that issues certificates.
4574 For each of these certificates,
4575 it can be verified that it really originates from the CA,
4576 provided that the CA's own certificate is previously known.
4577 A set of CA certificates is usually delivered with OpenSSL
4578 and installed on your system.
4579 If you trust the source of your OpenSSL software installation,
4580 this offers reasonable security for S/MIME on the Internet.
4581 In general, a certificate cannot be more secure
4582 than the method its CA certificate has been retrieved with, though.
4583 Thus if you download a CA certificate from the Internet,
4584 you can only trust the messages you verify using that certificate
4585 as much as you trust the download process.
4587 The first thing you need for participating in S/MIME message exchange
4588 is your personal certificate,
4589 including a private key.
4590 The certificate contains public information,
4591 in particular your name and your email address,
4592 and the public key that is used by others
4593 to encrypt messages for you,
4594 and to verify signed messages they supposedly received from you.
4595 The certificate is included in each signed message you send.
4596 The private key must be kept secret.
4597 It is used to decrypt messages that were
4598 previously encrypted with your public key,
4599 and to sign messages.
4601 For personal use,
4602 it is recommended that you get a S/MIME certificate
4603 from one of the major CAs on the Internet using your WWW browser.
4604 (Many CAs offer such certificates for free.)
4605 You will usually receive
4606 a combined certificate and private key
4607 in PKCS#12 format which
4608 .I s-nail
4609 does not directly accept
4610 if S/MIME support is built using OpenSSL.
4611 To convert it to PEM format,
4612 use the following shell command:
4615     $ \fBopenssl pkcs12 \-in \fIcert.p12\fB \-out \fIcert.pem\fB \-clcerts \e
4616         \-nodes\fR
4619 If you omit the
4620 .I \-nodes
4621 parameter,
4622 you can specifiy an additional
4623 .I "PEM pass phrase"
4624 for protecting the private key.
4625 .I S-nail
4626 will then ask you for that pass phrase
4627 each time it signs or decrypts a message.
4628 You can then use
4631     \fBset smime-sign-cert-\fImyname@myisp.example\fB=\fIcert.pem\fR
4634 to make this private key and certificate known to
4635 .IR s-nail .
4637 If S/MIME support is built using NSS,
4638 the PKCS#12 file must be installed using Mozilla
4639 (provided that
4640 .I nss-config-dir
4641 is set appropriately,
4642 see above),
4643 and no further action is necessary
4644 unless multiple user certificates
4645 for the same email address are installed.
4646 In this case,
4648 .I smime-sign-nickname
4649 variable has to be set appropriately.
4651 You can now sign outgoing messages.
4652 Just use
4655     \fBset smime-sign\fR
4658 to do so.
4660 From each signed message you send,
4661 the recipient can fetch your certificate
4662 and use it to send encrypted mail back to you.
4663 Accordingly if somebody sends you a signed message,
4664 you can do the same.
4665 First use the
4666 .I verify
4667 command to check the validity of the certificate.
4668 After that,
4669 retrieve the certificate and tell
4670 .I s-nail
4671 that it should use it for encryption:
4674     \fBcertsave\fI filename\fR
4675     \fBset smime-encrypt-\fIuser@host\fB=\fIfilename\fR
4678 If S/MIME support is built using NSS,
4679 the saved certificate must be installed using Mozilla.
4680 The value of the
4681 .I smime-encrypt-user@host
4682 is ignored then,
4683 but if multiple certificates for the recipient are available,
4685 .I smime-nickname-user@host
4686 variable must be set.
4688 You should carefully consider
4689 if you prefer to store encrypted messages in decrypted form.
4690 If you do, anybody who has access to your mail folders can read them,
4691 but if you do not,
4692 you might be unable to read them yourself later
4693 if you happen to lose your private key.
4695 .I decrypt
4696 command saves messages in decrypted form,
4697 while the
4698 .IR save ,
4699 .IR copy ,
4701 .I move
4702 commands leave them encrypted.
4704 Note that neither S/MIME signing nor encryption
4705 applies to message subjects or other header fields.
4706 Thus they may not contain sensitive information
4707 for encrypted messages,
4708 and cannot be trusted even if the message content
4709 has been verified.
4710 When sending signed messages,
4711 it is recommended to repeat any important header information
4712 in the message text.
4713 .SS "Using CRLs with S/MIME or SSL/TLS"
4714 Certification authorities (CAs) issue
4715 certificate revocation lists (CRLs) on a regular basis.
4716 These lists contain the serial numbers of certificates
4717 that have been declared invalid after they have been issued.
4718 Such usually happens
4719 because the private key for the certificate has been compromised,
4720 because the owner of the certificate has left
4721 the organization that is mentioned in the certificate,
4722 etc.
4723 To seriously use S/MIME or SSL/TLS verification,
4724 an up-to-date CRL is required for each trusted CA.
4725 There is otherwise no method
4726 to distinguish between valid and invalidated certificates.
4727 .I S-nail
4728 currently offers no mechanism to fetch CRLs,
4729 or to access them on the Internet,
4730 so you have to retrieve them by some external mechanism.
4732 If S/MIME and SSL/TLS support are built using OpenSSL,
4733 .I s-nail
4734 accepts CRLs in PEM format only;
4735 CRLs in DER format must be converted,
4736 e.\|g. with the shell command
4739     $ \fBopenssl crl \-inform DER \-in \fIcrl.der\fB \-out \fIcrl.pem\fR
4742 To tell
4743 .I s-nail
4744 about the CRLs,
4745 a directory
4746 that contains all CRL files
4747 (and no other files)
4748 must be created.
4750 .I smime-crl-dir
4752 .I ssl-crl-dir
4753 variables, respectively,
4754 must then be set to point to that directory.
4755 After that,
4756 .I s-nail
4757 requires a CRL to be present
4758 for each CA that is used
4759 to verify a certificate.
4761 If S/MIME and SSL/TLS support are built using NSS,
4762 CRLs can be imported in Mozilla applications
4763 (provided that
4764 .I nss-config-dir
4765 is set appropriately).
4766 .SS "Sending mail from scripts"
4767 If you want to send mail from scripts,
4768 you must be aware that
4769 .I s-nail
4770 reads the user's configuration files by default.
4771 So unless your script is only intended for your own personal use
4772 (as e.g. a cron job),
4773 you need to circumvent this by invoking
4774 .I s-nail
4775 like
4778     \fBMAILRC=/dev/null s-nail \-n\fR
4781 You then need to create a configuration for
4782 .I s-nail
4783 for your script.
4784 This can be done by either pointing the
4785 .I MAILRC
4786 variable to a custom configuration file,
4787 or by passing the configuration in environment variables.
4788 Since many of the configuration options are not valid shell variables, the
4789 .I env
4790 command is useful in this situation.
4791 An invocation could thus look like
4794     \fBenv MAILRC=/dev/null\fR from=\fIscriptreply@domain\fR smtp=\fIhost\fR \e
4795           smtp-auth-user=\fIlogin\fR smtp-auth-password=\fIsecret\fR \e
4796           smtp-auth=\fIlogin\fR \fBs-nail \-n\fR \-s "\fIsubject\fR" \e
4797           \-a \fIattachment_file\fR \fIrecipient@domain\fR <\fIcontent_file\fR
4798 .SH "SEE ALSO"
4799 fmt(1),
4800 newaliases(1),
4801 openssl(1),
4802 pg(1),
4803 more(1),
4804 vacation(1),
4805 ssl(3),
4806 aliases(5),
4807 locale(7),
4808 mailaddr(7),
4809 sendmail(8)
4810 .SH NOTES
4812 Variables in the environment passed to
4813 .I s-nail
4814 cannot be unset.
4816 The character set conversion relies
4817 on the
4818 .IR iconv (3)
4819 function.
4820 Its functionality differs widely
4821 between the various system environments
4822 \fIs-nail\fR runs on.
4823 If the message `Cannot convert from \fIa\fR to \fIb\fR' appears,
4824 either some characters within the message header or text
4825 are not appropriate for the currently selected terminal character set,
4826 or the needed conversion is not supported by the system.
4827 In the first case,
4828 it is necessary to set
4829 an appropriate LC_CTYPE locale (e.\|g. \fIen_US\fR)
4830 or the
4831 .I ttycharset
4832 variable.
4833 In the second case, the
4834 .I sendcharsets
4836 .I ttycharset
4837 variables must be set to the same value
4838 to inhibit character set conversion.
4840 .I iconv()
4841 is not available at all,
4842 the value assigned to
4843 .I sendcharsets
4844 must match the character set that is used on the terminal.
4846 S-nail expects input text to be in Unix format,
4847 with lines separated by 
4848 .I newline
4849 (^J, \en) characters only.
4850 Non-Unix text files that use
4851 .I carriage return
4852 (^M, \er)
4853 characters in addition will be treated as binary data;
4854 to send such files as text, strip these characters e.\ g. by
4857 tr \-d '\e015' <input | s-nail .\ .\ .
4860 or fix the tools that generate them.
4862 Limitations with IMAP mailboxes are:
4863 It is not possible to edit messages,
4864 but it is possible to append them.
4865 Thus to edit a message,
4866 create a local copy of it,
4867 edit it, append it,
4868 and delete the original.
4869 The line count for the header display
4870 is only appropriate if the entire message has been downloaded
4871 from the server.
4872 The marking of messages as `new' is performed by the IMAP server;
4873 use of the
4874 .I exit
4875 command instead of
4876 .I quit
4877 will not cause it to be reset,
4878 and if the
4879 .IR autoinc / newmail
4880 variables are unset,
4881 messages that arrived during a session
4882 will not be in state `new' anymore
4883 when the folder is opened again.
4884 Also if commands queued in disconnected mode are committed,
4885 the IMAP server will delete the `new' flag
4886 for all messages in the changed folder,
4887 and new messages will appear as unread
4888 when it is selected for viewing later.
4889 The `flagged', `answered', and `draft' attributes are usually permanent,
4890 but some IMAP servers are known to drop them without notification.
4891 .\" This is why s-nail does not even check if storing them succeeds.
4892 Message numbers may change with IMAP
4893 every time before the prompt is printed
4894 if \fIs-nail\fR is notified by the server
4895 that messages have been deleted
4896 by some other client or process.
4897 In this case, `Expunged \fIn\fR messages' is printed,
4898 and message numbers may have changed.
4900 Limitations with POP3 mailboxes are:
4901 It is not possible to edit messages,
4902 they can only be copied and deleted.
4903 The line count for the header display
4904 is only appropriate if the entire message has been downloaded
4905 from the server.
4906 The status field of a message is maintained by the server
4907 between connections;
4908 some servers do not update it at all,
4909 and with a server that does,
4910 the `exit' command will not cause the message status to be reset.
4911 The `newmail' command and the `newmail' variable
4912 have no effect.
4913 It is not possible to rename or to remove POP3 mailboxes.
4915 If a
4916 .SM RUBOUT
4917 (interrupt) is typed while an IMAP or POP3 operation is in progress,
4918 .I s-nail
4919 will wait until the operation can be safely aborted,
4920 and will then return to the command loop
4921 and print the prompt again.
4922 When a second
4923 .I RUBOUT
4924 is typed while
4925 .I s-nail
4926 is waiting for the operation to complete,
4927 the operation itself will be canceled.
4928 In this case,
4929 data that has not been fetched yet
4930 will have to be fetched
4931 before the next command can be performed.
4932 If the canceled operation
4933 was using an SSL/TLS encrypted channel,
4934 an error in the SSL transport will very likely result,
4935 and the connection is no longer usable.
4937 As \fIs-nail\fR is a mail user agent,
4938 it provides only basic SMTP services.
4939 If it fails to contact its upstream SMTP server,
4940 it will not make further attempts to transfer the message
4941 at a later time,
4942 and it does not leave other information about this condition
4943 than an error message on the terminal
4944 and a `dead.letter' file.
4945 This is usually not a problem if the SMTP server
4946 is located in the same local network
4947 as the computer on which \fIs-nail\fR is run.
4948 However, care should be taken when using a remote server of an ISP;
4949 it might be better to set up a local SMTP server then
4950 which just acts as a proxy.
4952 \fIS-nail\fR immediately contacts the SMTP server (or
4953 .IR \%/usr/lib/sendmail )
4954 even when operating in
4955 .I disconnected
4956 mode.
4957 It would not make much sense for \fIs-nail\fR to defer outgoing mail
4958 since SMTP servers usually provide
4959 much more elaborated delay handling
4960 than \fIs-nail\fR could perform as a client.
4961 Thus the recommended setup for sending mail in
4962 .I disconnected
4963 mode is to configure a local SMTP server
4964 such that it sends outgoing mail
4965 as soon as an external network connection is available again,
4966 i.\|e. to advise it to do that from a network startup script.
4968 The junk mail filter follows the concepts developed by
4969 Paul Graham in his articles,
4970 ``A Plan for Spam'', August 2002,
4971 \%<http://www.paulgraham.com/spam.html>,
4972 and ``Better Bayesian Filtering'', January 2003,
4973 \%<http://www.paulgraham.com/better.html>.
4974 Chained tokens are due to a paper by
4975 Jonathan A. Zdziarski,
4976 ``Advanced Language Classification using Chained Tokens'',
4977 February 2004,
4978 \%<http://www.nuclearelephant.com/papers/chained.html>.
4980 A \fImail\fR command appeared in Version 1 AT&T Unix.
4981 Berkeley Mail was written in 1978 by Kurt Shoens.
4982 This man page is derived from
4983 from The Mail Reference Manual
4984 originally written by Kurt Shoens.
4985 \fIHeirloom Mailx\fR enhancements are maintained and documented
4986 by Gunnar Ritter.
4987 \fIS-nail\fR enhancements are maintained and documented
4988 by Steffen "Daode" Nurpmeso.
4990 Portions of this text are reprinted and reproduced in electronic form
4991 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
4992 \(em Operating System Interface (POSIX), The Open Group Base
4993 Specifications Issue 6, Copyright \(co 2001-2003 by the Institute of
4994 Electrical and Electronics Engineers, Inc and The Open Group. In the
4995 event of any discrepancy between this version and the original IEEE and
4996 The Open Group Standard, the original IEEE and The Open Group Standard
4997 is the referee document. The original Standard can be obtained online at
4998 \%http://www.opengroup.org/unix/online.html\ .
4999 Redistribution of this material is permitted so long as this notice remains
5000 intact.