aboutsummaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2003/man1p/mailx.1p
blob: 86d45f6c545f2b40d4890e4961ca8bec6e7166ae (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "MAILX" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" mailx 
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
mailx \- process messages
.SH SYNOPSIS
.SS Send Mode
.sp
.RS
.nf

\fBmailx\fP \fB[\fP\fB-s\fP \fIsubject\fP\fB]\fP \fIaddress\fP\fB...
\fP
.fi
.RE
.SS Receive Mode
.sp
.RS
.nf

\fBmailx -e
.sp

.sp

mailx\fP \fB[\fP\fB-HiNn\fP\fB][\fP\fB-F\fP\fB][\fP\fB-u\fP \fIuser\fP\fB]\fP\fB
.br

.sp

mailx -f\fP\fB[\fP\fB-HiNn\fP\fB][\fP\fB-F\fP\fB][\fP\fIfile\fP\fB]\fP\fB
.br

\fP
.fi
.RE
.SH DESCRIPTION
.LP
The \fImailx\fP utility provides a message sending and receiving facility.
It has two major modes, selected by the options
used: Send Mode and Receive Mode.
.LP
On systems that do not support the User Portability Utilities option,
an application using \fImailx\fP shall have the ability
to send messages in an unspecified manner (Send Mode). Unless the
first character of one or more lines is tilde ( \fB'~'\fP
), all characters in the input message shall appear in the delivered
message, but additional characters may be inserted in the
message before it is retrieved.
.LP
On systems supporting the User Portability Utilities option, mail-receiving
capabilities and other interactive features, Receive
Mode, described below, also shall be enabled.
.SS Send Mode
.LP
Send Mode can be used by applications or users to send messages from
the text in standard input.
.SS Receive Mode
.LP
Receive Mode is more oriented towards interactive users. Mail can
be read and sent in this interactive mode.
.LP
When reading mail, \fImailx\fP provides commands to facilitate saving,
deleting, and responding to messages. When sending mail,
\fImailx\fP allows editing, reviewing, and other modification of the
message as it is entered.
.LP
Incoming mail shall be stored in one or more unspecified locations
for each user, collectively called the system \fImailbox\fP
for that user. When \fImailx\fP is invoked in Receive Mode, the system
mailbox shall be the default place to find new mail. As
messages are read, they shall be marked to be moved to a secondary
file for storage, unless specific action is taken. This
secondary file is called the \fBmbox\fP and is normally located in
the directory referred to by the \fIHOME\fP environment
variable (see \fIMBOX\fP in the ENVIRONMENT VARIABLES section for
a description of this file). Messages shall remain in this file
until explicitly removed. When the \fB-f\fP option is used to read
mail messages from secondary files, messages shall be retained
in those files unless specifically removed. All three of these locations-system
mailbox, \fBmbox\fP, and secondary file-are
referred to in this section as simply "mailboxes", unless more specific
identification is required.
.SH OPTIONS
.LP
The \fImailx\fP utility shall conform to the Base Definitions volume
of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
.LP
The following options shall be supported. (Only the \fB-s\fP \fIsubject\fP
option shall be required on all systems. The other
options are required only on systems supporting the User Portability
Utilities option.)
.TP 7
\fB-e\fP
Test for the presence of mail in the system mailbox. The \fImailx\fP
utility shall write nothing and exit with a successful
return code if there is mail to read.
.TP 7
\fB-f\fP
Read messages from the file named by the \fIfile\fP operand instead
of the system mailbox. (See also \fBfolder\fP.) If no
\fIfile\fP operand is specified, read messages from \fBmbox\fP instead
of the system mailbox.
.TP 7
\fB-F\fP
Record the message in a file named after the first recipient. The
name is the login-name portion of the address found first on
the \fBTo:\fP line in the mail header. Overrides the \fBrecord\fP
variable, if set (see Internal
Variables in mailx .)
.TP 7
\fB-H\fP
Write a header summary only.
.TP 7
\fB-i\fP
Ignore interrupts. (See also \fBignore\fP.)
.TP 7
\fB-n\fP
Do not initialize from the system default start-up file. See the EXTENDED
DESCRIPTION section.
.TP 7
\fB-N\fP
Do not write an initial header summary.
.TP 7
\fB-s\ \fP \fIsubject\fP
Set the \fBSubject\fP header field to \fIsubject\fP. All characters
in the \fIsubject\fP string shall appear in the
delivered message. The results are unspecified if \fIsubject\fP is
longer than {LINE_MAX} - 10 bytes or contains a
<newline>.
.TP 7
\fB-u\ \fP \fIuser\fP
Read the system mailbox of the login name \fIuser\fP. This shall only
be successful if the invoking user has the appropriate
privileges to read the system mailbox of that user.
.sp
.SH OPERANDS
.LP
The following operands shall be supported:
.TP 7
\fIaddress\fP
Addressee of message. When \fB-n\fP is specified and no user start-up
files are accessed (see the EXTENDED DESCRIPTION
section), the user or application shall ensure this is an address
to pass to the mail delivery system. Any system or user start-up
files may enable aliases (see \fBalias\fP under Commands in mailx
) that may modify the form of
\fIaddress\fP before it is passed to the mail delivery system.
.TP 7
\fIfile\fP
A pathname of a file to be read instead of the system mailbox when
\fB-f\fP is specified. The meaning of the \fIfile\fP
option-argument shall be affected by the contents of the \fBfolder\fP
internal variable; see Internal
Variables in mailx .
.sp
.SH STDIN
.LP
When \fImailx\fP is invoked in Send Mode (the first synopsis line),
standard input shall be the message to be delivered to the
specified addresses. When in Receive Mode, user commands shall be
accepted from \fIstdin\fP. If the User Portability Utilities
option is not supported, standard input lines beginning with a tilde
( \fB'~'\fP ) character produce unspecified
results.
.LP
If the User Portability Utilities option is supported, then in both
Send and Receive Modes, standard input lines beginning with
the escape character (usually tilde ( \fB'~'\fP )) shall affect processing
as described in Command Escapes in mailx .
.SH INPUT FILES
.LP
When \fImailx\fP is used as described by this volume of IEEE\ Std\ 1003.1-2001,
the \fIfile\fP option-argument (see
the \fB-f\fP option) and the \fBmbox\fP shall be text files containing
mail messages, formatted as described in the OUTPUT FILES
section. The nature of the system mailbox is unspecified; it need
not be a file.
.SH ENVIRONMENT VARIABLES
.LP
The following environment variables shall affect the execution of
\fImailx\fP:
.TP 7
\fIDEAD\fP
Determine the pathname of the file in which to save partial messages
in case of interrupts or delivery errors. The default
shall be \fBdead.letter\fP in the directory named by the \fIHOME\fP
variable. The behavior of \fImailx\fP in saving partial
messages is unspecified if the User Portability Utilities option is
not supported and \fIDEAD\fP is not defined with the value
\fB/dev/null\fP.
.TP 7
\fIEDITOR\fP
Determine the name of a utility to invoke when the \fBedit\fP (see
Commands in mailx ) or
\fB~e\fP (see Command Escapes in mailx ) command is used. The default
editor is unspecified.
\ On XSI-conformant systems it is \fIed\fP.  The effects of this variable
are unspecified if the User Portability Utilities option is not
supported.
.TP 7
\fIHOME\fP
Determine the pathname of the user's home directory.
.TP 7
\fILANG\fP
Provide a default value for the internationalization variables that
are unset or null. (See the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
for
the precedence of internationalization variables used to determine
the values of locale categories.)
.TP 7
\fILC_ALL\fP
If set to a non-empty string value, override the values of all the
other internationalization variables.
.TP 7
\fILC_CTYPE\fP
Determine the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as
opposed to multi-byte characters in arguments and input files) and
the handling of case-insensitive address and header-field
comparisons.
.TP 7
\fILC_TIME\fP
Determine the format and contents of the date and time strings written
by \fImailx\fP.
.TP 7
\fILC_MESSAGES\fP
Determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard error and
informative messages written to standard output.
.TP 7
\fILISTER\fP
Determine a string representing the command for writing the contents
of the \fBfolder\fP directory to standard output when the
\fBfolders\fP command is given (see \fBfolders\fP in Commands in mailx
). Any string acceptable as
a \fIcommand_string\fP operand to the \fIsh\fP \fB-c\fP command shall
be valid. If this
variable is null or not set, the output command shall be \fIls\fP.
The effects of this variable
are unspecified if the User Portability Utilities option is not supported.
.TP 7
\fIMAILRC\fP
Determine the pathname of the start-up file. The default shall be
\fB\&.mailrc\fP in the directory referred to by the
\fIHOME\fP environment variable. The behavior of \fImailx\fP is unspecified
if the User Portability Utilities option is not
supported and \fIMAILRC\fP is not defined with the value \fB/dev/null\fP.
.TP 7
\fIMBOX\fP
Determine a pathname of the file to save messages from the system
mailbox that have been read. The \fBexit\fP command shall
override this function, as shall saving the message explicitly in
another file. The default shall be \fBmbox\fP in the directory
named by the \fIHOME\fP variable. The effects of this variable are
unspecified if the User Portability Utilities option is not
supported.
.TP 7
\fINLSPATH\fP
Determine the location of message catalogs for the processing of \fILC_MESSAGES
\&.\fP 
.TP 7
\fIPAGER\fP
Determine a string representing an output filtering or pagination
command for writing the output to the terminal. Any string
acceptable as a \fIcommand_string\fP operand to the \fIsh\fP \fB-c\fP
command shall be valid.
When standard output is a terminal device, the message output shall
be piped through the command if the \fImailx\fP internal
variable \fBcrt\fP is set to a value less the number of lines in the
message; see Internal Variables in
mailx . If the \fIPAGER\fP variable is null or not set, the paginator
shall be either \fImore\fP or another paginator utility documented
in the system documentation. The effects of this
variable are unspecified if the User Portability Utilities option
is not supported.
.TP 7
\fISHELL\fP
Determine the name of a preferred command interpreter. The default
shall be \fIsh\fP. The
effects of this variable are unspecified if the User Portability Utilities
option is not supported.
.TP 7
\fITERM\fP
If the internal variable \fBscreen\fP is not specified, determine
the name of the terminal type to indicate in an unspecified
manner the number of lines in a screenful of headers. If \fITERM\fP
is not set or is set to null, an unspecified default terminal
type shall be used and the value of a screenful is unspecified. The
effects of this variable are unspecified if the User
Portability Utilities option is not supported.
.TP 7
\fITZ\fP
This variable may determine the timezone used to calculate date and
time strings written by \fImailx\fP. If \fITZ\fP is unset
or null, an unspecified default timezone shall be used.
.TP 7
\fIVISUAL\fP
Determine a pathname of a utility to invoke when the \fBvisual\fP
command (see Commands in
mailx ) or \fB~v\fP command-escape (see Command Escapes in mailx )
is used. If this
variable is null or not set, the full-screen editor shall be \fIvi\fP.
The effects of this
variable are unspecified if the User Portability Utilities option
is not supported.
.sp
.SH ASYNCHRONOUS EVENTS
.LP
When \fImailx\fP is in Send Mode and standard input is not a terminal,
it shall take the standard action for all signals.
.LP
In Receive Mode, or in Send Mode when standard input is a terminal,
if a SIGINT signal is received:
.IP " 1." 4
If in command mode, the current command, if there is one, shall be
aborted, and a command-mode prompt shall be written.
.LP
.IP " 2." 4
If in input mode:
.RS
.IP " a." 4
If \fBignore\fP is set, \fImailx\fP shall write \fB"@\\n"\fP, discard
the current input line, and continue processing,
bypassing the message-abort mechanism described in item 2b.
.LP
.IP " b." 4
If the interrupt was received while sending mail, either when in Receive
Mode or in Send Mode, a message shall be written, and
another subsequent interrupt, with no other intervening characters
typed, shall be required to abort the mail message. If in
Receive Mode and another interrupt is received, a command-mode prompt
shall be written. If in Send Mode and another interrupt is
received, \fImailx\fP shall terminate with a non-zero status.
.LP
In both cases listed in item b, if the message is not empty:
.RS
.IP "i. " 5
If \fBsave\fP is enabled and the file named by \fIDEAD\fP can be created,
the message shall be written to the file named by
\fIDEAD\fP.  If the file exists, the message shall be written to replace
the contents of the file.
.LP
.IP "ii." 5
If \fBsave\fP is not enabled, or the file named by \fIDEAD\fP cannot
be created, the message shall not be saved.
.LP
.RE
.LP
.RE
.LP
.LP
The \fImailx\fP utility shall take the standard action for all other
signals.
.SH STDOUT
.LP
In command and input modes, all output, including prompts and messages,
shall be written to standard output.
.SH STDERR
.LP
The standard error shall be used only for diagnostic messages.
.SH OUTPUT FILES
.LP
Various \fImailx\fP commands and command escapes can create or add
to files, including the \fBmbox\fP, the dead-letter file,
and secondary mailboxes. When \fImailx\fP is used as described in
this volume of IEEE\ Std\ 1003.1-2001, these files shall
be text files, formatted as follows:
\fBline beginning with\fP \fBFrom<space>
.br
[\fP\fBone or more\fP \fIheader-lines\fP; see Commands in mailx \fB]
.br
\fP \fIempty line
.br
\fP \fB[\fP\fBzero or more\fP \fIbody lines
.br
empty line\fP\fB]
.br
[\fP\fBline beginning with\fP \fBFrom<space>...]\fP
.LP
where each message begins with the \fBFrom\ <space>\fP line shown,
preceded by the beginning of the file or an empty
line. (The \fBFrom <space>\fP line is considered to be part of the
message header, but not one of the header-lines referred
to in Commands in mailx ; thus, it shall not be affected by the \fBdiscard\fP,
\fBignore\fP, or
\fBretain\fP commands.) The formats of the remainder of the \fBFrom
<space>\fP line and any additional header lines are
unspecified, except that none shall be empty. The format of a message
body line is also unspecified, except that no line following
an empty line shall start with \fBFrom <space>\fP; \fImailx\fP shall
modify any such user-entered message body lines
(following an empty line and beginning with \fBFrom <space>\fP) by
adding one or more characters to precede the \fB'F'\fP
; it may add these characters to \fBFrom <space>\fP lines that are
not preceded by an empty line.
.LP
When a message from the system mailbox or entered by the user is not
a text file, it is implementation-defined how such a
message is stored in files written by \fImailx\fP.
.SH EXTENDED DESCRIPTION
.LP
The entire EXTENDED DESCRIPTION section shall apply only to implementations
supporting the User Portability Utilities
option.
.LP
The \fImailx\fP utility cannot guarantee support for all character
encodings in all circumstances. For example, inter-system
mail may be restricted to 7-bit data by the underlying network, 8-bit
data need not be portable to non-internationalized systems,
and so on. Under these circumstances, it is recommended that only
characters defined in the ISO/IEC\ 646:1991 standard
International Reference Version (equivalent to ASCII) 7-bit range
of characters be used.
.LP
When \fImailx\fP is invoked using one of the Receive Mode synopsis
forms, it shall write a page of header-summary lines (if
\fB-N\fP was not specified and there are messages, see below), followed
by a prompt indicating that \fImailx\fP can accept
regular commands (see Commands in mailx ); this is termed \fIcommand
mode\fP. The page of
header-summary lines shall contain the first new message if there
are new messages, or the first unread message if there are unread
messages, or the first message. When \fImailx\fP is invoked using
the Send Mode synopsis and standard input is a terminal, if no
subject is specified on the command line and the \fBasksub\fP variable
is set, a prompt for the subject shall be written. At this
point, \fImailx\fP shall be in input mode. This input mode shall also
be entered when using one of the Receive Mode synopsis forms
and a reply or new message is composed using the \fBreply\fP, \fBReply\fP,
\fBfollowup\fP, \fBFollowup\fP, or \fBmail\fP
commands and standard input is a terminal. When the message is typed
and the end of the message is encountered, the message shall
be passed to the mail delivery software. Commands can be entered by
beginning a line with the escape character (by default, tilde (
\fB'~'\fP )) followed by a single command letter and optional arguments.
See Commands in
mailx for a summary of these commands. It is unspecified what effect
these commands will have if standard input is not a
terminal when a message is entered using either the Send Mode synopsis,
or the Read Mode commands \fBreply\fP, \fBReply\fP,
\fBfollowup\fP, \fBFollowup\fP, or \fBmail\fP. 
.TP 7
\fBNote:\fP
For notational convenience, this section uses the default escape character,
tilde, in all references and examples.
.sp
.LP
At any time, the behavior of \fImailx\fP shall be governed by a set
of environmental and internal variables. These are flags
and valued parameters that can be set and cleared via the \fImailx\fP
\fBset\fP and \fBunset\fP commands.
.LP
Regular commands are of the form:
.sp
.RS
.nf

