-
Notifications
You must be signed in to change notification settings - Fork 2
/
mailx.1
4956 lines (4925 loc) · 132 KB
/
mailx.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'\" t
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\" Copyright (c) 2000
.\" Gunnar Ritter. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" This product includes software developed by Gunnar Ritter
.\" and his contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS '\fIAS IS\fR' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" Sccsid: @(#)mailx.1 2.329 (gritter) 10/9/10
.\"
.TH MAILX 1 "10/9/10" "Heirloom mailx 12.5" "User Commands"
.SH NAME
mailx \- send and receive Internet mail
.SH SYNOPSIS
.PD 0
.HP
.ad l
\fBmailx\fR [\fB\-BDdEFintv~\fR]
[\fB\-s\fI\ subject\fR] [\fB\-a\fI\ attachment\fR ]
[\fB\-c\fI\ cc-addr\fR] [\fB\-b\fI\ bcc-addr\fR] [\fB\-r\fI\ from-addr\fR]
[\fB\-h\fI\ hops\fR]
[\fB\-A\fI\ account\fR]
[\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]]
\fIto-addr\fR .\ .\ .
.HP
.ad l
\fBmailx\fR [\fB\-BDdeEHiInNRv~\fR] [\fB\-T\fI\ name\fR]
[\fB\-A\fI\ account\fR]
[\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]]
\fB\-f\fR [\fIname\fR]
.HP
.ad l
\fBmailx\fR [\fB\-BDdeEinNRv~\fR]
[\fB\-A\fI\ account\fR]
[\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]]
[\fB\-u\fI\ user\fR]
.br
.PD
.ad b
.SH DESCRIPTION
\fIMailx\fR is an intelligent mail processing system, which has
a command syntax reminiscent of
.IR ed (1)
with lines replaced by messages.
It is based on Berkeley Mail 8.1,
is intended to provide the functionality of the POSIX
.B mailx
command,
and offers extensions
for MIME, IMAP, POP3, SMTP, and S/MIME.
.I Mailx
provides enhanced
features for interactive use, such as caching and disconnected
operation for IMAP, message threading, scoring, and filtering.
It is also usable as a mail batch language, both for sending
and receiving mail.
.PP
The following options are accepted:
.TP
.BI \-A \ name
Executes an
.I account
command (see below)
for \fIname\fR after the startup files have been read.
.TP
.BI \-a \ file
Attach the given file to the message.
.TP
.B \-B
Make standard input and standard output line-buffered.
.TP
.BI \-b \ address
Send blind carbon copies to list.
List should be a comma-separated
list of names.
.TP
.BI \-c \ address
Send carbon copies to list of users.
.TP
.B \-D
Start in
.I disconnected
mode; see the description for the
.I disconnected
variable option.
.TP
.B \-d
Enables debugging messages and disables the actual delivery of messages.
Unlike
.IR \-v ,
this option is intended for
.I mailx
development only.
.TP
.B \-e
Just check if mail is present in the system mailbox.
If yes, return an exit status of zero,
else, a non-zero value.
.TP
.B \-E
If an outgoing message does not contain any text
in its first or only message part,
do not send it but discard it silently,
effectively setting the
.I skipemptybody
variable at program startup.
This is useful for sending messages
from scripts started by
.IR cron (8).
.TP
\fB\-f\fR [\fIfile\fR]
Read in the contents of the user's mbox
(or the specified file)
for processing;
when
.I mailx
is quit, it writes
undeleted messages back
to this file.
The string \fIfile\fR is handled
as described for the
.I folder
command below.
.TP
.B \-F
Save the message to send
in a file named after the local part
of the first recipient's address.
.TP
.B \-H
Print header summaries for all messages and exit.
.TP
\fB\-h\fI hops\fR
Invoke sendmail with the specified hop count.
This option has no effect when SMTP is used for sending mail.
.TP
.B \-i
Ignore tty interrupt signals.
This is
particularly useful when using
\fImailx\fR on noisy phone lines.
.TP
.B \-I
Shows the `Newsgroup:' or `Article-Id:' fields
in the header summary.
Only applicable in combination with
.IR \-f .
.TP
.B \-n
Inhibits reading /etc/nail.rc upon startup.
This option should be activated for
.I mailx
scripts that are invoked on more than one machine,
because the contents of that file may differ between them.
.TP
.B \-N
Inhibits the initial display of message headers when reading mail
or editing a mail folder.
.TP
.BI \-q \ file
Start the message with the contents of the specified file.
May be given in send mode only.
.TP
.BI \-r \ address
Sets the
.I From
address. Overrides any
.I from
variable specified in environment or startup files.
Tilde escapes are disabled.
The \fI\-r\fI address\fR options are passed to the mail transfer agent
unless SMTP is used.
This option exists for compatibility only;
it is recommended to set the
.I from
variable directly instead.
.TP
.B \-R
Opens any folders read-only.
.TP
.BI \-s \ subject
Specify subject on command line (only the first argument after the
.I \-s
flag is used as a subject; be careful to quote subjects
containing spaces).
.TP
\fB\-S\fI\ variable\fR[\fB=\fIvalue\fR]
Sets the internal option
.I variable
and, in case of a string option,
assigns
.I value
to it.
.TP
.BI \-T \ name
Writes the `Message-Id:' and `Article-Id:' header fields
of each message read in the file
.IR name .
Implies
.IR \-I .
Compressed files are handled as described for the
.I folder
command below.
.TP
.B \-t
The message to be sent is expected to contain a message header
with `To:', `Cc:', or `Bcc:' fields giving its recipients.
Recipients specified on the command line are ignored.
.TP
.BI \-u \ user
Reads the mailbox of the given user name.
.TP
.B \-v
Verbose mode.
The details of
delivery are displayed on the user's terminal.
.TP
.B \-V
Print \fImailx\fR's version and exit.
.TP
.B \-~
Enable tilde escapes even if not in interactive mode.
.SS "Sending mail"
To send a message to one or more people,
\fImailx\fR can be invoked with arguments
which are the names of people
to whom the mail will be sent.
The user is then expected to type in his message,
followed by an `control-D' at the beginning of a line.
The section below Replying to
or originating mail,
describes some features of \fImailx\fR
available to help when composing letters.
.SS "Reading mail"
In normal usage \fImailx\fR is given no arguments
and checks the user's mail out of the post office,
then prints out a one line header
of each message found.
The current message is initially
the first message (numbered 1)
and can be printed using the print command
which can be abbreviated `p').
The user can move among the messages
much as he moves between lines in
.IR ed (1),
with the commands `+' and `\-' moving backwards and forwards,
and simple numbers.
.SS "Disposing of mail"
After examining a message
the user can delete `d') the message
or reply `r') to it.
Deletion causes the \fImailx\fR program
to forget about the message.
This is not irreversible;
the message can be undeleted `u')
by giving its number,
or the \fImailx\fR session can be aborted
by giving the exit `x') command.
Deleted messages will, however,
usually disappear never to be seen again.
.SS "Specifying messages"
Commands such as print and delete
can be given a list of message numbers
as arguments to apply to a number of messages at once.
Thus `\fIdelete 1 2\fR' deletes messages 1 and 2,
while `\fIdelete 1-5\fR' deletes messages 1 through 5.
In sorted or threaded mode (see the
.I sort
and
.I thread
commands),
`\fIdelete 1-5\fR' deletes the messages
that are located between (and including) messages 1 through 5
in the sorted/threaded order,
as shown in the header summary.
The following special message names exist:
.TP
.B :n
All new messages.
.TP
.B :o
All old messages (any not in state read or new).
.TP
.B :u
All unread messages.
.TP
.B :d
All deleted messages (for the
.I undelete
command).
.TP
.B :r
All read messages.
.TP
.B :f
All `flagged' messages.
.TP
.B :a
All answered messages
(cf. the
.I markanswered
variable).
.TP
.B :t
All messages marked as draft.
.TP
.B :k
All `killed' messages.
.TP
.B :j
All messages classified as junk.
.TP
.B .
The current message.
.TP
.B ;
The message that was previously the current message.
.TP
.B ,
The parent message of the current message,
that is the message with the Message-ID
given in the `In-Reply-To:' field
or the last entry of the `References:' field
of the current message.
.TP
.B \-
The next previous undeleted message,
or the next previous deleted message for the
.I undelete
command.
In sorted/threaded mode,
the next previous such message in the sorted/threaded order.
.TP
.B +
The next undeleted message,
or the next deleted message for the
.I undelete
command.
In sorted/threaded mode,
the next such message in the sorted/threaded order.
.TP
.B ^
The first undeleted message,
or the first deleted message
for the
.I undelete
command.
In sorted/threaded mode,
the first such message in the sorted/threaded order.
.TP
.B $
The last message.
In sorted/threaded mode,
the last message in the sorted/threaded order.
.TP
.BI & x
In threaded mode,
selects the message addressed with
.IR x ,
where
.I x
is any other message specification,
and all messages from the thread that begins at it.
Otherwise, it is identical to
.IR x .
If
.I x
is omitted,
the thread beginning with the current message is selected.
.TP
.B *
All messages.
.TP
.B `
All messages that were included in the message list
for the previous command.
.TP
.BI / string
All messages that contain
.I string
in the subject field (case ignored).
See also the
.I searchheaders
variable.
If
.I string
is empty,
the string from the previous specification of that type is used again.
.TP
.I address
All messages from
.IR address .
By default, this is a case-sensitive search
for the complete email address.
If the
.I allnet
variable is set,
only the local part of the addresses is evaluated for the comparison.
Otherwise if the
.I showname
variable is set,
a case-sensitive search for the complete real name
of a sender is performed.
The IMAP-style
.BI (from\ address)
expression can be used instead
if substring matches are desired.
.TP
.BI ( criterion )
All messages that satisfy the given IMAP-style SEARCH
.IR criterion .
This addressing mode is available with all types of folders;
for folders not located on IMAP servers,
or for servers unable to execute the SEARCH command,
.I mailx
will perform the search locally.
Strings must be enclosed by double quotes `"' in their entirety
if they contain white space or parentheses;
within the quotes,
only backslash `\e' is recognized as an escape character.
All string searches are case-insensitive.
When the description indicates
that the `envelope' representation of an address field is used,
this means that the search string is checked against
both a list constructed as
.nf
.sp
\fB("\fIreal name\fB" "\fIsource-route\fB" "\fIlocal-part\fB" "\fIdomain-part\fB")\fR
.sp
.fi
for each address,
and the addresses without real names
from the respective header field.
Criteria can be nested using parentheses.
.TP
\fB(\fIcriterion1 criterion2\fR .\|.\|. \fIcriterionN\fB)\fR
All messages that satisfy all of the given criteria.
.TP
.BI (or " criterion1 criterion2" )
All messages that satisfy either
.I criterion1
or
.IR criterion2 ,
or both.
To connect more than two criteria using `or',
(or) specifications have to be nested using additional parentheses,
as with `(or\ a\ (or\ b\ c))';
`(or\ a\ b\ c)' means ((a or b) and c).
For a simple `or' operation of independent criteria
on the lowest nesting level,
it is possible to achieve similar effects by using
three separate criteria, as with
`(a)\ (b)\ (c)'.
.TP
.BI (not " criterion" )
All messages that do not satisfy
.IR criterion .
.TP
.BI (bcc " string" )
All messages that contain
.I string
in the `envelope' representation of the
.I Bcc:
field.
.TP
.BI (cc " string" )
All messages that contain
.I string
in the `envelope' representation of the
.I Cc:
field.
.TP
.BI (from " string" )
All messages that contain
.I string
in the `envelope' representation of the
.I From:
field.
.TP
.BI (subject " string" )
All messages that contain
.I string
in the
.I Subject:
field.
.TP
.BI (to " string" )
All messages that contain
.I string
in the `envelope' representation of the
.I To:
field.
.TP
.BI (header " name string" )
All messages that contain
.I string
in the specified
.I Name:
field.
.TP
.BI (body " string" )
All messages that contain
.I string
in their body.
.TP
.BI (text " string" )
All messages that contain
.I string
in their header or body.
.TP
.BI (larger " size" )
All messages that are larger than
.I size
(in bytes).
.TP
.BI (smaller " size" )
All messages that are smaller than
.I size
(in bytes).
.TP
.BI (before " date" )
All messages that were received before
.IR date ;
.I date
must be in the form
\fId\fR[\fId\fR]\fB-\fImon\fB-\fIyyyy\fR,
where \fId\fR[\fId\fR] is the day of the month
as one or two digits,
.I mon
is the name of the month\(emone of
`Jan', `Feb', `Mar',
`Apr', `May', `Jun',
`Jul', `Aug', `Sep',
`Oct', `Nov', or `Dec',
and
.I yyyy
is the year as four digits;
e.\|g. "30-Aug-2004".
.TP
.BI (on " date" )
All messages that were received on the specified date.
.TP
.BI (since " date" )
All messages that were received since the specified date.
.TP
.BI (sentbefore " date" )
All messages that were sent on the specified date.
.TP
.BI (senton " date" )
All messages that were sent on the specified date.
.TP
.BI (sentsince " date" )
All messages that were sent since the specified date.
.TP
.B ()
The same criterion as for the previous search.
This specification cannot be used as part of another criterion.
If the previous command line contained more than one independent criterion,
the last of those criteria is used.
.PP
A practical method to read a set of messages
is to issue a
.I from
command with the search criteria first
to check for appropriate messages,
and to read each single message then by typing `\fB`\fR' repeatedly.
.SS "Replying to or originating mail"
The
.I reply
command can be used
to set up a response to a message,
sending it back to the person who it was from.
Text the user types in then,
up to an end-of-file,
defines the contents of the message.
While the user is composing a message,
\fImailx\fR treats lines beginning with the character `~' specially.
For instance, typing `~m' (alone on a line)
will place a copy of the current message into the response
right shifting it by a tabstop
(see
.I indentprefix
variable, below).
Other escapes will set up subject fields,
add and delete recipients to the message,
attach files to it
and allow the user to escape to an editor
to revise the message
or to a shell to run some commands.
(These options are given in the summary below.)
.SS "Ending a mail processing session"
The user can end a \fImailx\fR session
with the quit (`q') command.
Messages which have been examined
go to the user's mbox file
unless they have been deleted
in which case they are discarded.
Unexamined messages go back
to the post office.
(See the \-f option above).
.SS "Personal and systemwide distribution lists"
It is also possible to create
a personal distribution lists so that,
for instance, the user can send mail
to `\fIcohorts\fR' and have it go
to a group of people.
Such lists can be defined by placing a line like
.nf
\fBalias\fI cohorts bill ozalp jkf mark kridle@ucbcory\fR
.fi
in the file .mailrc in the user's home directory.
The current list of such aliases
can be displayed with the alias command in \fImailx\fR.
System wide distribution lists can be created
by editing /etc/aliases, see
.IR aliases (5)
and
.IR sendmail (8);
these are kept in a different syntax.
In mail the user sends,
personal aliases will be expanded
in mail sent to others so that
they will be able to reply to the recipients.
System wide aliases are not expanded when the mail is sent,
but any reply returned to the machine
will have the system wide alias expanded
as all mail goes through sendmail.
.SS "Recipient address specifications"
When an address is used to name a recipient
(in any of To, Cc, or Bcc),
names of local mail folders
and pipes to external commands
can also be specified;
the message text is then written to them.
The rules are: Any name which starts with a
.RB ` | '
character specifies a pipe,
the command string following the `|'
is executed and the message is sent to its standard input;
any other name which contains a
.RB ` @ '
character is treated as a mail address;
any other name which starts with a
.RB ` + '
character specifies a folder name;
any other name which contains a
.RB ` / '
character
but no
.RB ` ! '
or
.RB ` % '
character before also specifies a folder name;
what remains is treated as a mail address.
Compressed folders are handled as described for the
.I folder
command below.
.SS "Network mail (Internet / ARPA, UUCP, Berknet)"
See
.IR mailaddr (7)
for a description of network addresses.
\fIMailx\fR has a number of options
which can be set in the .mailrc file
to alter its behavior;
thus `\fIset askcc\fR' enables the askcc feature.
(These options are summarized below).
.SS "MIME types"
For any outgoing attachment,
\fImailx\fR tries to determine the content type.
It does this by reading MIME type files
whose lines have the following syntax:
.nf
\fItype\fB/\fIsubtype extension \fR[\fIextension \fR.\ .\ .]\fR
.fi
where type/subtype are strings describing the file contents,
and extension is the part of a filename starting after the last dot.
Any line not immediately beginning with an ASCII alphabetical character is
ignored by \fImailx\fR.
If there is a match with the extension of the file to attach,
the given type/subtype pair is used.
Otherwise, or if the filename has no extension,
the content types text/plain or application/octet-stream are used,
the first for text or international text files,
the second for any file that contains formatting characters
other than newlines and horizontal tabulators.
.SS "Character sets"
.I Mailx
normally detects the character set of the terminal
using the LC_CTYPE locale setting.
If the locale cannot be used appropriately,
the \fIttycharset\fR variable should be set
to provide an explicit value.
When reading messages,
their text is converted to the terminal character set if possible.
Unprintable characters and illegal byte sequences are detected
and replaced by Unicode substitute characters or question marks
unless the
.I print-all-chars
is set at initialization time.
.PP
The character set for outgoing messages
is not necessarily the same
as the one used on the terminal.
If an outgoing text message
contains characters not representable in US-ASCII,
the character set being used
must be declared within its header.
Permissible values can be declared
using the \fIsendcharsets\fR variable,
separated by commas;
.I mailx
tries each of the values in order
and uses the first appropriate one.
If the message contains characters that cannot be represented
in any of the given character sets,
the message will not be sent,
and its text will be saved to the `dead.letter' file.
Messages that contain NUL bytes are not converted.
.PP
Outgoing attachments are converted if they are plain text.
If the
.I sendcharsets
variable contains more than one character set name,
the
.I ~@
tilde escape will ask for the character sets for individual attachments
if it is invoked without arguments.
.PP
Best results are usually achieved
when
.I mailx
is run in a UTF-8 locale
on a UTF-8 capable terminal.
In this setup,
characters from various countries can be displayed,
while it is still possible to use more simple
character sets for sending
to retain maximum compatibility with older mail clients.
.SS "Commands"
Each command is typed on a line by itself,
and may take arguments following the command word.
The command need not be typed in its entirety \(en
the first command which matches the typed prefix is used.
For commands which take message lists as arguments,
if no message list is given,
then the next message forward which satisfies
the command's requirements is used.
If there are no messages forward of the current message,
the search proceeds backwards,
and if there are no good messages at all,
\fImailx\fR types `\fIapplicable messages\fR' and aborts the command.
If the command begins with a \fI#\fR sign,
the line is ignored.
.PP
The arguments to commands can be quoted, using the following methods:
.IP \(bu
An argument can be enclosed between paired double-quotes
"\|" or single-quotes '\|'; any white space, shell
word expansion, or backslash characters within the quotes
are treated literally as part of the argument.
A double-quote will be treated literally within
single-quotes and vice versa. These special properties of
the quote marks occur only when they are paired at the
beginning and end of the argument.
.IP \(bu
A backslash outside of the enclosing quotes is discarded
and the following character is treated literally as part of
the argument.
.IP \(bu
An unquoted backslash at the end of a command line is
discarded and the next line continues the command.
.PP
Filenames, where expected, are subjected to the following
transformations, in sequence:
.IP \(bu
If the filename begins with an unquoted plus sign, and
the
.I folder
variable is defined,
the plus sign will be replaced by the value of the
.I folder
variable followed by a slash. If the
.I folder
variable is
unset or is set to null, the filename will be unchanged.
.IP \(bu
Shell word expansions are applied to the filename.
If more than a single pathname results
from this expansion and the command is expecting one
file, an error results.
.PP
The following commands are provided:
.TP
.B \-
Print out the preceding message.
If given a numeric argument n,
goes to the n'th previous message and prints it.
.TP
.B ?
Prints a brief summary of commands.
.TP
.B !
Executes the shell (see
.IR sh (1)
and
.IR csh (1))
command which follows.
.TP
.B |
A synonym for the \fIpipe\fR command.
.TP
.B account
(ac) Creates, selects or lists
an email account.
An account is formed by a group of commands,
primarily of those to set variables.
With two arguments,
of which the second is a `{',
the first argument gives an account name,
and the following lines create a group of commands for that account
until a line containing a single `}' appears.
With one argument,
the previously created group of commands
for the account name is executed,
and a
.I folder
command is executed for the system mailbox or inbox
of that account.
Without arguments,
the list of accounts and their contents are printed.
As an example,
.sp
.nf
\fBaccount\fI myisp\fR \fB{\fR
set folder=imaps://[email protected]
set record=+Sent
set from="[email protected] (My Name)"
set smtp=smtp.myisp.example
\fB}\fR
.fi
.sp
creates an account named `myisp'
which can later be selected by specifying `account myisp'.
.TP
.B alias
(a) With no arguments,
prints out all currently-defined aliases.
With one argument, prints out that alias.
With more than one argument,
creates a new alias or changes an old one.
.TP
.B alternates
(alt) The alternates command is useful
if the user has accounts on several machines.
It can be used to inform \fImailx\fR
that the listed addresses all belong to the invoking user.
When he replies to messages,
\fImailx\fR will not send a copy of the message
to any of the addresses
listed on the alternates list.
If the alternates command is given
with no argument,
the current set of alternate names is displayed.
.TP
.B answered
(ans) Takes a message list and marks each message
as a having been answered.
This mark has no technical meaning in the mail system;
it just causes messages to be marked in the header summary,
and makes them specially addressable.
.TP
.B cache
Only applicable to cached IMAP mailboxes;
takes a message list and reads the specified messages
into the IMAP cache.
.TP
.B call
Calls a macro (see the
.I define
command).
.TP
.B cd
Same as chdir.
.TP
.B certsave
Only applicable to S/MIME signed messages.
Takes a message list and a file name
and saves the certificates contained within the message signatures
to the named file in both human-readable and PEM format.
The certificates can later be used to send encrypted messages
to the messages' originators by setting the
.I smime-encrypt-user@host
variable.
.TP
.B chdir
(ch) Changes the user's working directory to that specified,
if given.
If no directory is given,
then changes to the user's login directory.
.TP
.B classify
(cl) Takes a list of messages and
examines their contents for characteristics of junk mail
using Bayesian filtering.
Messages considered to be junk are then marked as such.
The junk mail database is not changed.
.TP
.B collapse
(coll)
Only applicable to threaded mode.
Takes a message list
and makes all replies to these messages invisible
in header summaries,
unless they are in state `new'.
.TP
.B connect
(conn) If operating in disconnected mode on an IMAP mailbox,
switch to online mode and connect to the mail server
while retaining the mailbox status.
See the description of the
.I disconnected
variable for more information.
.TP
.B copy
(c) The copy command does the same thing that
.I save
does,
except that it does not mark the messages
it is used on for deletion when the user quits.
Compressed files and IMAP mailboxes are handled as described for the
.I folder
command.
.TP
.B Copy
(C) Similar to
.IR copy ,
but saves the messages in a file named after the local part
of the sender address of the first message.
.TP
.B decrypt
(dec) For unencrypted messages,
this command is identical to
.IR copy .
Encrypted messages are first decrypted, if possible,
and then copied.
.TP
.B Decrypt
(Dec) Similar to
.IR decrypt ,
but saves the messages in a file named after the local part
of the sender address of the first message.
.TP
.B define
(def) Defines a macro.
A macro definition is a sequence of commands in the following form:
.sp
.nf
\fBdefine\fR \fIname\fB {\fR
\fIcommand1\fR
\fIcommand2\fR
.\|.\|.
\fIcommandN\fR
\fB}\fR
.fi
.sp
Once defined, a macro can be explicitly invoked using the
.I call
command,