\fB[\fP\fIcommand\fP\fB] [\fP\fImsglist\fP\fB] [\fP\fIargument\fP \fB...\fP\fB]
\fP
.fi
.RE
.LP
If no \fIcommand\fP is specified in command mode, \fBnext\fP shall
be assumed. In input mode, commands shall be recognized by
the escape character, and lines not treated as commands shall be taken
as input for the message.
.LP
In command mode, each message shall be assigned a sequential number,
starting with 1.
.LP
All messages have a state that shall affect how they are displayed
in the header summary and how they are retained or deleted
upon termination of \fImailx\fP. There is at any time the notion of
a \fIcurrent\fP message, which shall be marked by a
\fB'>'\fP at the beginning of a line in the header summary. When \fImailx\fP
is invoked using one of the Receive Mode
synopsis forms, the current message shall be the first new message,
if there is a new message, or the first unread message if there
is an unread message, or the first message if there are any messages,
or unspecified if there are no messages in the mailbox. Each
command that takes an optional list of messages (\fImsglist\fP) or
an optional single message (\fImessage\fP) on which to operate
shall leave the current message set to the highest-numbered message
of the messages specified, unless the command deletes messages,
in which case the current message shall be set to the first undeleted
message (that is, a message not in the deleted state) after
the highest-numbered message deleted by the command, if one exists,
or the first undeleted message before the highest-numbered
message deleted by the command, if one exists, or to an unspecified
value if there are no remaining undeleted messages. All
messages shall be in one of the following states:
.TP 7
\fInew\fP
The message is present in the system mailbox and has not been viewed
by the user or moved to any other state. Messages in state
\fInew\fP when \fImailx\fP quits shall be retained in the system mailbox.
.TP 7
\fIunread\fP
The message has been present in the system mailbox for more than one
invocation of \fImailx\fP and has not been viewed by the
user or moved to any other state. Messages in state \fIunread\fP when
\fImailx\fP quits shall be retained in the system
mailbox.
.TP 7
\fIread\fP
The message has been processed by one of the following commands: \fB~f\fP,
\fB~m\fP, \fB~F\fP,
\fB~M\fP, \fBcopy\fP, \fBmbox\fP, \fBnext\fP, \fBpipe\fP, \fBprint\fP,
\fBPrint\fP, \fBtop\fP, \fBtype\fP,
\fBType\fP, \fBundelete\fP. The \fBdelete\fP, \fBdp\fP, and \fBdt\fP
commands may also cause the next message to be marked as
\fIread\fP, depending on the value of the \fBautoprint\fP variable.
Messages that are in the system mailbox and in state
\fIread\fP when \fImailx\fP quits shall be saved in the \fBmbox\fP,
unless the internal variable \fBhold\fP was set. Messages
that are in the \fBmbox\fP or in a secondary mailbox and in state
\fIread\fP when \fImailx\fP quits shall be retained in their
current location.
.TP 7
\fIdeleted\fP
The message has been processed by one of the following commands: \fBdelete\fP,
\fBdp\fP, \fBdt\fP. Messages in state
\fIdeleted\fP when \fImailx\fP quits shall be deleted. Deleted messages
shall be ignored until \fImailx\fP quits or changes
mailboxes or they are specified to the undelete command; for example,
the message specification / \fIstring\fP shall only search
the subject lines of messages that have not yet been deleted, unless
the command operating on the list of messages is
\fBundelete\fP. No deleted message or deleted message header shall
be displayed by any \fImailx\fP command other than
\fBundelete\fP.
.TP 7
\fIpreserved\fP
The message has been processed by a \fBpreserve\fP command. When \fImailx\fP
quits, the message shall be retained in its
current location.
.TP 7
\fIsaved\fP
The message has been processed by one of the following commands: \fBsave\fP
or \fBwrite\fP. If the current mailbox is the
system mailbox, and the internal variable \fBkeepsave\fP is set, messages
in the state saved shall be saved to the file designated
by the \fIMBOX\fP variable (see the ENVIRONMENT VARIABLES section).
If the current mailbox is the system mailbox, messages in the
state \fIsaved\fP shall be deleted from the current mailbox, when
the \fBquit\fP or \fBfile\fP command is used to exit the
current mailbox.
.sp
.LP
The header-summary line for each message shall indicate the state
of the message.
.LP
Many commands take an optional list of messages ( \fImsglist\fP) on
which to operate, which defaults to the current message. A
\fImsglist\fP is a list of message specifications separated by <blank>s,
which can include:
.TP 7
\fBn\fP
Message number \fIn\fP.
.TP 7
\fB+\fP
The next undeleted message, or the next deleted message for the \fBundelete\fP
command.
.TP 7
\fB-\fP
The next previous undeleted message, or the next previous deleted
message for the \fBundelete\fP command.
.TP 7
\fB\&.\fP
The current message.
.TP 7
\fB^\fP
The first undeleted message, or the first deleted message for the
\fBundelete\fP command.
.TP 7
\fB$\fP
The last message.
.TP 7
\fB*\fP
All messages.
.TP 7
\fBn-m\fP
An inclusive range of message numbers.
.TP 7
\fIaddress\fP
All messages from \fIaddress\fP; any address as shown in a header
summary shall be matchable in this form.
.TP 7
/\fIstring\fP
All messages with \fIstring\fP in the subject line (case ignored).
.TP 7
\fB:c\fP
All messages of type \fIc\fP, where \fIc\fP shall be one of: 
.TP 7
\fBd\fP
.RS
Deleted messages.
.RE
.TP 7
\fBn\fP
.RS
New messages.
.RE
.TP 7
\fBo\fP
.RS
Old messages (any not in state \fIread\fP or \fInew\fP).
.RE
.TP 7
\fBr\fP
.RS
Read messages.
.RE
.TP 7
\fBu\fP
.RS
Unread messages.
.RE
.sp
.sp
.LP
Other commands take an optional message ( \fImessage\fP) on which
to operate, which defaults to the current message. All of the
forms allowed for \fImsglist\fP are also allowed for \fImessage\fP,
but if more than one message is specified, only the first
shall be operated on.
.LP
Other arguments are usually arbitrary strings whose usage depends
on the command involved.
.SS Start-Up in mailx
.LP
At start-up time, \fImailx\fP shall take the following steps in sequence:
.IP " 1." 4
Establish all variables at their stated default values.
.LP
.IP " 2." 4
Process command line options, overriding corresponding default values.
.LP
.IP " 3." 4
Import any of the \fIDEAD\fP,  \fIEDITOR\fP,  \fIMBOX\fP,  \fILISTER
,\fP \fIPAGER\fP,  \fISHELL\fP,  or \fIVISUAL\fP
variables that are present in the environment, overriding the corresponding
default values.
.LP
.IP " 4." 4
Read \fImailx\fP commands from an unspecified system start-up file,
unless the \fB-n\fP option is given, to initialize any
internal \fImailx\fP variables and aliases.
.LP
.IP " 5." 4
Process the start-up file of \fImailx\fP commands named in the user
\fIMAILRC\fP variable.
.LP
.LP
Most regular \fImailx\fP commands are valid inside start-up files,
the most common use being to set up initial display options
and alias lists. The following commands shall be invalid in the start-up
file: \fB!\fP, \fBedit\fP, \fBhold\fP, \fBmail\fP,
\fBpreserve\fP, \fBreply\fP, \fBReply\fP, \fBshell\fP, \fBvisual\fP,
\fBCopy\fP, \fBfollowup\fP, and \fBFollowup\fP. Any
errors in the start-up file shall either cause \fImailx\fP to terminate
with a diagnostic message and a non-zero status or to
continue after writing a diagnostic message, ignoring the remainder
of the lines in the start-up file.
.LP
A blank line in a start-up file shall be ignored.
.SS Internal Variables in mailx
.LP
The following variables are internal \fImailx\fP variables. Each internal
variable can be set via the \fImailx\fP \fBset\fP
command at any time. The \fBunset\fP and \fBset\ no\fP \fIname\fP
commands can be used to erase variables.
.LP
In the following list, variables shown as:
.sp
.RS
.nf

\fBvariable
\fP
.fi
.RE
.LP
represent Boolean values. Variables shown as:
.sp
.RS
.nf

\fBvariable=\fP\fIvalue\fP
.fi
.RE
.LP
shall be assigned string or numeric values. For string values, the
rules in Commands in mailx
concerning filenames and quoting shall also apply.
.LP
The defaults specified here may be changed by the implementation-defined
system start-up file unless the user specifies the
\fB-n\fP option.
.TP 7
\fBallnet\fP
All network names whose login name components match shall be treated
as identical. This shall cause the \fImsglist\fP message
specifications to behave similarly. The default shall be \fBnoallnet\fP.
See also the \fBalternates\fP command and the
\fBmetoo\fP variable.
.TP 7
\fBappend\fP
Append messages to the end of the \fBmbox\fP file upon termination
instead of placing them at the beginning. The default shall
be \fBnoappend\fP. This variable shall not affect the \fBsave\fP command
when saving to \fBmbox\fP.
.TP 7
\fBask\fP,\ \fBasksub\fP
Prompt for a subject line on outgoing mail if one is not specified
on the command line with the \fB-s\fP option. The
\fBask\fP and \fBasksub\fP forms are synonyms; the system shall refer
to \fBasksub\fP and \fBnoasksub\fP in its messages, but
shall accept \fBask\fP and \fBnoask\fP as user input to mean \fBasksub\fP
and \fBnoasksub\fP. It shall not be possible to set
both \fBask\fP and \fBnoasksub\fP, or \fBnoask\fP and \fBasksub\fP.
The default shall be \fBasksub\fP, but no prompting shall
be done if standard input is not a terminal.
.TP 7
\fBaskbcc\fP
Prompt for the blind copy list. The default shall be \fBnoaskbcc\fP.
.TP 7
\fBaskcc\fP
Prompt for the copy list. The default shall be \fBnoaskcc\fP.
.TP 7
\fBautoprint\fP
Enable automatic writing of messages after \fBdelete\fP and \fBundelete\fP
commands. The default shall be
\fBnoautoprint\fP.
.TP 7
\fBbang\fP
Enable the special-case treatment of exclamation marks ( \fB'!'\fP
) in escape command lines; see the \fBescape\fP command
and Command Escapes in mailx . The default shall be \fBnobang\fP,
disabling the expansion of
\fB'!'\fP in the \fIcommand\fP argument to the \fB~!\fP command and
the \fB~<!\fP \fIcommand\fP escape.
.TP 7
\fBcmd\fP=\fIcommand\fP
.sp
Set the default command to be invoked by the \fBpipe\fP command. The
default shall be \fBnocmd\fP.
.TP 7
\fBcrt\fP=\fInumber\fP
Pipe messages having more than \fInumber\fP lines through the command
specified by the value of the \fIPAGER\fP variable. The
default shall be \fBnocrt\fP. If it is set to null, the value used
is implementation-defined.
.TP 7
\fBdebug\fP
Enable verbose diagnostics for debugging. Messages are not delivered.
The default shall be \fBnodebug\fP. 
.TP 7
\fBdot\fP
When \fBdot\fP is set, a period on a line by itself during message
input from a terminal shall also signify end-of-file (in
addition to normal end-of-file). The default shall be \fBnodot\fP.
If \fBignoreeof\fP is set (see below), a setting of
\fBnodot\fP shall be ignored and the period is the only method to
terminate input mode.
.TP 7
\fBescape\fP=\fIc\fP
Set the command escape character to be the character \fB'c'\fP . By
default, the command escape character shall be tilde. If
\fBescape\fP is unset, tilde shall be used; if it is set to null,
command escaping shall be disabled.
.TP 7
\fBflipr\fP
Reverse the meanings of the \fBR\fP and \fBr\fP commands. The default
shall be \fBnoflipr\fP.
.TP 7
\fBfolder\fP=\fIdirectory\fP
.sp
The default directory for saving mail files. User-specified filenames
beginning with a plus sign ( \fB'+'\fP ) shall be expanded
by preceding the filename with this directory name to obtain the real
pathname. If \fIdirectory\fP does not start with a slash (
\fB'/'\fP ), the contents of \fIHOME\fP shall be prefixed to it. The
default shall be \fBnofolder\fP. If \fBfolder\fP is
unset or set to null, user-specified filenames beginning with \fB'+'\fP
shall refer to files in the current directory that begin
with the literal \fB'+'\fP character. See also \fBoutfolder\fP below.
The \fBfolder\fP value need not affect the processing of
the files named in \fIMBOX\fP and \fIDEAD\fP. 
.TP 7
\fBheader\fP
Enable writing of the header summary when entering \fImailx\fP in
Receive Mode. The default shall be \fBheader\fP.
.TP 7
\fBhold\fP
Preserve all messages that are read in the system mailbox instead
of putting them in the \fBmbox\fP save file. The default
shall be \fBnohold\fP.
.TP 7
\fBignore\fP
Ignore interrupts while entering messages. The default shall be \fBnoignore\fP.
.TP 7
\fBignoreeof\fP
Ignore normal end-of-file during message input. Input can be terminated
only by entering a period ( \fB'.'\fP ) on a line by
itself or by the \fB~.\fP command escape. The default shall be \fBnoignoreeof\fP.
See also \fBdot\fP above.
.TP 7
\fBindentprefix\fP=\fIstring\fP
.sp
A string that shall be added as a prefix to each line that is inserted
into the message by the \fB~m\fP command escape. This
variable shall default to one <tab>.
.TP 7
\fBkeep\fP
When a system mailbox, secondary mailbox, or \fBmbox\fP is empty,
truncate it to zero length instead of removing it. The
default shall be \fBnokeep\fP.
.TP 7
\fBkeepsave\fP
Keep the messages that have been saved from the system mailbox into
other files in the file designated by the variable \fIMBOX
,\fP instead of deleting them. The default shall be \fBnokeepsave\fP.
.TP 7
\fBmetoo\fP
Suppress the deletion of the login name of the user from the recipient
list when replying to a message or sending to a group.
The default shall be \fBnometoo\fP.
.TP 7
\fBonehop\fP
When responding to a message that was originally sent to several recipients,
the other recipient addresses are normally forced to
be relative to the originating author's machine for the response.
This flag disables alteration of the recipients' addresses,
improving efficiency in a network where all machines can send directly
to all other machines (that is, one hop away). The default
shall be \fBnoonehop\fP. 
.TP 7
\fBoutfolder\fP
Cause the files used to record outgoing messages to be located in
the directory specified by the \fBfolder\fP variable unless
the pathname is absolute. The default shall be \fBnooutfolder\fP.
See the \fBrecord\fP variable.
.TP 7
\fBpage\fP
Insert a <form-feed> after each message sent through the pipe created
by the \fBpipe\fP command. The default shall be
\fBnopage\fP.
.TP 7
\fBprompt\fP=\fIstring\fP
.sp
Set the command-mode prompt to \fIstring\fP. If \fIstring\fP is null
or if \fBnoprompt\fP is set, no prompting shall occur. The
default shall be to prompt with the string \fB"?\ "\fP .
.TP 7
\fBquiet\fP
Refrain from writing the opening message and version when entering
\fImailx\fP. The default shall be \fBnoquiet\fP.
.TP 7
\fBrecord\fP=\fIfile\fP
Record all outgoing mail in the file with the pathname \fIfile\fP.
The default shall be \fBnorecord\fP. See also
\fBoutfolder\fP above.
.TP 7
\fBsave\fP
Enable saving of messages in the dead-letter file on interrupt or
delivery error. See the variable \fIDEAD\fP for the location
of the dead-letter file. The default shall be \fBsave\fP.
.TP 7
\fBscreen\fP=\fInumber\fP
.sp
Set the number of lines in a screenful of headers for the \fBheaders\fP
and \fBz\fP commands. If \fBscreen\fP is not specified,
a value based on the terminal type identified by the \fITERM\fP environment
variable, the window size, the baud rate, or some
combination of these shall be used.
.TP 7
\fBsendwait\fP
Wait for the background mailer to finish before returning. The default
shall be \fBnosendwait\fP.
.TP 7
\fBshowto\fP
When the sender of the message was the user who is invoking \fImailx\fP,
write the information from the \fBTo:\fP line
instead of the \fBFrom:\fP line in the header summary. The default
shall be \fBnoshowto\fP.
.TP 7
\fBsign\fP=\fIstring\fP
Set the variable inserted into the text of a message when the \fB~a\fP
command escape is given. The default shall be
\fBnosign\fP. The character sequences \fB'\\t'\fP and \fB'\\n'\fP
shall be recognized in the variable as <tab>s and
<newline>s, respectively. (See also \fB~i\fP in Command Escapes in
mailx .)
.TP 7
\fBSign\fP=\fIstring\fP
Set the variable inserted into the text of a message when the \fB~A\fP
command escape is given. The default shall be
\fBnoSign\fP. The character sequences \fB'\\t'\fP and \fB'\\n'\fP
shall be recognized in the variable as <tab>s and
<newline>s, respectively.
.TP 7
\fBtoplines\fP=\fInumber\fP
.sp
Set the number of lines of the message to write with the \fBtop\fP
command. The default shall be 5.
.sp
.SS Commands in mailx
.LP
The following \fImailx\fP commands shall be provided. In the following
list, header refers to lines from the message header, as
shown in the OUTPUT FILES section. Header-line refers to lines within
the header that begin with one or more non-white-space
characters, immediately followed by a colon and white space and continuing
until the next line beginning with a non-white-space
character or an empty line. Header-field refers to the portion of
a header line prior to the first colon in that line.
.LP
For each of the commands listed below, the command can be entered
as the abbreviation (those characters in the Synopsis command
word preceding the \fB'['\fP ), the full command (all characters shown
for the command word, omitting the \fB'['\fP and
\fB']'\fP ), or any truncation of the full command down to the abbreviation.
For example, the \fBexit\fP command (shown as
\fBex[it]\fP in the Synopsis) can be entered as \fBex\fP, \fBexi\fP,
or \fBexit\fP.
.LP
The arguments to commands can be quoted, using the following methods:
.IP " *" 3
An argument can be enclosed between paired double-quotes ( \fB""\fP
) or single-quotes ( \fB''\fP ); any white space,
shell word expansion, or backslash characters within the quotes shall
be treated literally as part of the argument. A double-quote
shall be treated literally within single-quotes and \fIvice versa\fP.
These special properties of the quote marks shall occur only
when they are paired at the beginning and end of the argument.
.LP
.IP " *" 3
A backslash outside of the enclosing quotes shall be discarded and
the following character treated literally as part of the
argument.
.LP
.IP " *" 3
An unquoted backslash at the end of a command line shall be discarded
and the next line shall continue the command.
.LP
.LP
Filenames, where expected, shall be subjected to the following transformations,
in sequence:
.IP " *" 3
If the filename begins with an unquoted plus sign, and the \fBfolder\fP
variable is defined (see the \fBfolder\fP variable),
the plus sign shall be replaced by the value of the \fBfolder\fP variable
followed by a slash. If the \fBfolder\fP variable is
unset or is set to null, the filename shall be unchanged.
.LP
.IP " *" 3
Shell word expansions shall be applied to the filename (see \fIWord
Expansions\fP ). If
more than a single pathname results from this expansion and the command
is expecting one file, the effects are unspecified.
.LP
.SS Declare Aliases
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBa\fP\fB[\fP\fBlias\fP\fB] [\fP\fIalias\fP \fB[\fP\fIaddress\fP\fB...\fP\fB]]\fP\fBg\fP\fB[\fP\fBroup\fP\fB] [\fP\fIalias\fP \fB[\fP\fIaddress\fP\fB...\fP\fB]]\fP
.fi
.RE
.sp
.LP
Add the given addresses to the alias specified by \fIalias\fP. The
names shall be substituted when \fIalias\fP is used as a
recipient address specified by the user in an outgoing message (that
is, other recipients addressed indirectly through the
\fBreply\fP command shall not be substituted in this manner). Mail
address alias substitution shall apply only when the alias
string is used as a full address; for example, when \fBhlj\fP is an
alias, \fIhlj@posix.com\fP does not trigger the alias
substitution. If no arguments are given, write a listing of the current
aliases to standard output. If only an \fIalias\fP
argument is given, write a listing of the specified alias to standard
output. These listings need not reflect the same order of
addresses that were entered.
.SS Declare Alternatives
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBalt\fP\fB[\fP\fBernates\fP\fB]\fP \fIname\fP\fB...
\fP
.fi
.RE
.sp
.LP
(See also the \fBmetoo\fP command.) Declare a list of alternative
names for the user's login. When responding to a message,
these names shall be removed from the list of recipients for the response.
The comparison of names shall be in a case-insensitive
manner. With no arguments, \fBalternates\fP shall write the current
list of alternative names.
.SS Change Current Directory
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBcd\fP \fB[\fP\fIdirectory\fP\fB]\fP\fBch\fP\fB[\fP\fBdir\fP\fB] [\fP\fIdirectory\fP\fB]\fP
.fi
.RE
.sp
.LP
Change directory. If \fIdirectory\fP is not specified, the contents
of \fIHOME\fP shall be used.
.SS Copy Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBc\fP\fB[\fP\fBopy\fP\fB] [\fP\fIfile\fP\fB]\fP\fBc\fP\fB[\fP\fBopy\fP\fB] [\fP\fImsglist\fP\fB]\fP \fIfile\fP\fBC\fP\fB[\fP\fBopy\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Copy messages to the file named by the pathname \fIfile\fP without
marking the messages as saved. Otherwise, it shall be
equivalent to the \fBsave\fP command.
.LP
In the capitalized form, save the specified messages in a file whose
name is derived from the author of the message to be saved,
without marking the messages as saved. Otherwise, it shall be equivalent
to the \fBSave\fP command.
.SS Delete Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBd\fP\fB[\fP\fBelete\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Mark messages for deletion from the mailbox. The deletions shall not
occur until \fImailx\fP quits (see the \fBquit\fP
command) or changes mailboxes (see the \fBfolder\fP command). If \fBautoprint\fP
is set and there are messages remaining after
the \fBdelete\fP command, the current message shall be written as
described for the \fBprint\fP command (see the \fBprint\fP
command); otherwise, the \fImailx\fP prompt shall be written.
.SS Discard Header Fields
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBdi\fP\fB[\fP\fBscard\fP\fB] [\fP\fIheader-field\fP\fB...\fP\fB]\fP\fBig\fP\fB[\fP\fBnore\fP\fB] [\fP\fIheader-field\fP\fB...\fP\fB]\fP
.fi
.RE
.sp
.LP
Suppress the specified header fields when writing messages. Specified
\fIheader-fields\fP shall be added to the list of
suppressed header fields. Examples of header fields to ignore are
\fBstatus\fP and \fBcc\fP. The fields shall be included when
the message is saved. The \fBPrint\fP and \fBType\fP commands shall
override this command. The comparison of header fields shall
be in a case-insensitive manner. If no arguments are specified, write
a list of the currently suppressed header fields to standard
output; the listing need not reflect the same order of header fields
that were entered.
.LP
If both \fBretain\fP and \fBdiscard\fP commands are given, \fBdiscard\fP
commands shall be ignored.
.SS Delete Messages and Display
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBdp\fP \fB[\fP\fImsglist\fP\fB]\fP\fBdt\fP \fB[\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Delete the specified messages as described for the \fBdelete\fP command,
except that the \fBautoprint\fP variable shall have
no effect, and the current message shall be written only if it was
set to a message after the last message deleted by the command.
Otherwise, an informational message to the effect that there are no
further messages in the mailbox shall be written, followed by
the \fImailx\fP prompt.
.SS Echo a String
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBec\fP\fB[\fP\fBho\fP\fB]\fP \fIstring\fP \fB...
\fP
.fi
.RE
.sp
.LP
Echo the given strings, equivalent to the shell \fIecho\fP utility.
.SS Edit Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBe\fP\fB[\fP\fBdit\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Edit the given messages. The messages shall be placed in a temporary
file and the utility named by the \fIEDITOR\fP variable is
invoked to edit each file in sequence. The default \fIEDITOR\fP is
unspecified.
.LP
The \fBedit\fP command does not modify the contents of those messages
in the mailbox.
.SS Exit
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBex\fP\fB[\fP\fBit\fP\fB]\fP\fBx\fP\fB[\fP\fBit\fP\fB]\fP
.fi
.RE
.sp
.LP
Exit from \fImailx\fP without changing the mailbox. No messages shall
be saved in the \fBmbox\fP (see also \fBquit\fP).
.SS Change Folder
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBfi\fP\fB[\fP\fBle\fP\fB] [\fP\fIfile\fP\fB]\fP\fBfold\fP\fB[\fP\fBer\fP\fB] [\fP\fIfile\fP\fB]\fP
.fi
.RE
.sp
.LP
Quit (see the \fBquit\fP command) from the current file of messages
and read in the file named by the pathname \fIfile\fP. If
no argument is given, the name and status of the current mailbox shall
be written.
.LP
Several unquoted special characters shall be recognized when used
as \fIfile\fP names, with the following substitutions:
.TP 7
\fB%\fP
The system mailbox for the invoking user.
.TP 7
\fB%\fP\fIuser\fP
The system mailbox for \fIuser\fP.
.TP 7
\fB#\fP
The previous file.
.TP 7
\fB&\fP
The current \fBmbox\fP.
.TP 7
\fB+\fP\fIfile\fP
The named file in the \fBfolder\fP directory. (See the \fBfolder\fP
variable.)
.sp
.LP
The default file shall be the current mailbox.
.SS Display List of Folders
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBfolders\fP
.fi
.RE
.sp
.LP
Write the names of the files in the directory set by the \fBfolder\fP
variable. The command specified by the \fILISTER\fP
environment variable shall be used (see the ENVIRONMENT VARIABLES
section).
.SS Follow Up Specified Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBfo\fP\fB[\fP\fBllowup\fP\fB] [\fP\fImessage\fP\fB]\fP\fBF\fP\fB[\fP\fBollowup\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
In the lowercase form, respond to a message, recording the response
in a file whose name is derived from the author of the
message. See also the \fBsave\fP and \fBcopy\fP commands and \fBoutfolder\fP.
.LP
In the capitalized form, respond to the first message in the \fImsglist\fP,
sending the message to the author of each message
in the \fImsglist\fP. The subject line shall be taken from the first
message and the response shall be recorded in a file whose
name is derived from the author of the first message. See also the
\fBSave\fP and \fBCopy\fP commands and \fBoutfolder\fP.
.LP
Both forms shall override the \fBrecord\fP variable, if set.
.SS Display Header Summary for Specified Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBf\fP\fB[\fP\fBrom\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Write the header summary for the specified messages.
.SS Display Header Summary
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBh\fP\fB[\fP\fBeaders\fP\fB] [\fP\fImessage\fP\fB]\fP
.fi
.RE
.sp
.LP
Write the page of headers that includes the message specified. If
the \fImessage\fP argument is not specified, the current
message shall not change. However, if the \fImessage\fP argument is
specified, the current message shall become the message that
appears at the top of the page of headers that includes the message
specified. The \fBscreen\fP variable sets the number of
headers per page. See also the \fBz\fP command.
.SS Help
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBhel\fP\fB[\fP\fBp\fP\fB]\fP\fB?
\fP
.fi
.RE
.sp
.LP
Write a summary of commands.
.SS Hold Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBho\fP\fB[\fP\fBld\fP\fB] [\fP\fImsglist\fP\fB]\fP\fBpre\fP\fB[\fP\fBserve\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Mark the messages in \fImsglist\fP to be retained in the mailbox when
\fImailx\fP terminates. This shall override any commands
that might previously have marked the messages to be deleted. During
the current invocation of \fImailx\fP, only the
\fBdelete\fP, \fBdp\fP, or \fBdt\fP commands shall remove the \fIpreserve\fP
marking of a message.
.SS Execute Commands Conditionally
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBi\fP\fB[\fP\fBf\fP\fB]\fP \fBs|r
\fP\fImail-command\fP\fBs
el\fP\fB[\fP\fBse\fP\fB]
\fP\fImail-command\fP\fBs
en\fP\fB[\fP\fBdif\fP\fB]\fP
.fi
.RE
.sp
.LP
Execute commands conditionally, where \fBif\ s\fP executes the following
\fImail-command\fPs, up to an \fBelse\fP or
\fBendif\fP, if the program is in Send Mode, and \fBif\ r\fP shall
cause the \fImail-command\fPs to be executed only in
Receive Mode.
.SS List Available Commands
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBl\fP\fB[\fP\fBist\fP\fB]\fP
.fi
.RE
.sp
.LP
Write a list of all commands available. No explanation shall be given.
.SS Mail a Message
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBm\fP\fB[\fP\fBail\fP\fB]\fP \fIaddress\fP\fB...
\fP
.fi
.RE
.sp
.LP
Mail a message to the specified addresses or aliases.
.SS Direct Messages to mbox
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBmb\fP\fB[\fP\fBox\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Arrange for the given messages to end up in the \fBmbox\fP save file
when \fImailx\fP terminates normally. See \fIMBOX\fP. 
See also the \fBexit\fP and \fBquit\fP commands.
.SS Process Next Specified Message
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBn\fP\fB[\fP\fBext\fP\fB] [\fP\fImessage\fP\fB]\fP
.fi
.RE
.sp
.LP
If the current message has not been written (for example, by the \fBprint\fP
command) since \fImailx\fP started or since any
other message was the current message, behave as if the \fBprint\fP
command was entered. Otherwise, if there is an undeleted
message after the current message, make it the current message and
behave as if the \fBprint\fP command was entered. Otherwise, an
informational message to the effect that there are no further messages
in the mailbox shall be written, followed by the
\fImailx\fP prompt.
.SS Pipe Message
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBpi\fP\fB[\fP\fBpe\fP\fB] [[\fP\fImsglist\fP\fB]\fP \fIcommand\fP\fB]\fP\fB|\fP \fB[[\fP\fImsglist\fP\fB]\fP \fIcommand\fP\fB]\fP
.fi
.RE
.sp
.LP
Pipe the messages through the given \fIcommand\fP by invoking the
command interpreter specified by \fISHELL\fP with two
arguments: \fB-c\fP and \fIcommand\fP. (See also \fIsh\fP \fB-c\fP.)
The application shall
ensure that the command is given as a single argument. Quoting, described
previously, can be used to accomplish this. If no
arguments are given, the current message shall be piped through the
command specified by the value of the \fBcmd\fP variable. If
the \fBpage\fP variable is set, a <form-feed> shall be inserted after
each message.
.SS Display Message with Headers
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBP\fP\fB[\fP\fBrint\fP\fB] [\fP\fImsglist\fP\fB]\fP\fBT\fP\fB[\fP\fBype\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Write the specified messages, including all header lines, to standard
output. Override suppression of lines by the
\fBdiscard\fP, \fBignore\fP, and \fBretain\fP commands. If \fBcrt\fP
is set, the messages longer than the number of lines
specified by the \fBcrt\fP variable shall be paged through the command
specified by the \fIPAGER\fP environment variable.
.SS Display Message
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBp\fP\fB[\fP\fBrint\fP\fB] [\fP\fImsglist\fP\fB]\fP\fBt\fP\fB[\fP\fBype\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Write the specified messages to standard output. If \fBcrt\fP is set,
the messages longer than the number of lines specified by
the \fBcrt\fP variable shall be paged through the command specified
by the \fIPAGER\fP environment variable.
.SS Quit
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBq\fP\fB[\fP\fBuit\fP\fB]
\fP\fIend-of-file\fP
.fi
.RE
.sp
.LP
Terminate \fImailx\fP, storing messages that were read in \fBmbox\fP
(if the current mailbox is the system mailbox and unless
\fBhold\fP is set), deleting messages that have been explicitly saved
(unless \fBkeepsave\fP is set), discarding messages that
have been deleted, and saving all remaining messages in the mailbox.
.SS Reply to a Message List
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBR\fP\fB[\fP\fBeply\fP\fB] [\fP\fImsglist\fP\fB]\fP\fBR\fP\fB[\fP\fBespond\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Mail a reply message to the sender of each message in the \fImsglist\fP.
The subject line shall be formed by concatenating
\fBRe:\fP <space> (unless it already begins with that string) and
the subject from the first message. If \fBrecord\fP is
set to a filename, the response shall be saved at the end of that
file.
.LP
See also the \fBflipr\fP variable.
.SS Reply to a Message
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBr\fP\fB[\fP\fBeply\fP\fB] [\fP\fImessage\fP\fB]\fP\fBr\fP\fB[\fP\fBespond\fP\fB] [\fP\fImessage\fP\fB]\fP
.fi
.RE
.sp
.LP
Mail a reply message to all recipients included in the header of the
message. The subject line shall be formed by concatenating
\fBRe:\fP <space> (unless it already begins with that string) and
the subject from the message. If \fBrecord\fP is set to a
filename, the response shall be saved at the end of that file.
.LP
See also the \fBflipr\fP variable.
.SS Retain Header Fields
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBret\fP\fB[\fP\fBain\fP\fB] [\fP\fIheader-field\fP\fB...\fP\fB]\fP
.fi
.RE
.sp
.LP
Retain the specified header fields when writing messages. This command
shall override all \fBdiscard\fP and \fBignore\fP
commands. The comparison of header fields shall be in a case-insensitive
manner. If no arguments are specified, write a list of the
currently retained header fields to standard output; the listing need
not reflect the same order of header fields that were
entered.
.SS Save Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBs\fP\fB[\fP\fBave\fP\fB] [\fP\fIfile\fP\fB]\fP\fBs\fP\fB[\fP\fBave\fP\fB] [\fP\fImsglist\fP\fB]\fP \fIfile\fP\fBS\fP\fB[\fP\fBave\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Save the specified messages in the file named by the pathname \fIfile\fP,
or the \fBmbox\fP if the \fIfile\fP argument is
omitted. The file shall be created if it does not exist; otherwise,
the messages shall be appended to the file. The message shall
be put in the state \fIsaved\fP, and shall behave as specified in
the description of the \fIsaved\fP state when the current
mailbox is exited by the \fBquit\fP or \fBfile\fP command.
.LP
In the capitalized form, save the specified messages in a file whose
name is derived from the author of the first message. The
name of the file shall be taken to be the author's name with all network
addressing stripped off. See also the \fBCopy\fP,
\fBfollowup\fP, and \fBFollowup\fP commands and \fBoutfolder\fP variable.
.SS Set Variables
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBse\fP\fB[\fP\fBt\fP\fB] [\fP\fIname\fP\fB[\fP\fB=\fP\fB[\fP\fIstring\fP\fB]]\fP \fB...\fP\fB] [\fP\fIname\fP\fB=\fP\fInumber\fP \fB...\fP\fB] [\fP\fBno\fP\fIname\fP \fB...\fP\fB]\fP
.fi
.RE
.sp
.LP
Define one or more variables called \fIname\fP. The variable can be
given a null, string, or numeric value. Quoting and
backslash escapes can occur anywhere in \fIstring\fP, as described
previously, as if the \fIstring\fP portion of the argument
were the entire argument. The forms \fIname\fP and \fIname\fP= shall
be equivalent to \fIname\fP="" for variables that take
string values. The \fBset\fP command without arguments shall write
a list of all defined variables and their values. The \fBno\fP
\fIname\fP form shall be equivalent to \fBunset\fP \fIname\fP.
.SS Invoke a Shell
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBsh\fP\fB[\fP\fBell\fP\fB]\fP
.fi
.RE
.sp
.LP
Invoke an interactive command interpreter (see also \fISHELL ).\fP
.SS Display Message Size
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBsi\fP\fB[\fP\fBze\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Write the size in bytes of each of the specified messages.
.SS Read mailx Commands From a File
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBso\fP\fB[\fP\fBurce\fP\fB]\fP \fIfile\fP
.fi
.RE
.sp
.LP
Read and execute commands from the file named by the pathname \fIfile\fP
and return to command mode.
.SS Display Beginning of Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBto\fP\fB[\fP\fBp\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Write the top few lines of each of the specified messages. If the
\fBtoplines\fP variable is set, it is taken as the number of
lines to write. The default shall be 5.
.SS Touch Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBtou\fP\fB[\fP\fBch\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Touch the specified messages. If any message in \fImsglist\fP is not
specifically deleted nor saved in a file, it shall be
placed in the \fBmbox\fP upon normal termination. See \fBexit\fP and
\fBquit\fP.
.SS Delete Aliases
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBuna\fP\fB[\fP\fBlias\fP\fB] [\fP\fIalias\fP\fB]\fP\fB...
\fP
.fi
.RE
.sp
.LP
Delete the specified alias names. If a specified alias does not exist,
the results are unspecified.
.SS Undelete Messages
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBu\fP\fB[\fP\fBndelete\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Change the state of the specified messages from deleted to read. If
\fBautoprint\fP is set, the last message of those restored
shall be written. If \fImsglist\fP is not specified, the message shall
be selected as follows:
.IP " *" 3
If there are any deleted messages that follow the current message,
the first of these shall be chosen.
.LP
.IP " *" 3
Otherwise, the last deleted message that also precedes the current
message shall be chosen.
.LP
.SS Unset Variables
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBuns\fP\fB[\fP\fBet\fP\fB]\fP \fIname\fP\fB...
\fP
.fi
.RE
.sp
.LP
Cause the specified variables to be erased.
.SS Edit Message with Full-Screen Editor
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBv\fP\fB[\fP\fBisual\fP\fB] [\fP\fImsglist\fP\fB]\fP
.fi
.RE
.sp
.LP
Edit the given messages with a screen editor. Each message shall be
placed in a temporary file, and the utility named by the
\fIVISUAL\fP variable shall be invoked to edit each file in sequence.
The default editor shall be \fIvi\fP.
.LP
The \fBvisual\fP command does not modify the contents of those messages
in the mailbox.
.SS Write Messages to a File
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBw\fP\fB[\fP\fBrite\fP\fB] [\fP\fImsglist\fP\fB]\fP \fIfile\fP
.fi
.RE
.sp
.LP
Write the given messages to the file specified by the pathname \fIfile\fP,
minus the message header. Otherwise, it shall be
equivalent to the \fBsave\fP command.
.SS Scroll Header Display
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fBz\fP\fB[\fP\fB+|-\fP\fB]\fP
.fi
.RE
.sp
.LP
Scroll the header display forward (if \fB'+'\fP is specified or if
no option is specified) or backward (if \fB'-'\fP is
specified) one screenful. The number of headers written shall be set
by the \fBscreen\fP variable.
.SS Invoke Shell Command
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fB!\fP\fIcommand\fP
.fi
.RE
.sp
.LP
Invoke the command interpreter specified by \fISHELL\fP with two arguments:
\fB-c\fP and \fIcommand\fP. (See also \fIsh\fP \fB-c\fP.) If the \fBbang\fP
variable is set, each unescaped occurrence of \fB'!'\fP in
\fIcommand\fP shall be replaced with the command executed by the previous
\fB!\fP command or \fB~!\fP command escape.
.SS Null Command
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fB#\fP \fIcomment\fP
.fi
.RE
.sp
.LP
This null command (comment) shall be ignored by \fImailx\fP.
.SS Display Current Message Number
.TP 7
\fISynopsis\fP:
.sp
.RS
.nf

\fB=
\fP
.fi
.RE
.sp
.LP
Write the current message number.
.SS Command Escapes in mailx
.LP
The following commands can be entered only from input mode, by beginning
a line with the escape character (by default, tilde (
\fB'~'\fP )). See the \fBescape\fP variable description for changing
this special character. The format for the commands
shall be:
.sp
.RS
.nf

\fB<\fP\fIescape-character\fP\fB><\fP\fIcommand-char\fP\fB><\fP\fIseparator\fP\fB>\fP\fB[\fP\fB<\fP\fIarguments\fP\fB>\fP\fB]\fP
.fi
.RE
.LP
where the <\fIseparator\fP> can be zero or more <blank>s.
.LP
In the following descriptions, the application shall ensure that the
argument \fIcommand\fP (but not \fImailx-command)\fP is a
shell command string. Any string acceptable to the command interpreter
specified by the \fISHELL\fP variable when it is invoked as
\fISHELL\fP \fB-c\fP \fIcommand_string\fP shall be valid. The command
can be presented as multiple arguments (that is, quoting
is not required).
.LP
Command escapes that are listed with \fImsglist\fP or \fImailx-command\fP
arguments are invalid in Send Mode and produce
unspecified results.
.TP 7
\fB~!\ \fP \fIcommand\fP
Invoke the command interpreter specified by \fISHELL\fP with two arguments:
\fB-c\fP and \fIcommand\fP; and then return to
input mode. If the \fBbang\fP variable is set, each unescaped occurrence
of \fB'!'\fP in \fIcommand\fP shall be replaced with
the command executed by the previous \fB!\fP command or \fB~!\fP command
escape.
.TP 7
\fB~.\fP
Simulate end-of-file (terminate message input).
.TP 7
\fB~:\ \fP \fImailx-command\fP,\ \fB~_\ \fP \fImailx-command\fP
.sp
Perform the command-level request.
.TP 7
\fB~?\fP
Write a summary of command escapes.
.TP 7
\fB~A\fP
This shall be equivalent to \fB~i\ Sign\fP.
.TP 7
\fB~a\fP
This shall be equivalent to \fB~i\ sign\fP.
.TP 7
\fB~b\ \fP \fIname\fP...
Add the \fIname\fPs to the blind carbon copy ( \fBBcc\fP) list.
.TP 7
\fB~c\ \fP \fIname\fP...
Add the \fIname\fPs to the carbon copy ( \fBCc\fP) list.
.TP 7
\fB~d\fP
Read in the dead-letter file. See \fIDEAD\fP for a description of
this file.
.TP 7
\fB~e\fP
Invoke the editor, as specified by the \fIEDITOR\fP environment variable,
on the partial message.
.TP 7
\fB~f\ [\fP\fImsglist\fP\fB]\fP
Forward the specified messages. The specified messages shall be inserted
into the current message without alteration. This
command escape also shall insert message headers into the message
with field selection affected by the \fBdiscard\fP,
\fBignore\fP, and \fBretain\fP commands.
.TP 7
\fB~F\ [\fP\fImsglist\fP\fB]\fP
This shall be the equivalent of the \fB~f\fP command escape, except
that all headers shall be included in the message,
regardless of previous \fBdiscard\fP, \fBignore\fP, and \fBretain\fP
commands.
.TP 7
\fB~h\fP
If standard input is a terminal, prompt for a \fBSubject\fP line and
the \fBTo\fP, \fBCc\fP, and \fBBcc\fP lists. Other
implementation-defined headers may also be presented for editing.
If the field is written with an initial value, it can be edited
as if it had just been typed.
.TP 7
\fB~i\ \fP \fIstring\fP
Insert the value of the named variable, followed by a <newline>, into
the text of the message. If the string is unset or
null, the message shall not be changed.
.TP 7
\fB~m\ [\fP\fImsglist\fP\fB]\fP
Insert the specified messages into the message, prefixing non-empty
lines with the string in the \fBindentprefix\fP variable.
This command escape also shall insert message headers into the message,
with field selection affected by the \fBdiscard\fP,
\fBignore\fP, and \fBretain\fP commands.
.TP 7
\fB~M\ [\fP\fImsglist\fP\fB]\fP
This shall be the equivalent of the \fB~m\fP command escape, except
that all headers shall be included in the message,
regardless of previous \fBdiscard\fP, \fBignore\fP, and \fBretain\fP
commands.
.TP 7
\fB~p\fP
Write the message being entered. If the message is longer than \fBcrt\fP
lines (see Internal
Variables in mailx ), the output shall be paginated as described for
the \fIPAGER\fP variable.
.TP 7
\fB~q\fP
Quit (see the \fBquit\fP command) from input mode by simulating an
interrupt. If the body of the message is not empty, the
partial message shall be saved in the dead-letter file. See \fIDEAD\fP
for a description of this file.
.TP 7
\fB~r\ \fP \fIfile\fP,\ \fB~<\ \fP
\fIfile\fP,\ \fB~r\ !\fP\fIcommand\fP,\ \fB~<\ !\fP\fIcommand\fP
.sp
Read in the file specified by the pathname \fIfile\fP. If the argument
begins with an exclamation mark ( \fB'!'\fP ), the rest
of the string shall be taken as an arbitrary system command; the command
interpreter specified by \fISHELL\fP shall be invoked
with two arguments: \fB-c\fP and \fIcommand\fP. The standard output
of \fIcommand\fP shall be inserted into the message.
.TP 7
\fB~s\ \fP \fIstring\fP
Set the subject line to \fIstring\fP.
.TP 7
\fB~t\ \fP \fIname\fP...
Add the given \fIname\fPs to the \fBTo\fP list.
.TP 7
\fB~v\fP
Invoke the full-screen editor, as specified by the \fIVISUAL\fP environment
variable, on the partial message.
.TP 7
\fB~w\ \fP \fIfile\fP
Write the partial message, without the header, onto the file named
by the pathname \fIfile\fP. The file shall be created or
the message shall be appended to it if the file exists.
.TP 7
\fB~x\fP
Exit as with \fB~q\fP, except the message shall not be saved in the
dead-letter file.
.TP 7
\fB~|\ \fP \fIcommand\fP
Pipe the body of the message through the given \fIcommand\fP by invoking
the command interpreter specified by \fISHELL\fP
with two arguments: \fB-c\fP and \fIcommand\fP. If the \fIcommand\fP
returns a successful exit status, the standard output of
the command shall replace the message. Otherwise, the message shall
remain unchanged. If the \fIcommand\fP fails, an error message
giving the exit status shall be written.
.sp
.SH EXIT STATUS
.LP
When the \fB-e\fP option is specified, the following exit values are
returned:
.TP 7
\ 0
Mail was found.
.TP 7
>0
Mail was not found or an error occurred.
.sp
.LP
Otherwise, the following exit values are returned:
.TP 7
\ 0
Successful completion; note that this status implies that all messages
were \fIsent\fP, but it gives no assurances that any of
them were actually \fIdelivered\fP.
.TP 7
>0
An error occurred.
.sp
.SH CONSEQUENCES OF ERRORS
.LP
When in input mode (Receive Mode) or Send Mode:
.IP " *" 3
If an error is encountered processing a command escape (see Command
Escapes in mailx ), a
diagnostic message shall be written to standard error, and the message
being composed may be modified, but this condition shall not
prevent the message from being sent.
.LP
.IP " *" 3
Other errors shall prevent the sending of the message.
.LP
.LP
When in command mode:
.IP " *" 3
Default.
.LP
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
Delivery of messages to remote systems requires the existence of communication
paths to such systems. These need not exist.
.LP
Input lines are limited to {LINE_MAX} bytes, but mailers between systems
may impose more severe line-length restrictions. This
volume of IEEE\ Std\ 1003.1-2001 does not place any restrictions on
the length of messages handled by \fImailx\fP, and for
delivery of local messages the only limitations should be the normal
problems of available disk space for the target mail file.
When sending messages to external machines, applications are advised
to limit messages to less than 100000 bytes because some mail
gateways impose message-length restrictions.
.LP
The format of the system mailbox is intentionally unspecified. Not
all systems implement system mailboxes as flat files,
particularly with the advent of multimedia mail messages. Some system
mailboxes may be multiple files, others records in a
database. The internal format of the messages themselves is specified
with the historical format from Version\ 7, but only
after the messages have been saved in some file other than the system
mailbox. This was done so that many historical applications
expecting text-file mailboxes are not broken.
.LP
Some new formats for messages can be expected in the future, probably
including binary data, bit maps, and various multimedia
objects. As described here, \fImailx\fP is not prohibited from handling
such messages, but it must store them as text files in
secondary mailboxes (unless some extension, such as a variable or
command line option, is used to change the stored format). Its
method of doing so is implementation-defined and might include translating
the data into text file-compatible or readable form or
omitting certain portions of the message from the stored output.
.LP
The \fBdiscard\fP and \fBignore\fP commands are not inverses of the
\fBretain\fP command. The \fBretain\fP command discards
all header-fields except those explicitly retained. The \fBdiscard\fP
command keeps all header-fields except those explicitly
discarded. If headers exist on the retained header list, \fBdiscard\fP
and \fBignore\fP commands are ignored.
.SH EXAMPLES
.LP
None.
.SH RATIONALE
.LP
The standard developers felt strongly that a method for applications
to send messages to specific users was necessary. The
obvious example is a batch utility, running non-interactively, that
wishes to communicate errors or results to a user. However, the
actual format, delivery mechanism, and method of reading the message
are clearly beyond the scope of this volume of
IEEE\ Std\ 1003.1-2001.
.LP
The intent of this command is to provide a simple, portable interface
for sending messages non-interactively. It merely defines
a "front-end" to the historical mail system. It is suggested that
implementations explicitly denote the sender and recipient in
the body of the delivered message. Further specification of formats
for either the message envelope or the message itself were
deliberately not made, as the industry is in the midst of changing
from the current standards to a more internationalized standard
and it is probably incorrect, at this time, to require either one.
.LP
Implementations are encouraged to conform to the various delivery
mechanisms described in the CCITT X.400 standards or to the
equivalent Internet standards, described in Internet Request for Comment
(RFC) documents RFC\ 819, RFC\ 822, RFC\ 920,
RFC\ 921, and RFC\ 1123.
.LP
Many historical systems modified each body line that started with
\fBFrom\ \fP by prefixing the \fB'F'\fP with
\fB'>'\fP . It is unnecessary, but allowed, to do that when the string
does not follow a blank line because it cannot be
confused with the next header.
.LP
The \fBedit\fP and \fBvisual\fP commands merely edit the specified
messages in a temporary file. They do not modify the
contents of those messages in the mailbox; such a capability could
be added as an extension, such as by using different command
names.
.LP
The restriction on a subject line being {LINE_MAX}-10 bytes is based
on the historical format that consumes 10 bytes for
\fBSubject:\ \fP and the trailing <newline>. Many historical mailers
that a message may encounter on other systems are
not able to handle lines that long, however.
.LP
Like the utilities \fIlogger\fP and \fIlp\fP,
\fImailx\fP admittedly is difficult to test. This was not deemed sufficient
justification to exclude this utility from this volume
of IEEE\ Std\ 1003.1-2001. It is also arguable that it is, in fact,
testable, but that the tests themselves are not
portable.
.LP
When \fImailx\fP is being used by an application that wishes to receive
the results as if none of the User Portability
Utilities option features were supported, the \fIDEAD\fP environment
variable must be set to \fB/dev/null\fP. Otherwise, it may
be subject to the file creations described in \fImailx\fP ASYNCHRONOUS
EVENTS. Similarly, if the \fIMAILRC\fP environment
variable is not set to \fB/dev/null\fP, historical versions of \fImailx\fP
and \fIMail\fP read initialization commands from a
file before processing begins. Since the initialization that a user
specifies could alter the contents of messages an application
is trying to send, such applications must set \fIMAILRC\fP to \fB/dev/null\fP.
.LP
The description of \fILC_TIME\fP uses "may affect" because many historical
implementations do not or cannot manipulate the
date and time strings in the incoming mail headers. Some headers found
in incoming mail do not have enough information to determine
the timezone in which the mail originated, and, therefore, \fImailx\fP
cannot convert the date and time strings into the internal
form that then is parsed by routines like \fIstrftime\fP() that can
take \fILC_TIME\fP
settings into account. Changing all these times to a user-specified
format is allowed, but not required.
.LP
The paginator selected when \fIPAGER\fP is null or unset is partially
unspecified to allow the System V historical practice of
using \fIpg\fP as the default. Bypassing the pagination function,
such as by declaring that \fIcat\fP is the paginator, would not meet
with the intended meaning of this description. However, any
"portable user" would have to set \fIPAGER\fP explicitly to get his
or her preferred paginator on all systems. The paginator
choice was made partially unspecified, unlike the \fIVISUAL\fP editor
choice (mandated to be \fIvi\fP) because most historical pagers follow
a common theme of user input, whereas editors differ
dramatically.
.LP
Options to specify addresses as \fBcc\fP (carbon copy) or \fBbcc\fP
(blind carbon copy) were considered to be format details
and were omitted.
.LP
A zero exit status implies that all messages were \fIsent\fP, but
it gives no assurances that any of them were actually
\fIdelivered\fP. The reliability of the delivery mechanism is unspecified
and is an appropriate marketing distinction between
systems.
.LP
In order to conform to the Utility Syntax Guidelines, a solution was
required to the optional \fIfile\fP option-argument to
\fB-f\fP. By making \fIfile\fP an operand, the guidelines are satisfied
and users remain portable. However, it does force
implementations to support usage such as:
.sp
.RS
.nf

\fBmailx -fin mymail.box
\fP
.fi
.RE
.LP
The \fBno\fP \fIname\fP method of unsetting variables is not present
in all historical systems, but it is in System V and
provides a logical set of commands corresponding to the format of
the display of options from the \fImailx\fP \fIset\fP command without
arguments.
.LP
The \fBask\fP and \fBasksub\fP variables are the names selected by
BSD and System V, respectively, for the same feature. They
are synonyms in this volume of IEEE\ Std\ 1003.1-2001.
.LP
The \fImailx\fP \fIecho\fP command was not documented in the BSD version
and has been
omitted here because it is not obviously useful for interactive users.
.LP
The default prompt on the System V \fImailx\fP is a question mark,
on BSD \fIMail\fP an ampersand. Since this volume of
IEEE\ Std\ 1003.1-2001 chose the \fImailx\fP name, it kept the System
V default, assuming that BSD users would not have
difficulty with this minor incompatibility (that they can override).
.LP
The meanings of \fBr\fP and \fBR\fP are reversed between System V
\fImailx\fP and SunOS \fIMail\fP. Once again, since this
volume of IEEE\ Std\ 1003.1-2001 chose the \fImailx\fP name, it kept
the System V default, but allows the SunOS user to
achieve the desired results using \fBflipr\fP, an internal variable
in System V \fImailx\fP, although it has not been documented
in the SVID.
.LP
The \fBindentprefix\fP variable, the \fBretain\fP and \fBunalias\fP
commands, and the \fB~F\fP and \fB~M\fP
command escapes were adopted from 4.3 BSD \fIMail\fP.
.LP
The \fBversion\fP command was not included because no sufficiently
general specification of the version information could be
devised that would still be useful to a portable user. This command
name should be used by suppliers who wish to provide version
information about the \fImailx\fP command.
.LP
The "implementation-specific (unspecified) system start-up file" historically
has been named \fB/etc/mailx.rc\fP, but this
specific name and location are not required.
.LP
The intent of the wording for the \fBnext\fP command is that if any
command has already displayed the current message it should
display a following message, but, otherwise, it should display the
current message. Consider the command sequence:
.sp
.RS
.nf

\fBnext 3
delete 3
next
\fP
.fi
.RE
.LP
where the \fBautoprint\fP option was not set. The normative text specifies
that the second \fBnext\fP command should display a
message following the third message, because even though the current
message has not been displayed since it was set by the
\fBdelete\fP command, it has been displayed since the current message
was anything other than message number 3. This does not
always match historical practice in some implementations, where the
command file address followed by \fBnext\fP (or the default
command) would skip the message for which the user had searched.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIShell Command Language\fP, \fIed\fP, \fIls\fP, \fImore\fP,
\fIvi\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .