programs.texi
256 KB
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
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
@c This is part of the GNU Mailutils manual.
@c Copyright (C) 1999-2012, 2014-2015 Free Software Foundation, Inc.
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************
GNU Mailutils provides a broad set of utilities for handling
electronic mail. These utilities address the needs of both system
administrators and users.
All utilities are built around a single core subsystem and share many
common aspects. All of them are able to work with almost any existing
mailbox formats. They use a common configuration file syntax, and
their configuration files are located in a single subdirectory.
In this chapter we will discuss each utility, and give some advices on
how to use them in various real life situations.
First of all we will describe command line and configuration file
syntax.
@menu
* command line:: Command Line Syntax.
* configuration:: Common Configuration File.
* debugging::
* frm and from:: List Headers from a Mailbox.
* mail:: Send and Receive Mail.
* messages:: Count the Number of Messages in a Mailbox.
* movemail:: Moves Mail from the User Maildrop to the Local File.
* readmsg:: Extract Messages from a Folder.
* sieve:: Mail Filtering Utility.
* guimb:: Mailbox Scanning and Processing Language.
* maidag:: General-purpose Mail Delivery Agent.
* mimeview:: Universal File Viewer.
* pop3d:: POP3 Daemon.
* imap4d:: IMAP4 Daemon.
* comsatd:: Comsat Daemon.
* mh:: The MH Message Handling System.
* mailutils:: The Mailutils Multi-Purpose Tool.
@end menu
@node command line
@section Command Line
@menu
* Option Basics:: Basic Notions About Command Line Options.
* Common Options:: Options That are Common for All Utilities.
@end menu
@node Option Basics
@subsection Basic Notions About Command Line Options
Many command line options have two forms, called short and long
forms. Both forms are absolutely identical in function; they are
interchangeable.
The @dfn{short} form is a traditional form for UNIX utilities.
In this form, the option consists of a single dash, followed by a
single letter, e.g. @option{-c}.
Short options which require arguments take their arguments
immediately following the option letter, optionally separated by white
space. For example, you might write @option{-f name}, or @option{-fname}.
Here, @option{-f} is the option, and @option{name} is its argument.
Short options which allow optional arguments take their arguments
immediately following the option letter, @emph{without any intervening
white space characters}. This is important, so that the command line
parser might discern that the text following option is its argument,
not the next command line parameter. For example, if option @option{-d}
took an optional argument, then @option{-dname} would mean the option
with its argument (@option{name} in this case), and @option{-d name} would
mean the @option{-d} option without any argument, followed by command
line argument @option{name}.
Short options' letters may be clumped together, but you are not
required to do this. When short options are clumped as a set, use one
(single) dash for them all, e.g. @option{-cvl} is equivalent to @option{-c
-v -l}. However, only options that do not take arguments may be
clustered this way. If an option takes an argument, it can only be
the last option in such a cluster, otherwise it would be impossible to
specify the argument for it. Anyway, it is much more readable to
specify such options separated.
The @dfn{long} option names are probably easier to memorize than
their short counterparts. They consist of two dashes, followed by a
multi-letter option name, which is usually selected to be a mnemonics
for the operation it requests. For example, @option{--verbose} is a
long option that increases the verbosity of a utility. In addition,
long option names can abbreviated, provided that such an abbreviation
is unique among the options understood by a given utility. For
example, if a utility takes options @option{--foreground} and
@option{--forward}, then the shortest possible abbreviations for these
options are @option{--fore} and @option{--forw}, correspondingly. If
you try to use @option{--for}, the utility will abort and inform you
that the abbreviation you use is ambiguous, so it is not clear which
of the options you intended to use.
Long options which require arguments take those arguments following
the option name. There are two ways of specifying a mandatory
argument. It can be separated from the option name either by an equal
sign, or by any amount of white space characters. For example, if the
@option{--file} option requires an argument, and you wish to supply
@file{name} as its argument, then you can do so using any of the
following notations: @option{--file=name} or @option{--file name}.
In contrast, optional arguments must always be introduced using an
equal sign.
@node Common Options
@subsection Options That are Common for All Utilities.
All GNU Mailutils programs understand a common subset of options.
@table @option
@xopindex{help, described}
@item --help
@itemx -?
Display a short summary of the command line options understood by
this utilities, along with a terse description of each.
The output of this option consists of three major parts. First, a
usage synopsis is displayed. For example:
@example
@group
Usage: sieve [OPTION...] SCRIPT
GNU sieve -- a mail filtering tool
@end group
@end example
The first line tells that the @command{sieve} utility takes any
number of options (brackets indicate optional part) and a single
mandatory argument (@samp{SCRIPT}). The second lines summarizes the
purpose of the utility.
Following this header is an option summary. It consists of two
columns:
@verbatim
-c, --compile-only Compile script and exit
-d, --debug[=FLAGS] Debug flags
-e, --email=ADDRESS Override user email address
@end verbatim
The leftmost column contains a comma-separated list of option
names. Short options are listed first. The options are ordered
alphabetically. Arguments, if any, are specified after the last
option name in the list, so that, e.g. the option @samp{-e} in the
example above requires an argument: @samp{-e ADDRESS}. Optional
arguments are enclosed in square brackets, as in @option{--debug}
option in the example above.
The rightmost column contains a short description of the option
purpose.
The last part of @option{--help} output contains some additional
notices and lists the email address for reporting bugs.
@xopindex{usage, described}
@item --usage
Display a short summary of options. In the contrast to the
@option{--help} option, only option names and arguments
are printed, without any textual description. For example:
@example
@group
Usage: sieve [-cv?V] [--compile-only] [--debug[=FLAGS]]
[--email=ADDRESS] SCRIPT
@end group
@end example
@end table
The exact formatting of the output produced by these two options is
configurable. @xref{Usage Vars}, for a detailed descriptions of it.
@table @option
@xopindex{version, described}
@item --version
@itemx -V
Print program version and exit.
@xopindex{show-config-options, described}
@item --show-config-options
Show configuration options used when compiling the package. You can
use this option to verify if support for a particular mailbox format
or other functionality is compiled in the binary. The output of this
option is intended to be both machine-readable and understandable by
humans.
@end table
The following command line options affect parsing of configuration
files. Here we provide a short summary, the next section will
describe them in detail.
@table @option
@xopindex{config-file, introduced}
@item --config-file=@var{file}
Load this configuration file, instead of the default.
@xopindex{config-help, introduced}
@item --config-help
Show configuration file summary.
@xopindex{config-lint, introduced}
@item --config-lint
Check configuration file syntax and exit
@xopindex{config-verbose, introduced}
@item --config-verbose
Verbosely log parsing of the configuration files.
@xopindex{no-site-config, introduced}
@item --no-site-config
Do not load site-wide configuration file.
@xopindex{no-user-config, introduced}
@item --no-user-config
Do not load user configuration file.
@xopindex{set, introduced}
@item --set=@var{path}=@var{value}
Set configuration variable.
@end table
@node configuration
@section Mailutils Configuration File
@cindex Mailutils configuration file
@cindex mailutils.rc
Configuration files are the principal means of configuring any GNU
Mailutils component. When started, each utility tries to load its
configuration from the following locations, in that order:
@enumerate 1
@item Main site-wide configuration file.
It is named @file{@var{sysconfdir}/mailutils.rc}, where @var{sysconfdir} stands
for the system configuration directory set when compiling the package.
You can obtain the value of @var{sysconfdir} by running
@example
$ mailutils info sysconfdir
@end example
@noindent
or
@example
$ @var{prog} --show-config-options | grep SYSCONFDIR
@end example
@noindent
where @var{prog} stands for any GNU Mailutils utility.
@xopindex{no-site-config, described}
The site-wide configuration file is not read if the @option{--no-site-config}
command line option was given.
@item Per-user configuration file.
A per user configuration file is located in the user home directory
and is named @samp{.@var{prog}}, where @var{prog} is the name of the
utility. For example, the per-user configuration file for
@command{sieve} utility is named @file{.sieve}.
@xopindex{no-user-config, described}
This configuration file is not read if the @option{--no-user-config}
command line option was given.
@xopindex{config-file, described}
@item Additional configuration file, if specified using the
@option{--config-file} command line option.
@end enumerate
The order in which configuration files are loaded defines the
precedence of their settings. Thus, settings from additional
configuration file override those set in per-user configuration file.
The latter, in their turn, take precedence over the settings from the
site-wide configuration file.
@xopindex{config-verbose, described}
Neither site-wide nor user configuration files are required to
exist. If any or both of them are absent, GNU Mailutils does not
complain, and the utility falls back to its default settings. To make
configuration processing more verbose, use the
@option{--config-verbose} command line option. Here is an example of
what you might get using this option:
@example
imap4d: Info: parsing file `/etc/mailutils.rc'
imap4d: Info: finished parsing file `/etc/mailutils.rc'
@end example
Specifying this option more than once adds more verbosity to this
output. If this option is given two times, GNU Mailutils will print
any configuration file statement it parsed, along with the exact
location where it occurred (the exact meaning of each statement will
be described later in this chapter):
@example
imap4d: Info: parsing file `/etc/mailutils.rc'
@hashchar{} 1 "/etc/mailutils.rc"
mailbox @{
@hashchar{} 2 "/etc/mailutils.rc"
mailbox-pattern maildir:/var/spool/mail;type=index;param=2;user=$@{user@};
@hashchar{} 3 "/etc/mailutils.rc"
mailbox-type maildir;
@};
@hashchar{} 6 "/etc/mailutils.rc"
include /etc/mailutils.d;
imap4d: Info: parsing file `/etc/mailutils.d/imap4d'
...
@end example
@xopindex{config-lint, described}
To test configuration file without actually starting the utility,
use the @option{--config-lint} command line option. With this option,
any Mailutils utility exits after finishing parsing of the
configuration files. Any errors occurred during parsing are displayed
on the standard error output. This option can be combined with
@option{--config-verbose} to obtain more detailed output.
@xopindex{config-help, described}
The @option{--config-help} command line option produces on the
standard output the summary of all configuration statements understood
by the utility, with detailed comments and in the form suitable for
configuration file. For example, the simplest way to write a
configuration file for, say, @command{imap4d} is to run
@example
$ imap4d --config-help > imap4d.rc
@end example
@noindent
and to edit the @file{imap4d.rc} file with your editor of choice.
@xopindex{set, described}
It is also possible to set or override arbitrary configuration
variables in the command line. It can be done via the @option{--set}
option. Its argument is a @dfn{pathname} of the variable to be set,
followed by an equals sign and value. For example, to define the
variable @samp{syslog} in section @samp{logging} to @samp{no}, do the
following:
@example
$ imap4d --set .logging.syslog=no
@end example
Configuration pathnames are discussed in detail in @ref{Paths}.
@menu
* conf-syntax:: Configuration File Syntax
* Variables:: Variable Expansion
* Include:: Include Statement
* Logging Statement::
* Debug Statement::
* Mailbox Statement::
* Locking Statement::
* Mailer Statement::
* ACL Statement::
* Tcp-wrappers Statement::
* Server Settings::
* Auth Statement::
* PAM Statement::
* Virtdomain Statement::
* Radius Statement::
* SQL Statement::
* LDAP Statement::
* TLS Statement::
* GSASL Statement::
@end menu
@node conf-syntax
@subsection Configuration File Syntax
The configuration file consists of statements and comments.
There are three classes of lexical tokens: keywords, values, and
separators. Blanks, tabs, newlines and comments, collectively called
@dfn{white space} are ignored except as they serve to separate
tokens. Some white space is required to separate otherwise adjacent
keywords and values.
@menu
* Comments::
* Statements::
* Paths::
@end menu
@node Comments
@subsubsection Comments
@cindex Comments in a configuration file
@cindex single-line comments
@dfn{Comments} may appear anywhere where white space may appear in the
configuration file. There are two kinds of comments:
single-line and multi-line comments. @dfn{Single-line} comments start
with @samp{#} or @samp{//} and continue to the end of the line:
@example
# This is a comment
// This too is a comment
@end example
@cindex multi-line comments
@dfn{Multi-line} or @dfn{C-style} comments start with the two
characters @samp{/*} (slash, star) and continue until the first
occurrence of @samp{*/} (star, slash).
Multi-line comments cannot be nested. However, single-line comments
may well appear within multi-line ones.
@node Statements
@subsubsection Statements
@cindex statements, configuration file
@cindex configuration file statements
@cindex statement, simple
@cindex simple statements
A @dfn{simple statement} consists of a keyword and value
separated by any amount of whitespace. Simple statement is terminated
with a semicolon (@samp{;}).
The following is a simple statement:
@example
standalone yes;
pidfile /var/run/pop3d.pid;
@end example
A @dfn{keyword} begins with a letter and may contain letters,
decimal digits, underscores (@samp{_}) and dashes (@samp{-}).
Examples of keywords are: @samp{expression}, @samp{output-file}.
A @dfn{value} can be one of the following:
@table @asis
@item number
A number is a sequence of decimal digits.
@anchor{boolean value}
@item boolean
@cindex boolean value
A boolean value is one of the following: @samp{yes}, @samp{true},
@samp{t} or @samp{1}, meaning @dfn{true}, and @samp{no},
@samp{false}, @samp{nil}, @samp{0} meaning @dfn{false}.
@item unquoted string
@cindex string, unquoted
An unquoted string may contain letters, digits, and any of the
following characters: @samp{_}, @samp{-}, @samp{.}, @samp{/},
@samp{@@}, @samp{*}, @samp{:}.
@item quoted string
@cindex quoted string
@cindex string, quoted
@cindex escape sequence
A quoted string is any sequence of characters enclosed in
double-quotes (@samp{"}). A backslash appearing within a quoted
string introduces an @dfn{escape sequence}, which is replaced
with a single character according to the following rules:
@float Table, backslash-interpretation
@caption{Backslash escapes}
@multitable @columnfractions 0.30 .5
@item Sequence @tab Replaced with
@item \a @tab Audible bell character (@acronym{ASCII} 7)
@item \b @tab Backspace character (@acronym{ASCII} 8)
@item \f @tab Form-feed character (@acronym{ASCII} 12)
@item \n @tab Newline character (@acronym{ASCII} 10)
@item \r @tab Carriage return character (@acronym{ASCII} 13)
@item \t @tab Horizontal tabulation character (@acronym{ASCII} 9)
@item \v @tab Vertical tabulation character (@acronym{ASCII} 11)
@item \\ @tab A single backslash (@samp{\})
@item \" @tab A double-quote.
@end multitable
@end float
In addition, the sequence @samp{\@var{newline}} is removed from
the string. This allows to split long strings over several
physical lines, e.g.:
@example
@group
"a long string may be\
split over several lines"
@end group
@end example
If the character following a backslash is not one of those specified
above, the backslash is ignored and a warning is issued.
Two or more adjacent quoted strings are concatenated, which gives
another way to split long strings over several lines to improve
readability. The following fragment produces the same result as the
example above:
@example
@group
"a long string may be"
" split over several lines"
@end group
@end example
@anchor{here-document}
@item Here-document
@cindex here-document
A @dfn{here-document} is a special construct that allows to introduce
strings of text containing embedded newlines.
The @code{<<@var{word}} construct instructs the parser to read all
the following lines up to the line containing only @var{word}, with
possible trailing blanks. Any lines thus read are concatenated
together into a single string. For example:
@example
@group
<<EOT
A multiline
string
EOT
@end group
@end example
The body of a here-document is interpreted the same way as a
double-quoted string, unless @var{word} is preceded by a backslash
(e.g. @samp{<<\EOT}) or enclosed in double-quotes, in which case
the text is read as is, without interpretation of escape sequences.
If @var{word} is prefixed with @code{-} (a dash), then all leading
tab characters are stripped from input lines and the line containing
@var{word}. Furthermore, if @code{-} is followed by a single space,
all leading whitespace is stripped from them. This allows to indent
here-documents in a natural fashion. For example:
@example
@group
<<- TEXT
The leading whitespace will be
ignored when reading these lines.
TEXT
@end group
@end example
It is important that the terminating delimiter be the only token on
its line. The only exception to this rule is allowed if a
here-document appears as the last element of a statement. In this
case a semicolon can be placed on the same line with its terminating
delimiter, as in:
@example
help-text <<-EOT
A sample help text.
EOT;
@end example
@anchor{list values}
@item list
@cindex list
A @dfn{list} is a comma-separated list of values. Lists are
enclosed in parentheses. The following example shows a statement
whose value is a list of strings:
@example
alias (test,null);
@end example
In any case where a list is appropriate, a single value is allowed
without being a member of a list: it is equivalent to a list with a
single member. This means that, e.g.
@example
alias test;
@end example
@noindent
is equivalent to
@example
alias (test);
@end example
@end table
@cindex statement, block
@cindex block statement
A @dfn{block statement} introduces a logical group of
statements. It consists of a keyword, followed by an optional value,
and a sequence of statements enclosed in curly braces, as shown in
the example below:
@example
@group
server srv1 @{
host 10.0.0.1;
community "foo";
@}
@end group
@end example
The closing curly brace may be followed by a semicolon, although
this is not required.
@node Paths
@subsubsection Statement Path
@command{Mailutils} configuration files have a distinct hierarchical
structure. Each statement in such files can therefore be identified
by its name and the names of block statements containing it. Such
names form this statement @dfn{pathname}, similar to that used,
e.g. by UNIX file system.
For example, consider the following file:
@example
foo @{
bar @{
baz 45; # @r{A.}
@}
baz 98; # @r{B.}
@}
@end example
The full pathname of the statement marked with @samp{A} can be written
as:
@example
.foo.bar.baz
@end example
Similarly, the statement marked with @samp{B} has the following
pathname:
@example
.foo.baz
@end example
The default path component separator is dot. A pathname beginning with
a component separator is called @dfn{absolute pathname}. Absolute
pathnames uniquely identify corresponding statements. If the leading
dot is omitted, the resulting pathname is called
@dfn{relative}. Relative pathnames identify statements in relation to
the current point of reference in the configuration file.
Any other punctuation character can be used as a component separator,
provided that it appears at the beginning of the pathname. In other
words, only absolute pathnames allow for a change in component separators.
A block statement that has a tag is referred to by its name, followed
by an equals sign, followed by the tag value. For example, the
statement @samp{A} in the file below:
@example
program x @{
bar @{
baz 45; # @r{A.}
@}
@}
@end example
is identified by the following pathname:
@example
.program=x.bar.baz
@end example
The tag can optionally be enclosed in a pair of double quotes. Such a
quoting becomes mandatory for tags that contain white space or path
component separator, e.g.:
@example
.program="a.out".bar.baz
@end example
@node Variables
@subsection Configuration Variables
@cindex variable expansion
@cindex macro variable
Certain configuration statements allow for the use of variable
references in their values. A variable reference has the form
@samp{$@var{variable}} or @samp{$@{@var{variable}@}}, where
@var{variable} is the variable name. It is expanded to the actual
value of @var{variable} when Mailutils consults the configuration
statement in question.
The two forms are entirely equivalent. The form with curly braces is
normally used if the variable name is immediately followed by an
alphanumeric symbol, which will otherwise be considered part of it.
This form also allows for specifying the action to take if the
variable is undefined or expands to an empty value.
During variable expansion, the forms below cause Mailutils to test
for a variable that is unset or null. Omitting the colon results
in a test only for a variable that is unset.
@table @asis
@item $@{@var{variable}:-@var{word}@}
@dfn{Use Default Values}. If @var{variable} is unset or null, the expansion
of @var{word} is substituted. Otherwise, the value of @var{variable} is
substituted.
@item $@{@var{variable}:=@var{word}@}
@dfn{Assign Default Values}. If @var{variable} is unset or null, the
expansion of @var{word} is assigned to variable. The value of
@var{variable} is then substituted.
@item $@{@var{variable}:?@var{word}@}
@dfn{Display Error if Null or Unset}. If @var{variable} is null or unset,
the expansion of @var{word} (or a message to that effect if @var{word} is
not present) is output to the current logging channel. Otherwise, the
value of @var{variable} is substituted.
@item $@{@var{variable}:+@var{word}@}
@dfn{Use Alternate Value}. If @var{variable} is null or unset, nothing is
substituted, otherwise the expansion of @var{word} is substituted.
@end table
The subsections below define variable names that are valid for use in
each configuration statement.
@node Include
@subsection Include Statement
@cindex include statement, configuration file
@kwindex include
The @dfn{include statement} is a special statement that causes
inclusion of a named file. It has the following syntax:
@example
include @var{file};
@end example
If @var{file} names a regular file, the contents of this file is
included in this point. Otherwise, if @var{file} names a directory,
Mailutils searches in that directory for a file whose name coincides
with the name of utility being executed, and includes this file, if it
exists.
It is a common approach to end the site-wide configuration file with
an include statement, e.g.:
@example
include /etc/mailutils.d;
@end example
This allows each particular utility to have its own configuration
file. Thus. @command{imap4d} will read
@file{/etc/mailutils.d/imap4d}, etc.
@node Logging Statement
@subsection Logging Statement
@kwindex logging
@subheading Syntax
@example
logging @{
# @r{Send diagnostics to syslog.}
syslog @var{boolean};
# @r{Print message severity levels.}
print-severity @var{boolean};
# @r{Output only messages with a severity equal to or}
# @r{greater than this one.}
severity @var{string};
# @r{Set syslog facility.}
facility @var{name};
# Log session ID
session-id @var{boolean};
# @r{Tag syslog messages with this string.}
tag @var{text};
@}
@end example
@subheading Description
The @code{logging} block statement configures where the diagnostic
output goes and how verbose it is.
@deffn {Configuration} syslog bool
If @samp{syslog} is set to @samp{yes}, the diagnostics will go to
syslog. Otherwise, it goes to the standard error.
@end deffn
The default syslog facility is determined at compile time, it can be inspected
using the following command (@pxref{mailutils info}):
@example
$ mailutils info log_facility
@end example
@anchor{syslog facility}
@deffn {Configuration} facility name
Use syslog facility @var{name}. Valid argument values are: @samp{user},
@samp{daemon}, @samp{auth}, @samp{authpriv}, @samp{mail}, @samp{cron},
@samp{local0} through @samp{local7} (all names case-insensitive), or
a facility number.
@end deffn
@deffn {Configuration} tag text
Tag syslog messages with @var{text}. By default, program name is used
as syslog tag.
@end deffn
@deffn {Configuration} print-severity bool
Print Mailutils severity name before each message.
@end deffn
@deffn {Configuration} severity name
Output only messages with a severity equal to or greater than this
one. Valid arguments are: @samp{debug}, @samp{info}, @samp{notice},
@samp{warning}, @samp{error}, @samp{crit}, @samp{alert}, @samp{emerg},
@end deffn
@deffn {Configuration} session-id bool
Print session ID with each diagnostic message. This is useful for
programs that handle multiple user sessions simultaneously, such as
@command{pop3d} and @command{imap4d}.
@end deffn
@node Debug Statement
@subsection Debug Statement
@kwindex debug
@subheading Syntax
@example
debug @{
# @r{Set Mailutils debugging level.}
level @var{spec};
# @r{Prefix debug messages with Mailutils source locations.}
line-info @var{bool};
@}
@end example
@subheading Description
@kwindex level
The @samp{debug} statement controls the amount of additional debugging
information output by Mailutils programs. The @samp{level} statement
enables additional debugging information. Its argument (@var{spec})
is a Mailutils debugging specification as described in
@ref{debugging}.
@kwindex line-info
The @samp{line-info} statement, when set to @samp{true} causes
debugging messages to be prefixed with locations in Mailutils source
files where they appear. Normally, only Mailutils developers need
this option.
@node Mailbox Statement
@subsection Mailbox Statement
@kwindex mailbox
@subheading Syntax
@example
mailbox @{
# @r{Use specified @var{url} as a mailspool.}
mail-spool @var{url};
# @r{Create mailbox @var{url} using @var{pattern}.}
mailbox-pattern @var{pattern};
# @r{Default mailbox type.}
mailbox-type @var{type};
# @r{Default user mail folder.}
folder @var{dir};
@}
@end example
@subheading Description
The @code{mailbox} statement configures the location, name and type of
user mailboxes.
The mailbox location can be specified using @code{mail-spool} or
@code{mail-pattern} statements.
@deffn {Configuration} mail-spool @var{path}
The @code{mail-spool} statement specifies directory that holds user
mailboxes. Once this statement is given, the @command{libmailutils}
library will assume that the mailbox of user @var{login} is kept in
file @file{@var{path}/@var{login}}.
Historically, @var{path} can contain mailbox type prefix, e.g.:
@samp{maildir:///var/spool/mail}, but such usage is discouraged in
favor of @code{mailbox-pattern} statement.
@end deffn
@deffn {Configuration} mailbox-pattern @var{url}
The @code{mailbox-pattern} statement is a preferred way of configuring
mailbox locations. It supersedes @code{mail-spool} statement.
The @var{url} is valid mailbox URL (@pxref{Mailbox}), which
may contain references to the @samp{user} variable
(@pxref{Variables}). This variable will be expanded to the actual
user name.
@anchor{local URL parameters}
Optional URL parameters can be used to configure indexed directory
structure.
@cindex directory indexing
An @dfn{indexed directory structure} is a special way of storing
mailboxes, which allows for faster access in case of very large
number of users.
By default, all user mailboxes are stored in a single directory and
are named after user login names. To find the mailbox for a given
user, the system scans the directory for the corresponding
file. This usually implies linear search, so the time needed to
locate a mailbox is directly proportional to the ordinal number of
the mailbox in the directory.
GNU Mailutils supports three types of indexed directories:
@samp{direct}, @samp{reverse}, and @samp{hashed}.
@cindex direct indexing
@cindex indexing, direct
In direct indexed directory structure, @var{path} contains 26 subdirectories
named with lower-case letters of Latin alphabet. The location of the
user mailbox is determined using the following algorithm:
@enumerate 1
@item Take the first letter of the user name.
@item Map it to a lower-case letter using @dfn{index mapping}
table. The result gives sub-directory name.
@item Descend into this directory.
@end enumerate
For example, using this algorithm, the mailbox of the user
@samp{smith} is stored in file @file{@var{path}/s/smith}.
If each of single-letter subdirectories contains the
indexed directory structure, we have second level of indexing. In
this case the file name of @samp{smith}'s mailbox is
@file{@var{path}/s/m/smith}.
@cindex reverse indexing
@cindex indexing, reverse
The @dfn{reverse} indexed structure uses the same principles, but the
indexing letters are taken from the @emph{end} of the user name,
instead of from the beginning. For example, in the 2nd level reverse
indexed structure, the @samp{smith}'s mailbox is located in
@file{@var{path}/h/t/smith}.
@cindex hashed indexing
@cindex indexing, hashed
Finally, the @dfn{hashed} structure consists of 256 subdirectories
under @var{path}, named by 2-letter hex codes from @samp{00} to
@samp{FF}. Mailboxes are stored in these subdirectories. The name
of the subdirectory is computed by hashing first @var{level} letters
of the user name. The hashing algorithm is:
@enumerate 1
@item Take next letter from the user name
@item Add its ASCII value to the hash sum.
@item Continue (1-2) until @var{level} letters are processed, or all
letters from the file name are used, whichever occurs first.
@item Convert the computed sum modulo 256 to a hex code.
@end enumerate
Indexed directory structures are configured using the following
arguments:
@table @asis
@kwindex type
@item type=@var{value}
Specifies type of indexing. Valid values are @samp{index}, for direct
indexed structure, @samp{rev-index} for reverse indexing, and
@samp{hash} for hashed structure.
@kwindex param
@item param=@var{number}
Specifies indexing level.
@kwindex user
@item user=@var{string}
Specifies indexing key. The only meaningful value, as of Mailutils
version @value{VERSION} is @samp{user=$@{user@}}.
@end table
Let's assume the traditional mail layout, in which incoming
mails are stored in a UNIX mailbox named after the recipient user name
and located in @file{/var/mail} directory.
The @code{mailbox-pattern} for this case is:
@example
mailbox-pattern "/var/mail/$@{user@}";
@end example
It is entirely equivalent to specifying @samp{mail-spool "/var/mail"}.
Now, if the layout is the same, but mailboxes are kept in
@samp{maildir} format, then the corresponding statement is:
@example
mailbox-pattern "maildir:///var/mail/$@{user@}";
@end example
Finally, if the mailboxes are stored in a directly-indexed directory with
two levels of indexing, the URL is:
@example
mailbox-pattern "maildir:///var/mail;type=index;param=2;user=$@{user@}";
@end example
@end deffn
If neither @code{mailbox-pattern} nor @code{mail-spool} are given, the
mailbox names are determined using the following algorithm:
@enumerate 1
@item If environment variable @env{FOLDER} its value is used.
@item Otherwise, if environment variable @env{MAIL} is set, its value
is used.
@item If neither of these is set, the mailbox name is constructed by
concatenating the built-in mail spool directory name, a directory
separator, and the user name.
The built-in mail spool directory name is determined at compile
time, using @samp{_PATH_MAILDIR} define from the include file
@file{paths.h}. If this value is not defined, @file{/var/mail} or
@file{/usr/spool/mail} is used.
@end enumerate
@deffn {Configuration} mailbox-type @var{type}
@vrindex MU_DEFAULT_SCHEME
Specifies type of mailboxes. By default, @samp{mbox} (UNIX mailbox)
is assumed. This can be changed while configuring the package by
setting @code{MU_DEFAULT_SCHEME} configuration variable. The default
value can be verified by running @command{mailutils info scheme}.
@end deffn
@deffn {Configuration} folder @var{dir}
@cindex plus expansion
Sets user mail folder directory. Its value is used when expanding
@samp{plus-notation}, i.e. such mailbox names as @file{+inbox}. The
@samp{+} sign is replaced by @var{dir}, followed by a directory
separator (@samp{/}).
The @var{dir} argument can contain mailbox type prefix, e.g
@samp{mh://Mail}.
The default folder name is @samp{Mail/}.
@end deffn
@node Locking Statement
@subsection Locking Statement
@kwindex locking
@subheading Syntax
@example
locking @{
# @r{Default locker flags.}
flags @var{arg};
# @r{Set timeout for acquiring the lock.}
retry-timeout @var{arg};
# @r{Set the maximum number of times to retry acquiring the lock.}
retry-count @var{number};
# @r{Expire locks older than this amount of time.}
expire-timeout @var{number};
# @r{Use @var{prog} as external locker program.}
external-locker @var{prog};
@}
@end example
@subheading Description
This block statement configures various parameters used when locking
UNIX mailboxes in order to prevent simultaneous writes.
It is important to note, that locking applies only to traditional
UNIX mailboxes (@pxref{mbox}). All other
mailbox types don't require locking.
@deffn {Configuration} flags @var{string}
Set locking flags. Argument is a string consisting of one or more of
the following letters:
@table @asis
@item E
Use an external program to manage locks. The program is given by
@code{external-locker} statement (see below).
@item R
If the locking attempt failed, retry it. This is the default. The
number of retries, and time interval between the two successive
attempts is given by @code{retry-count} and @code{retry-timeout}
statements, correspondingly.
@item T
If a lock file exists, check its modification time and, if it is
older than a predefined amount of time, remove the lock. The amount
of time is specified by @code{expire-timeout} statement.
@item P
Store the PID of the locking process in a lock file.
@end table
@end deffn
@deffn {Configuration} retry-count @var{number}
Number of locking attempts. The @samp{P} flag must be set for this to
take effect.
@end deffn
@deffn {Configuration} retry-timeout @var{seconds}
Time interval, in seconds, between the two successive locking
attempts. The @samp{P} flag must be set for this to take effect.
@end deffn
@deffn {Configuration} expire-timeout @var{seconds}
Remove existing lock file, if it is created more than this number of
seconds ago. The @samp{T} flag must be set for this to take effect.
@end deffn
@deffn {Configuration} external-locker @var{string}
Set command line of an external locker program. The @samp{E} flag
must be set for this to take effect.
@end deffn
@node Mailer Statement
@subsection Mailer Statement
@kwindex mailer
@subheading Syntax
@example
mailer @{
url @var{url};
@}
@end example
@subheading Description
A @dfn{mailer} is a special logical entity GNU Mailutils uses for
sending messages. Its internal representation is discussed in
@FIXME-ref{Mailer}. The @code{mailer} statement configures it.
The mailer statement contains a single sub-statement:
@deffn {Configuration} url @var{str}
Set the mailer @acronym{URL}.
@end deffn
GNU Mailutils supports three types of mailer @acronym{URL}s, described
in the table below:
@table @asis
@item smtp://[@var{user}[:@var{pass}][;auth=@var{mech},...]@@]@var{host}[:@var{port}][;@var{params}]
@itemx smtps://[@var{user}[:@var{pass}][;auth=@var{mech},...]@@]@var{host}[:@var{port}][;@var{params}]
Send messages using SMTP protocol. @xref{SMTP Mailboxes}, for a
detailed description of the URL and its parts.
@item sendmail[://@var{progname}]
Use sendmail-compatible program
@var{progname}. @dfn{Sendmail-compatible} means that the program must
support following command line options:
@table @option
@item -oi
Do not treat @samp{.} as message terminator.
@item -f @var{addr}
Use @var{addr} as the sender address.
@item -t
Get recipient addresses from the message.
@end table
@xref{Program Mailboxes,,sendmail}, for details.
@item prog://@var{progname}?@var{query}
A @dfn{prog} mailer. This is a generalization of @samp{sendmail}
mailer that allows to use arbitrary external programs as mailers.
It is described in detain in @ref{Program Mailboxes,,prog}.
@end table
@node ACL Statement
@subsection ACL Statement
@kwindex acl
@subheading Syntax
@example
acl @{
# @r{Allow connections from this IP address.}
allow [from] @var{ip};
# @r{Deny connections from this IP address.}
deny [from] @var{ip};
# @r{Log connections from this IP address.}
log [from] @var{ip} [@var{string}];
/* @r{Execute supplied program if a connection from this
IP address is requested.} */
exec [from] @var{ip} @var{program};
/* Use @var{program} to decide whether to allow connection
from @var{ip}. */
ifexec [from] @var{ip} @var{program};
@}
@end example
@subheading Description
The ACL statement defines an @dfn{Access Control List}, a special
structure that controls who can access the given Mailutils resource.
The @code{acl} block contains a list of access controls. Each control
can be regarded as a function that returns a tree-state value:
@samp{True}, @samp{False} and @samp{Don't know}. When a
remote party connects to the server, each of controls is tried in
turn. If a control returns @samp{False}, access is denied. If it
returns @samp{True}, access is allowed. If it returns @samp{Don't
know}, then the next control is tried. It is unclear whether to allow
access if the last control in list returned @samp{Don't know}. GNU
Mailutils @value{VERSION} issues a warning message and allows access.
This default may change in future versions. Users are advised to
write their ACLs so that the last control returns a definite answer
(either @code{True} or @code{False}).
In the discussion below, wherever @var{cidr} appears as an argument, it
can be replaced by any of:
@itemize @bullet
@item An IPv4 address in dotted-quad notation.
@item An IPv6 address in numeric notation
@item A CIDR in the form @samp{@var{ip}/@var{mask}}, where @var{ip} is
an IP address (either IPv4 or IPv6), and @var{mask} is the network mask.
@item A symbolic host name.
@kwindex any
@item A word @samp{any}, which matches any IP address.
@end itemize
The following controls are understood:
@deffn {Configuration} allow [from] @var{cidr}
Allow connections from IP addresses matching this @var{cidr} block.
@end deffn
@deffn {Configuration} deny [from] @var{cidr}
Deny connections from IP addresses matching this @var{cidr} block.
@end deffn
@deffn {Configuration} ifexec [from] @var{cidr} @var{program}
When a connection from the @var{cidr} block is requested, execute
the program @var{program}. If its exit code is @samp{0}, then allow
connection. Otherwise, deny it.
The @var{program} argument undergoes variable expansion and word
splitting. The following variables are defined:
@table @code
@item aclno
Ordinal number of the control in the ACL. Numbers begin from
@samp{1}.
@item family
Connection family. Mailutils version @value{VERSION} supports the following
families: @samp{AF_INET}, @samp{AF_INET6} and @samp{AF_UNIX}.
@item address
Remote IP address (for @samp{AF_INET} and @samp{AF_INET6}) or socket name (for
@samp{AF_UNIX}). Notice that most Unixes return empty string instead
of the @samp{AF_UNIX} socket name, so do not rely on it.
@item port
Remote port number (for @samp{AF_INET} and @samp{AF_INET6}).
@end table
@end deffn
@deffn {Configuration} exec [from] @var{cidr} @var{program}
If a connection from the @var{cidr} block is requested, execute the given
@var{program}. Do not wait for it to terminate, and ignore its exit
code. The @var{program} is subject for variable expansion as in
@samp{ifexec}.
@end deffn
The following two controls are provided for logging purposes and as a
means of extensions. They always return a @samp{Don't know} answer,
and therefore should not be used at the end of an ACL:
@deffn {Configuration} log [from] @var{cidr} [@var{string}]
Log connections from addresses in this @var{cidr}. The
@code{MU_DIAG_INFO} channel is used. If the logging goes to syslog,
it is translated to the @code{LOG_INFO} priority.
If @var{string} is not given, the format of the log entry depends on
the connection family, as described in the table below:
@table @asis
@item @{AF_INET @var{ip}:@var{port}@}
For inet IPv4 connections. The variables @var{ip} and @var{port} are
replaced by the remote IP address and port number, correspondingly.
@item @{AF_UNIX@}
For connections over UNIX sockets. The socket name, if available, may
be printed before the closing curly brace.
@end table
If @var{string} is supplied, it undergoes variable expansions as
described for the @samp{ifexec}.
For example, the following ACL makes a Mailutils server log every
incoming connection:
@example
acl @{
log from any "Connect from $@{address@}";
...
@}
@end example
This was the default behavior for the versions of Mailutils up to
@samp{1.2}, so if you got used to its logs you might wish to add the
above in your configuration files.
@end deffn
@deffn {Configuration} exec [from] @var{cidr} @var{program}
If a connection from the @var{cidr} block is requested, execute
the given @var{program}. Do not wait for it to terminate, and ignore
its exit code.
@end deffn
@node Tcp-wrappers Statement
@subsection Tcp-wrappers Statement
@kwindex tcp-wrappers
@subheading Syntax
@example
tcp-wrappers @{
# @r{Enable TCP wrapper access control.}
enable @var{bool};
# @r{Set daemon name for TCP wrapper lookups.}
daemon @var{name};
# @r{Use @var{file} for positive client address access control.}
allow-table @var{file};
# @r{Use file for negative client address access control.}
deny-table @var{file};
@}
@end example
@subheading Description
The @code{tcp-wrappers} statements provides an alternative way to
control accesses to the resources served by GNU Mailutils. This
statement is enabled if Mailutils is compiled with TCP wrappers
library @command{libwrap}.
Access control using TCP wrappers is based on two files, called
@dfn{tables}, containing access rules. There are two tables: the
@dfn{allow table}, usually stored in file @file{/etc/hosts.allow}, and
the @dfn{deny table}, kept in file @file{/etc/hosts.deny}. The rules
in each table begin with an identifier called @dfn{daemon name}. Each
utility wishing to verify a connection, select the entries having
its daemon name from the allow table. A connection is allowed if it
matches any of these entries. Otherwise, the utility retrieves all
entries with its daemon name from the deny table. If any of these
matches the connection, then it is refused. Otherwise, if neither
table contains matching entries, the connection is allowed.
Description of a TCP wrapper table format lies outside the scope of
this document. Please, see @ref{ACCESS CONTROL FILES,,ACCESS CONTROL FILES,
hosts_access(5), hosts_access(5) man page}, for details.
@deffn {Configuration} enable @var{bool}
Enable access control using TCP wrappers. It is on by default.
@end deffn
@deffn {Configuration} daemon @var{name}
Set daemon name for TCP wrapper lookups. By default, the name of the
utility is used. E.g. @command{imap4d} uses @samp{imap4d} as the
daemon name.
@end deffn
@deffn {Configuration} allow-table @var{file}
Use @var{file} as allow table. By default, @file{/etc/hosts.allow} is
used.
@end deffn
@deffn {Configuration} deny-table @var{file}
Use @var{file} as negative table. By default, @file{/etc/hosts.deny}
is used.
@end deffn
@node Server Settings
@subsection Server Settings
@cindex server settings, configuration
@cindex configuring servers
GNU Mailutils offers several server applications: @command{pop3d},
@command{imap4d}, @command{comsatd}, to name a few. Being quite
different in their purpose, they are very similar in some aspects of
their architecture. First of all, they all support two operating
modes: @dfn{daemon}, where a program disconnects from the controlling
terminal and works in background, and @dfn{inetd}, where it
remains in foreground and communicates with the remote party via
standard input and output streams. Secondly, when operating as
daemons, they listen to a preconfigured set of IP addresses and
ports, reacting to requests that arrive.
To configure these aspects of functionality, GNU Mailutils provides
@dfn{Server Configuration Settings}, which is describes in this
subsection.
@menu
* General Server Configuration::
* Server Statement::
@end menu
@node General Server Configuration
@subsubsection General Server Configuration
@cindex server configuration, general
@* Syntax:
@example
# @r{Set daemon mode.}
mode @samp{inetd|daemon};
# @r{Run in foreground.}
foreground @var{bool};
# @r{Maximum number of children processes to run simultaneously.}
max-children @var{number};
# @r{Store PID of the master process in @var{file}.}
pidfile @var{file};
# @r{Default port number.}
port @var{portspec};
# @r{Set idle timeout.}
timeout @var{time};
@end example
@* Description:
These statements configure general server-related issues.
@deffn {Configuration} mode @var{string};
Set operation mode of the server. Two operation modes are supported:
@anchor{server mode}
@table @asis
@cindex daemon, server mode
@item daemon
Run as a standalone daemon, disconnecting from the controlling
terminal and continuing to run in the background. In this case, it is
the server that controls what IP addresses and ports to listen on, who
is allowed to connect and from where, how many clients are allowed to
connect simultaneously, etc. Most remaining configuration statements
are valid only in the daemon mode.
This is the preferred mode of operation for GNU Mailutils servers.
@cindex inetd, server mode
@item inetd
Operate as a subprocess of UNIX internet super-server program,
@command{inetd}. @xref{Internet super-server,,,inetd(8), inetd(8) man
page}, for a detailed description of the operation of @command{inetd}
and its configuration. In this case it is @command{inetd} that
controls all major connectivity aspects. The Mailutils server program
communicates with it via standard input and output streams.
For historical reasons, this mode is the default, if no @code{mode}
statement is specified. This will change in the future.
@end table
@end deffn
@deffn {Configuration} foreground @var{bool};
@*[daemon mode only]
@*Do not disconnect from the controlling terminal and remain in the
foreground.
@end deffn
@deffn {Configuration} max-children @var{number};
@*[daemon mode only]
@*Set maximum number of child processes allowed to run simultaneously.
This equals the number of clients that can use the server
simultaneously.
The default is 20 clients.
@end deffn
@deffn {Configuration} pidfile @var{file};
After startup, store the PID of the main server process in
@var{file}. When the process terminates, the file is removed. As of
version @value{VERSION}, GNU Mailutils servers make no further use of
this file. It is intended for use by automated startup scripts and
controlling programs (@FIXME-pxref{mention pies}).
@end deffn
@deffn {Configuration} port @var{portspec};
@*[daemon mode only]
@*Set default port to listen to. The @var{portspec} argument is either
a port number in decimal, or a symbolic service name, as listed in
@file{/etc/services} (@pxref{Internet network services list,,,
services(5), services(5) man page}).
@end deffn
@deffn {Configuration} timeout @var{time};
Sets maximum idle time out in seconds. If a client does not send any
requests during @var{time} seconds, the child process terminates.
@end deffn
@node Server Statement
@subsubsection Server Statement
@cindex server statement
@kwindex server
@* Syntax:
@example
server @var{ipaddr}[:@var{port}] @{
# @r{Run this server as a single process.}
single-process @var{bool};
# @r{Log the session transcript.}
transcript @var{bool};
# @r{Set idle timeout.}
timeout @var{time};
# @r{Kind of TLS encryption to use for this server.}
tls @samp{no}|@samp{ondemand}|@samp{required}|@samp{connection};
# @r{Set server specific ACLs.}
acl @{ /* @xref{ACL Statement}. */ @};
@}
@end example
@* Description:
The @code{server} block statement configures a single TCP or UDP
server. It takes effect only in daemon mode (@pxref{server mode}).
The argument to this statement specifies the IP address, and,
optionally, the port, to listen on for requests. The @var{ipaddr}
part is either an IPv4 address in dotted-quad form, or a IPv6 address
enclosed in square brackets, or a symbolic host name which can be
resolved to such an address. Specifying @samp{0.0.0.0} as the
@var{ipaddr} means listen on all available network interfaces. The
@var{port} argument is either a port number in decimal, or a symbolic
service name, as listed in @file{/etc/services} (@pxref{Internet
network services list,,,services(5), services(5) man page}). If
@var{port} is omitted, Mailutils uses the port set by @code{port}
statement (@pxref{General Server Configuration, port}), or, in its
absence, the default port number, which depends on a server being used
(e.g. 110, for @command{pop3d}, 143, for @command{imap4d}, etc.).
Any number of @code{server} statements may be specified in a single
configuration file, allowing to set up the same service on several IP
addresses and/or port numbers, and with different configurations.
Statements within the @code{server} block statement configure this
particular server.
@deffn {Configuration} single-process @var{bool};
If set to true, this server will operate in single-process mode. This
mode is intended for debugging only, do not use it on production
servers.
@end deffn
@deffn {Configuration} transcript @var{bool};
Enable transcript of the client-server interaction. This may generate
excessive amounts of logging, which in turn may slow down the operation
considerably.
Session transcripts are useful in fine-tuning your configurations and
in debugging. They should be turned off on most production servers.
@end deffn
@deffn {Configuration} timeout @var{time};
Set idle timeout for this server. This overrides global timeout
settings (@pxref{General Server Configuration, timeout}).
@end deffn
@deffn {Configuration} tls @var{mode};
Configure the use of TLS encryption. The @var{mode} argument is one
of the following:
@table @asis
@item no
TLS is not used. The corresponding command (@command{STLS}, for POP3,
@command{STARTTLS}, for @command{IMAP4}) won't be available even if
the TLS configuration is otherwise complete.
@item ondemand
TLS is initiated when the user issues the appropriate command.
This is the default when TLS is configured.
@item required
Same as above, but the use of TLS is mandatory. The authentication
state is entered only after TLS negotiation has succeeded.
@item connection
TLS is always forced when the connection is established. For
@command{pop3d} this means using POP3S protocol (or IMAP4S, for
@command{imap4d}).
@end table
@end deffn
@deffn {Configuration} acl
This statement defines a per-server Access Control List. Its syntax
is as described in @ref{ACL Statement}. Per-server ACLs complement,
but not override, global ACLs, i.e. if both global ACL and per-server
ACL are used, the connection is allowed only if both of them allow it,
and is denied if any one of them denies it.
@end deffn
@node Auth Statement
@subsection Auth Statement
@UNREVISED
@cindex authorization
@cindex authentication
@kwindex auth
@subheading Syntax
@example
auth @{
# @r{Set a list of modules for authentication.}
authentication @var{module-list};
# @r{Set a list of modules for authorization.}
authorization @var{module-list};
@}
@end example
@subheading Description
Some mail utilities provide access to their services only after
verifying that the user is actually the person he is claiming
to be. Such programs are, for example, @command{pop3d} and
@command{imap4d}. The process of the verification is broken
down into two stages: @dfn{authorization} and @dfn{authentication}.
In @dfn{authorization} stage the program retrieves the information
about a particular user. In @dfn{authentication} stage, this
information is compared against the user-supplied credentials. Only if
both stages succeed is the user allowed to use the service.
A set of @dfn{modules} is involved in performing each stage. For
example, the authorization stage can retrieve the user description
from various sources: system database, SQL database, virtual domain
table, etc. Each module is responsible for retrieving the description
from a particular source of information. The modules are arranged in
a @dfn{module list}. The modules from the list are invoked in turn,
until one of them succeeds or the list is exhausted. In the latter case
the authorization fails. Otherwise, the data returned by the succeeded
module are used in authentication.
Similarly, authentication may be performed in several ways. The
authentication modules are also grouped in a list. Each module
is tried in turn until either a module succeeds, in which case the
authentication succeeds, or the end of the list is reached.
For example, the authorization list
@example
(system, sql, virtdomains)
@end example
@noindent
means that first the system user database (@file{/etc/password}) is
searched for a description of a user in question. If the search fails,
the @acronym{SQL} database is searched. Finally, if it also fails, the
search is performed in the virtual domain database.
@emph{Note}, that some authentication and/or authorization modules may
be disabled when configuring the package before compilation. The names
of the disabled modules are nevertheless available for use in runtime
configuration options, but they represent a ``fail-only'' functionality,
e.g. if the package was compiled without @acronym{SQL} support then
the module @samp{sql} in the above example will always fail, thus
passing the execution on to the next module.
The @code{auth} statement configures authentication and authorization.
@deffn {Configuration} authorization @var{module-list}
Define a sequence of modules to use for authorization. Modules will
be tried in the same order as listed in @var{module-list}.
The modules available for use in authorization list are:
@table @asis
@item system
User credentials are retrieved from the system user database
(@file{/etc/password}).
@item sql
User credentials are retrieved from a @acronym{SQL} database.
A separate configuration statement, @code{sql}, is used to configure
it (@pxref{SQL Statement}).
@item virtdomain
User credentials are retrieved from a ``virtual domain'' user
database. Virtual domains are configured using @code{virtdomain}
statement (@pxref{Virtdomain Statement}).
@item radius
User credentials are retrieved using @acronym{RADIUS}. @xref{Radius
Statement}, for a detailed description on how to configure it.
@item ldap
User credentials are retrieved from an @acronym{LDAP}
database. @xref{LDAP Statement}, for an information on how to
configure it.
@end table
@FIXME{This may be inaccurate:}
Unless overridden by @code{authorization} statement,
the default list of authorization modules is:
@example
(system, sql, virtdomains)
@end example
@end deffn
@deffn {Configuration} authentication @var{module-list}
Define a sequence of modules to use for authentication. Modules will
be tried in the same order as listed in @var{module-list}.
The following table lists modules available for use in @var{module-list}:
@table @asis
@item generic
The generic authentication type. User password is hashed and compared
against the hash value returned in authorization stage.
@item system
The hashed value of the user password is retrieved from
@file{/etc/shadow} file on systems that support it.
@item sql
The hashed value of the user password is retrieved from a
@acronym{SQL} database using query supplied by @code{getpass}
statement (@pxref{SQL Statement, getpass}).
@item pam
The user is authenticated via pluggable authentication module
(@acronym{PAM}). The @acronym{PAM} service name to be used is
configured in @code{pam} statement (@pxref{PAM Statement}).
@item radius
The user is authenticated on a remote @acronym{RADIUS}
server. @xref{Radius Statement}.
@item ldap
The user is authenticated using @acronym{LDAP}. @xref{LDAP Statement}.
@end table
@FIXME{This list is inaccurate:}
Unless overridden by @code{authentication} statement,
the list of authentication modules is:
@example
(generic, system, pam, sql)
@end example
@end deffn
@node PAM Statement
@subsection PAM Statement
@UNREVISED
@kwindex pam
@subheading Syntax
@example
pam @{
# @r{Set PAM service name.}
service @var{text};
@}
@end example
@subheading Description
The @code{pam} statement configures @acronym{PAM} authentication. It
contains a single sub-statement:
@deffn {Configuration} service @var{text}
Define service name to look for in @acronym{PAM} configuration. By
default, the base name of the Mailutils binary is used.
@end deffn
This statement takes effect only if @samp{pam} is listed in
@code{authentication} statement (@pxref{Auth Statement}).
@node Virtdomain Statement
@subsection Virtdomain Statement
@UNREVISED
@kwindex virtdomain
@subheading Syntax
@example
virtdomain @{
# @r{Name of the virtdomain password directory.}
passwd-dir @var{dir};
@}
@end example
@subheading Description
@dfn{Virtual mail domains} make it possible to handle several
mail domains each having a separate set of users, on a single server.
The domains are completely independent of each other, i.e. the same
user name can be present in several domains and represent different
users.
When authenticating to a server with virtual domain support enabled,
users must supply their user names with domain parts. The server strips
off the domain part and uses it as a name of UNIX-format password
database file, located in the @dfn{domain password directory}. The
latter is set using @code{passwd-dir} statement.
@deffn {Configuration} passwd-dir @var{dir}
Set virtual domain password directory.
@end deffn
For example, when authenticating user @samp{smith@@domain.tld},
the server will use password file named @file{@var{dir}/domain.tld}.
This file must be in UNIX passwd format (@pxref{password
file,,,passwd(5), passwd(5) man page}), with encrypted passwords
stored in it (as of GNU Mailutils version @value{VERSION}, there is no
support for shadow files in virtual password directories, although
this is planned for future versions). Here is an example record from
this file:
@example
smith:Wbld/G2Q2Le2w:1000:1000:Email Account:/var/mail/domain/smith:/dev/null
@end example
Notice, that it must contain user names without domain parts.
The @code{pw_dir} field (the 6th field) is used to determine the
location of the maildrop for this user. It is defined as
@file{@var{pw_dir}/INBOX}. In our example, the maildrop for user
@samp{smith} will be located in file @file{/var/mail/domain/smith}.
If user did not supply his domain name, or if no matching record was
found in the password file, or if the file matching the domain name
does not exist, then GNU Mailutils falls back to alternative method.
First, it tries to determine the IP address of the remote party. Then
the domain name corresponding to that address is looked up in the DNS
system. Finally, this domain name is used as a name of the password
file.
@node Radius Statement
@subsection Radius Statement
@UNREVISED
@kwindex radius
@subheading Syntax
@example
radius @{
# Set radius configuration directory.
directory @var{dir};
# @r{Radius request for authorization.}
auth @var{request};
# @r{Radius request for getpwnam.}
getpwnam @var{request};
# Radius request for getpwuid.
getpwuid @var{request};
@}
@end example
@subheading Description
The @code{radius} block statement configures @acronym{RADIUS
authentication} and authorization.
Mailutils uses GNU Radius library, which is configured via
@file{raddb/client.conf} file (@pxref{client.conf, Client Configuration,
Client Configuration, radius, GNU Radius Reference Manual}). Its exact
location depends on configuration settings that were used while
compiling GNU Radius. Usually it is @file{/usr/local/etc}, or
@file{/etc}. This default can also be changed at run time using
@code{directory} statement:
@deffn {Configuration} directory @var{dir}
Set full path name to the GNU Radius configuration directory.
@end deffn
It authorization is used, the Radius dictionary file must declare the
the following attributes:
@multitable @columnfractions 0.4 0.2 0.4
@headitem Attribute @tab Type @tab Description
@kwindex GNU-MU-User-Name
@item GNU-MU-User-Name @tab string @tab User login name
@kwindex GNU-MU-UID
@item GNU-MU-UID @tab integer @tab UID
@kwindex GNU-MU-GID
@item GNU-MU-GID @tab integer @tab GID
@kwindex GNU-MU-GECOS
@item GNU-MU-GECOS @tab string @tab GECOS
@kwindex GNU-MU-Dir
@item GNU-MU-Dir @tab string @tab Home directory
@kwindex GNU-MU-Shell
@item GNU-MU-Shell @tab string @tab User shell
@kwindex GNU-MU-Mailbox
@item GNU-MU-Mailbox @tab string @tab User mailbox
@kwindex GNU-MU-Quota
@item GNU-MU-Quota @tab integer @tab Mail quota (in bytes)
@end multitable
@flindex mailutils.dict
A dictionary file with appropriate definitions is included in the
Mailutils distribution: @file{examples/config/mailutils.dict}. This
file is not installed by default, you will have to manually copy it to
the GNU Radius @file{raddb/dict} directory and include it in the main
dictionary file @file{raddb/dictionary} by adding the following
statement:
@example
$INCLUDE dict/mailutils.dict
@end example
Requests to use for authentication and authorization are
configured using three statements: @code{auth}, @code{getpwnam} and
@code{getpwuid}. Each statement takes a single argument: a string,
containing a comma-separated list of assignments. An assignment
specifies a particular @dfn{attribute-value pair} (@pxref{Overview,
RADIUS Attributes,, radius, GNU Radius Reference Manual}) to send to
the server. The left-hand side of the assignment is a symbolic attribute
name, as defined in one of Radius dictionaries (@pxref{dictionary
file, Dictionary of Attributes,, radius, GNU Radius Reference
Manual}). The value is specified by the right-hand side of
assignment. For example:
@example
"Service-Type = Authenticate-Only, NAS-Identifier = \"mail\""
@end example
The assignment may contain references to the following variables
(@pxref{Variables}):
@table @asis
@item user
The actual user name (for @code{auth} and @code{getpwnam}), or user ID
(for @code{getpwuid}). For example:
@example
User-Name = $@{user@}
@end example
@item passwd
User password. For examples:
@example
User-Password = $@{passwd@}
@end example
@end table
@deffn {Configuration} auth @var{pairlist}
Specifies the request to be sent to authenticate the user. For example:
@example
auth "User-Name = $@{user@}, User-Password = $@{passwd@}";
@end example
The user is authenticated only if this request returns
@code{Access-Accept} (@pxref{Authentication Requests, Access-Accept,,
radius, GNU Radius Reference Manual}). Any returned attribute-value
pairs are ignored.
@end deffn
@deffn {Configuration} getpwnam @var{pairlist}
Specifies the request that returns user information for the
given user name. For example:
@example
getpwnam "User-Name = $@{user@}, State = getpwnam, "
"Service-Type = Authenticate-Only";
@end example
If the requested user account exists, the Radius server must return
@code{Access-Accept} packet with the following attributes:
@code{GNU-MU-User-Name}, @code{GNU-MU-UID}, @code{GNU-MU-GID},
@code{GNU-MU-GECOS}, @code{GNU-MU-Dir}, @code{GNU-MU-Shell}.
The attributes @code{GNU-MU-Mailbox} and @code{GNU-MU-Quota} are
optional.
If @code{GNU-MU-Mailbox} is present, it must contain a
valid mailbox @acronym{URL} (@FIXME-pxref{urls}). If
@code{GNU-MU-Mailbox} is not present, Mailutils constructs the
mailbox name using the settings from the @code{mailbox} configuration
statement (@pxref{Mailbox Statement}), or built-in defaults, if it is
not present.
If @code{GNU-MU-Quota} is present, it specifies the maximum mailbox
size for this user, in bytes. In the absence of this attribute,
mailbox size is unlimited.
@end deffn
@deffn {Configuration} getpwuid @var{pairlist}
Specifies the request that returns user information for the
given user ID. In @var{pairlist}, the @samp{user} macro-variable is
expanded to the numeric value of ID. For example:
@example
getpwuid "User-Name = $@{user@}, State = getpwuid, "
"Service-Type = Authenticate-Only";
@end example
The reply to @code{getpwuid} request is the same as to @code{getpwnam}
request (see above).
@end deffn
@node SQL Statement
@subsection SQL Statement
@UNREVISED
@kwindex sql
@subheading Syntax
@example
sql @{
# @r{Set SQL interface to use.}
interface @samp{mysql|odbc|postgres};
# @r{SQL server host name.}
host @var{arg};
# @r{SQL user name.}
user @var{arg};
# @r{Password for the SQL user.}
passwd @var{arg};
# @r{SQL server port.}
port @var{arg};
# @r{Database name.}
db @var{arg};
# @r{Type of password returned by getpass query.}
password-type @samp{plain | hash | scrambled};
# @r{Set a field-map for parsing SQL replies.}
field-map @var{map};
# @r{SQL query returning the user's password.}
getpass @var{query};
# @r{SQL query to use for getpwnam requests.}
getpwnam @var{query};
# @r{SQL query to use for getpwuid requests.}
getpwuid @var{query};
@}
@end example
@subheading Description
The @code{sql} statement configures access credentials to
@acronym{SQL} database and the queries for authentication and
authorization.
GNU Mailutils supports three types of @acronym{SQL} interfaces:
MySQL, PostgreSQL and ODBC. The latter is a standard API for using
database management systems, which can be used to communicate with a
wide variety of DBMS.
@deffn {Configuration} interface @var{type}
Configures type of DBMS interface. Allowed values for @var{type} are:
@table @asis
@item mysql
Interface with a MySQL server (@uref{http://www.mysql.org}).
@item odbc
Use ODBC interface. See @uref{http://www.unixodbc.org}, for a detailed
description of ODBC configuration.
@item postgres
Interface with a PostgreSQL server (@uref{http://www.postgres.org}).
@end table
@end deffn
The database and database access credentials are configured using the
following statements:
@deffn {Configuration} host @var{arg}
The host running the @acronym{SQL} server. The value can be either a
host name or an IP address in dotted-quad notation, in which case an
@acronym{INET} connection is used, or a full pathname to a file, in
which case a connection to @acronym{UNIX} socket is used.
@end deffn
@deffn {Configuration} port @var{arg}
TCP port the server is listening on (for @acronym{INET}
connections). This parameter is optional. Its default value depends on
the type of database being used.
@end deffn
@deffn {Configuration} db @var{arg};
Name of the database.
@end deffn
@deffn {Configuration} user @var{arg}
@acronym{SQL} user name.
@end deffn
@deffn {Configuration} passwd @var{arg};
Password to access the database.
@end deffn
@node LDAP Statement
@subsection LDAP Statement
@WRITEME
@kwindex ldap
@subheading Syntax
@example
ldap @{
# @r{Enable LDAP lookups.}
enable @var{bool};
# @r{Set URL of the LDAP server.}
url @var{url};
# @r{Base DN for LDAP lookups.}
base @var{string};
# @r{DN for accessing LDAP database.}
binddn @var{string};
# @r{Password for use with binddn.}
passwd @var{string};
# @r{Use TLS encryption.}
tls @var{bool};
# @r{Set LDAP debugging level.}
debug @var{number};
# @r{Set a field-map for parsing LDAP replies.}
field-map @var{map};
# @r{LDAP filter to use for getpwnam requests.}
getpwnam @var{string};
# @r{LDAP filter to use for getpwuid requests.}
getpwuid @var{filter};
@}
@end example
@node TLS Statement
@subsection TLS Statement
@WRITEME
@kwindex tls
@subheading Syntax
@example
tls @{
# @r{Enable TLS support.}
enable @var{bool};
# @r{Specify SSL certificate file.}
ssl-cert @var{bool};
# @r{Specify SSL certificate key file.}
ssl-key @var{file};
# @r{Specify trusted CAs file.}
ssl-cafile @var{file};
@}
@end example
@node GSASL Statement
@subsection GSASL Statement
@WRITEME
@kwindex gsasl
@subheading Syntax
@example
gsasl @{
# @r{Name of GSASL password file.}
cram-passwd @var{file};
# @r{SASL service name.}
service @var{string};
# @r{SASL realm name.}
realm @var{string};
# @r{SASL host name.}
hostname @var{string};
# @r{Anonymous user name.}
anonymous-user @var{string};
@}
@end example
@c -------------------------------------------------------------------
@node debugging
@section Debugging
@command{Mailutils} debugging output is controlled by a set of levels, each of
which can be set independently of others. Each debug level consists of
a @dfn{category name}, which identifies the part of
@command{Mailutils} for which additional debugging is desired, and a
level number, which tells @command{Mailutils} how verbose should its
output be.
Valid debug levels are:
@table @asis
@item error
Displays error conditions which are normally not reported, but passed
to the caller layers for handling.
@item trace0 through trace9
Ten levels of verbosity, @samp{trace0} producing less output,
@samp{trace9} producing the maximum amount of output.
@item prot
Displays network protocol interaction, where applicable.
@end table
Implementation and applicability of each level differs between various
categories. The full list of categories is available in
file @file{libmailutils/diag/debcat} in the Mailutils source tree.
Most useful categories and levels implemented for them are discussed
later in this article.
@menu
* Level Syntax::
* Level BNF::
* Debugging Categories::
@end menu
@node Level Syntax
@subsection Level Syntax
Debug levels can be set either from the command line, by using the
@option{--debug-level} command line option, or from the configuration
file, using the @samp{.debug.level} statement. In both cases, the
level is specified as a list of individual levels, delimited with
semicolons. Each individual level can be specified as:
@table @asis
@item !@var{category}
Disables all levels for the specified @var{category}.
@item @var{category}
Enables all levels for the specified @var{category}.
@item @var{category}.@var{level}
For the given @var{category}, enables all levels from @samp{error} to
@var{level}, inclusive.
@item @var{category}.=@var{level}
Enables only the given @var{level} for this @var{category}.
@item @var{category}.!@var{level}
Disables all levels from @samp{error} to @var{level}, inclusive, for
this @var{category}.
@item @var{category}.!=@var{level}
Disables only the given @var{level} in this @var{category}.
@item @var{category}.@var{levelA}-@var{levelB}
Enables all levels in the range from @var{levelA} to @var{levelB}, inclusive.
@item @var{category}.!@var{levelA}-@var{levelB}
Disables all levels in the range from @var{levelA} to @var{levelB}, inclusive.
@end table
Additionally, a comma-separated list of level specifications is
allowed after the dot. For example, the following specification:
@example
acl.prot,!=trace9,!trace2
@end example
enables in category @samp{acl} all levels, except @samp{trace9},
@samp{trace0}, @samp{trace1}, and @samp{trace2}.
@node Level BNF
@subsection BNF
The following specification in Backus-Naur form describes formally the
Mailutils debug level:
@example
<debug-spec> ::= <level-spec> | <debug-level-list>
<debug-level-list> ::= <debug-level> |
<debug-level-list> ";" <debug-level>
<debug-level> ::= <category> | "!" <category> |
<category> "." <level-list>
<level-list> ::= <level-spec> | <level-list> "," <level-spec>
<level-spec> ::= <level> | <negate-level>
<negate-level> ::= "!" <level>
<level> ::= <level-number> | "=" <level-number> |
<level-number> "-" <level-number>
<level-number> ::= "error" | "trace0" | "trace1" | "trace2" | "trace3" |
"trace4" | "trace5" | "trace6" | "trace7" |
"trace8" | "trace9" | "prot"
@end example
@node Debugging Categories
@subsection Debugging Categories
@table @asis
@item acl
This category enables debugging of Access Control Lists. Available
levels are:
@table @asis
@item error
As usual, displays errors, not directly reported otherwise.
@item trace0
Basic tracing of ACL processing.
@item trace9
Traces the process of matching the ACL conditions.
@end table
@item config
This category affects configuration parser and/or lexical
analyzer. The following levels are supported:
@table @asis
@item trace0
Minimal information about configuration statements.
@item trace2
Trace lexical structure of the configuration files.
@item trace7
Trace execution of the configuration parser.
@end table
Due to its specific nature, this category cannot be enabled from the
configuration file. A special hook is provided to facilitate
debugging the configuration parser, namely, a pragmatic comment in
form:
@example
#debug=@var{debug-level-list}
@end example
causes @var{debug-level-list} to be parsed as described above. Thus, to
force debugging of the configuration parser, one would add the following
line at the very beginning of the configuration file:
@example
#debug=config.trace7
@end example
@item mailbox
Operations over mailboxes. This module supports the following levels:
@samp{error}, @samp{trace0}, @samp{trace1}, and @samp{prot}. The
latter is used by remote mailbox support libraries.
@item auth
Enables debugging information about authentication and authorization.
This category supports the following levels: @samp{error},
@samp{trace0}, @samp{trace1}, and @samp{trace2}.
In level @samp{trace0}, user data are reported along with the
@dfn{data source} they were obtained from. The output may look like this:
@example
pop3d: source=system, name=gray, passwd=x, uid=120, gid=100,
gecos=Sergey Poznyakoff, dir=/home/gray, shell=/bin/bash,
mailbox=/var/mail/gray, quota=0, change_uid=1
@end example
In the @samp{trace1} level, additional flow traces are displayed.
In the level @samp{trace2}, a detailed flow trace is displayed, which
looks like the following:
@example
pop3d: Trying generic...
pop3d: generic yields 38=Function not implemented
pop3d: Trying system...
pop3d: system yields 0=Success
pop3d: Trying generic...
pop3d: generic yields 4135=Authentication failed
pop3d: Trying system...
pop3d: system yields 0=Success
@end example
@item mailer
Debugs mailer operations. The following levels are supported:
@table @asis
@item error
Displays mild error conditions.
@item trace0
Traces mailer operations in general: displays what part of the message
is being sent, etc.
@item trace6
When used together with @samp{prot}, displays security-sensitive
information (such as passwords, user keys, etc). in plaintext. By
default, such information is replaced with asteriscs to reduce the
possibility of security compromise.
@item trace7
When used together with @samp{prot}, displays the @dfn{payload}
information as it is being sent. The @dfn{payload} is the actual
message contents, i.e. the part of SMTP transaction that goes after
the @samp{DATA} command and which ends with a terminating dot line.
Setting this level can generate huge amounts of information.
@item prot
For SMTP mailer: outputs transcripts of SMTP sessions.
@end table
@emph{Note:} Unless in a very secure environment, it is advised to
avoid using level settings such as mailer.prot or mailer (without
explicit level part), because the resulting output tends to be
extremely copious and reveals sender private and security-sensitive
data. If you wish to trace SMTP session flow, use @samp{mailer.=prot}
or at least @samp{mailer.prot,!trace6}.
@item serve
This category provides debugging information for Mailutils IP
server objects. It supports the @samp{error} and @samp{trace0} levels.
@item folder
This category controls debugging information shown for operations
related to Mailutils folders.
@item remote
The remote category is used by @command{imap4d} and @command{pop3d}
servers to request showing additional information in the session
transcripts. This category takes effect only when the @code{transcript}
configuration variable is set. Valid levels are:
@table @asis
@item trace6
Show security-sensitive information (user passwords, etc.)
@item trace7
Show payload information
@end table
@end table
@node frm and from
@section @command{frm} and @command{from} --- List Headers from a Mailbox
@UNREVISED
GNU mailutils provides two commands for listing messages in a mailbox.
These are @command{from} and @command{frm}.
The behavior of both programs is affected by the following
configuration file statements:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@end multitable
@subheading @command{frm}
@pindex frm
The @command{frm} utility outputs a header information of
the selected messages in a mailbox. By default, @command{frm} reads
user's system mailbox and outputs the contents of @code{From} and
@code{Subject} headers for each message. If a folder is specified in
the command line, the program reads that folder rather than the default
mailbox.
The following command line options alter the behavior of the program:
@table @option
@item -d
@itemx --debug
Enable debugging output.
@item -f @var{string}
@itemx --field @var{string}
Display the header named by @var{string} instead of @code{From}
@code{Subject} pair.
@item -l
@itemx --to
Include the contents of @code{To} header to the output. The output field
order is then: @code{To} @code{From} @code{Subject}.
@item -n
@itemx --number
Prefix each line with corresponding message number.
@item -Q
@itemx --Quiet
Be very quiet. Nothing is output except error messages. This is useful
in shell scripts where only the return status of the program is
important.
@item -q
@itemx --query
Print a message only if there are unread messages in the mailbox.
@item -S
@itemx --summary
Print a summary line.
@item -s @var{attr}
@itemx --status @var{attr}
Only display headers from messages with the given status.
@var{Attr} may be one of the following: @samp{new}, @samp{read},
@samp{unread}. It is sufficient to specify only first letter of
an @var{attr}. Multiple @option{-s} options are allowed.
@item -t
@itemx --align
Tidy mode. In this mode @command{frm} tries to preserve the alignment of
the output fields. It also enables the use of BIDI algorithm for
displaying subject lines that contain text in right-to-left
orientation (such as Arabic or Hebrew).
@end table
@subheading @command{from}
@pindex from
The @command{from} utility displays sender and subject of each message
in a mailbox. By default, it reads the user's system mailbox. If the
program is given a single argument, it is interpreted as a name of the
user whose mailbox is to be read. Obviously, permissions are required
to access that user's mailbox, so such invocations may be used only
by superuser.
The option @option{-f} (@option{--file}) instructs @command{from} to read
the given mailbox.
The full list of options, supported by @command{from} follows:
@table @option
@item -c
@itemx --count
Prints only a count of messages in the mailbox and exit.
@item -d
@itemx --debug
Prints additional debugging output.
@item -s @var{string}
@itemx --sender=@var{string}
Prints only mail whose @samp{From:} headers contain the supplied string.
@FIXME{Probably, this should test envelopes as well.}
@item -f @var{url}
@itemx --file=@var{url}
Examine mailbox from the given @var{url}.
@end table
@page
@node mail
@section @command{mail} --- Send and Receive Mail
@pindex mail
@UNREVISED
@command{Mail} is an enhanced version of standard @command{/bin/mail} program.
As well as its predecessor, it can be used either in sending mode or
in reading mode. @command{Mail} enters sending mode when one or more
email addresses were specified in this command line. In this mode the
program waits until user finishes composing the message, then attempts
to send it to the specified addresses and exits.
See @ref{Composing Mail}, for a detailed description of this behavior.
If the command line contained no email addresses, @command{mail} switches
to reading mode. In this mode it allows to read and manipulate the
contents of the user system mailbox. The @option{--file} (@option{-f})
command line option allows to specify another mailbox name. For more
detail, see @ref{Reading Mail}.
In contrast to other GNU Mailutils programs, @command{mail} does not
use the Mailutils configuration file. Instead, it uses the traditional
@samp{mailrc}-style configuration. @xref{Mail Configuration Files},
for a detailed description of its format.
@menu
* Invoking Mail:: Command Line Options.
* Specifying Messages:: How to Specify Message Sets.
* Composing Mail:: Composing Mail.
* Reading Mail:: Reading Mail.
* Scripting:: Scripting.
* Mail Variables:: How to Alter the Behavior of @command{mail}.
* Mail Configuration Files:: Personal and System-wide Configuration Files.
@end menu
@node Invoking Mail
@subsection Invoking @command{mail}
General usage of @command{mail} program is:
@example
mail [@var{option}...] [@var{address}...]
@end example
@noindent
If [@var{address}...] part is present, @command{mail} switches to
mail sending mode, otherwise it operates in mail reading mode.
The program uses following option groups: @FIXME-xref{mailbox}.
@command{Mail} understands following command line options:
@table @option
@item -e
@itemx --exist
Return true if the mailbox contains some messages. Return false
otherwise.
This is useful for writing shell scripts.
@item -E @var{command}
@itemx --exec=@var{command}
Execute @var{command} before opening the mailbox. Any number of
@option{--exec} options can be given. The commands will be executed
after sourcing configuration files (@pxref{Mail Configuration Files}),
but before opening the mailbox.
@item -f
@itemx --file
Operate on the mailbox given by the first non-optional command line
argument. If there is no such argument, read messages from the
user's @file{mbox} file. @xref{Reading Mail}, for more details about
using this option.
@item -F
@itemx --byname
Record outgoing messages in a file named after the first recipient.
The name is the login-name portion of the address found first on the
@samp{To:} line in the mail header. This option sets the @samp{byname}
variable, which see (@pxref{byname}).
@item -H
@itemx --headers
Print header summary to stdout and exit.
@item -i
@itemx --ignore
Ignore interrupts.
@item -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item -n
@itemx --norc
Do not read the system-wide mailrc file. @xref{Mail Configuration Files}.
@item -N
@itemx --nosum
Do not display initial header summary.
@item -p
@itemx --print
@itemx --read
Print all mail to standard output. It is equivalent to issuing following
commands after starting @samp{mail -N}:
@example
@group
print *
quit
@end group
@end example
@noindent
except that @command{mail --print} does not change status of the messages.
@item -r @var{address}
@itemx --return-address=@var{address}
Sets the return email address for outgoing mail. @xref{return-address}.
@item -q
@itemx --quit
Cause interrupts to terminate program.
@item -s @var{subj}
@itemx --subject=@var{subj}
Send a message with a Subject of @var{subj}. Valid only in sending mode.
@item -t
@itemx --to
Switch to sending mode.
@item -u @var{user}
@itemx --user=@var{user}
Operate on @var{user}'s mailbox. This is equivalent to:
@example
mail -f/@var{spool_path}/@var{user}
@end example
@noindent
with @var{spool_path} being the full path to your mailspool directory
@*(@file{/var/spool/mail} or @file{/var/mail} on most systems).
@item -?
@itemx --help
Display a help message.
@item --usage
Display a short usage summary.
@item -V
@itemx --version
Print program version and exit.
@end table
@node Specifying Messages
@subsection How to Specify Message Sets
Many mail commands such as print and delete can be given a @dfn{message list}
to operate upon. Wherever the message list is omitted, the command
operates on the current message.
The @dfn{message list} in its simplest form is one of:
@table @asis
@item .
Selects current message. It is equivalent to empty message list.
@item *
Selects all messages in the mailbox.
@item ^
Selects first non-deleted message.
@item $
Selects last non-deleted message.
@end table
In its complex form, the @dfn{message list} is a comma or whitespace-separated
list of @dfn{message specifiers}. A @dfn{message specifier} is one
of
@table @asis
@item Message Number
This specifier addresses the message with the given ordinal number
in the mailbox.
@item Message range
@dfn{Message range} is specified as two message numbers separated by
a dash. It selects all messages with the number lying within that range.
@item Attribute specifier
An @dfn{Attribute specifier} is a colon followed by a single
letter. The @dfn{Attribute specifier} addresses all messages in the
mailbox that have the given attribute. These are the valid attribute
specifiers:
@table @samp
@item :d
Selects all deleted messages.
@item :n
Selects all recent messages, i.e. the messages that have not been
neither read not seen so far.
@item :o
Selects all messages that have been seen.
@item :r
Selects all messages that have been read.
@item :u
Selects all messages that have @emph{not} been read.
@item :t
Selects all tagged messages.
@item :T
Selects all untagged messages.
@end table
@item Header match
The @dfn{header match} is a string in the form:
@example
[@var{header}:]/@var{string}/
@end example
@noindent
It selects all messages that contain header field @var{header}
matching given @var{regexp}. If the variable @code{regexp} is set,
the @var{string} is assumed to be a POSIX regexp. Otherwise, a
header is considered to match @var{string} if the latter constitutes
a substring of the former (comparison is case-insensitive).
If @var{header}: part is omitted, it is assumed to be @samp{Subject:}.
@item Message body match
The @dfn{message body match} is a string in the form:
@example
:/@var{string}/
@end example
@noindent
It selects all messages whose body matches the string. The matching
rules are the same as described under ``Header match''.
@end table
A @dfn{message specifier} can be followed by @dfn{message part
specifier}, enclosed in a pair of brackets. A @dfn{message part
specifier} controls which part of a message should be operated upon.
It is meaningful only for multipart messages. A @dfn{message part
specifier} is a comma or whitespace - separated list of part numbers
or ranges. Each part number can in turn be @dfn{message part specifier},
thus allowing for operating upon multiply-encoded messages.
The following are the examples of valid message lists:
@node Composing Mail
@subsection Composing Mail
You can compose the message by simply typing the contents of it, line
by line. But usually this is not enough, you would need to edit
your text, to quote some messages, etc. @command{Mail} provides these
capabilities through @dfn{compose escapes}. The @dfn{compose escapes}
are single-character commands, preceded by special @dfn{escape character},
which defaults to @samp{~}. The combination @code{escape character + command}
is recognized as a compose escape only if it occurs at the beginning of
a line. If the escape character must appear at the beginning of a
line, enter it twice.
The actual escape character may be changed by setting the value of
@code{escape} mail variable (@pxref{Mail Variables}).
@menu
* Quitting Compose Mode::
* Getting Help on Compose Escapes::
* Editing the Message::
* Modifying the Headers::
* Enclosing Another Message::
* Adding a File to the Message::
* Printing And Saving the Message::
* Signing the Message::
* Printing Another Message::
* Inserting Value of a Mail Variable::
* Executing Other Mail Commands::
* Executing Shell Commands::
@end menu
@node Quitting Compose Mode
@subsubsection Quitting Compose Mode
@kyindex ~., mail escape
@kyindex ~x, mail escape
There are several commands allowing you to quit the compose mode.
Typing the end-of-file character (@samp{C-D}) on a line alone finishes
compose mode and sends the message to its destination. The @samp{C-D}
character looses its special meaning if @code{ignoreeof} mail variable
is set.
If mail variable @code{dot} is set, typing dot (@samp{.}) on a line
alone achieves the same effect as @samp{C-D} above.
Finally, using @samp{~.} escape always quits compose mode and sends
out the composed message.
To abort composing of a message without sending it, type interrupt
character (by default, @samp{C-C}) twice. This behavior is disabled
when mail variable @code{ignore} is set. In this case, you can use
@samp{~x} escape to achieve the same effect.
@node Getting Help on Compose Escapes
@subsubsection Getting Help on Compose Escapes: ~?
@kyindex ~?, mail escape
The @samp{~?} escape prints on screen a brief summary of the available
compose escapes. @emph{Please note}, that @samp{~h} escape prompts
for changing the header values, and does @emph{not} give help.
@node Editing the Message
@subsubsection Editing the Message: ~e and ~v
@kyindex ~e, mail escape
@kyindex ~v, mail escape
If you are not satisfied with the message as it is, you can edit it
using a text editor specified either by @code{EDITOR} or by
@code{VISUAL} environment variables. The @samp{~e} uses the former,
and @samp{~v} uses the latter.
By default both escapes allow you to edit only the body of the
message. However, if the @code{editheaders} variable is set,
@command{mail} will load into the editor the complete text of
the message with headers included, thus allowing you to change
the headers as well.
@node Modifying the Headers
@subsubsection Modifying the Headers: ~h, ~t, ~c, ~b, ~s
To add new addresses to the list of message recipients, use @samp{~t}
command, e.g.:
@example
~t name1@@domain.net name2
@end example
To add addresses to @code{Cc} or @code{Bcc}, use @samp{~c} or @samp{~b}
escapes respectively.
To change the @code{Subject} header, use @samp{~s} escape, e.g.:
@example
~s "Re: your message"
@end example
Finally, to edit all headers, type @samp{~h} escape. This will present
you with the values of @code{To}, @code{Cc}, @code{Bcc}, and
@code{Subject} headers allowing to edit them with normal text editing
commands.
@node Enclosing Another Message
@subsubsection Enclosing Another Message: ~m and ~M
@kyindex ~m, mail escape
@kyindex ~M, mail escape
If you are sending mail from within mail command mode, you can enclose
the contents of any message sent to you by using @samp{~m} or @samp{~M}
commands. Typing @samp{~m} alone will enclose the contents of the
current message, typing @samp{~m 12} will enclose the contents of
message #12 and so on.
The @samp{~m} uses retained and ignored lists when enclosing headers,
the @samp{~M} encloses all header fields.
In both cases, the contents of @code{indentprefix} mail variable is
prepended to each line enclosed.
@node Adding a File to the Message
@subsubsection Adding a File to the Message: ~r and ~d
To append the contents of file @var{filename} to the message, type
@example
~r @var{filename}
@end example
@noindent
or
@example
~< @var{filename}
@end example
@noindent
The @samp{~d} escape is a shorthand for
@example
~r dead.letter
@end example
@node Printing And Saving the Message
@subsubsection Printing And Saving the Message
@kyindex ~p, mail escape
@kyindex ~w, mail escape
The @samp{~p} escape types the contents of the message entered so far,
including headers, on your terminal. You can save the message to
an arbitrary file using @samp{~w} escape. It takes the filename as its
argument.
@node Signing the Message
@subsubsection Signing the Message: ~a and ~A
@kyindex ~a, mail escape
@kyindex ~A, mail escape
To save you the effort of typing your signature at the end of each
message, you can use @samp{~a} or @samp{~A} escapes. If your signature
occupies one line only, save it to the variable @code{sign} and use
@samp{~a} escape to insert it. Otherwise, if it is longer than one
line, save it to a file, store the name of this file in the
variable @code{Sign}, and use @samp{~A} escape to insert it into
the message.
@node Printing Another Message
@subsubsection Printing Another Message: ~f and ~F
@kyindex ~f, mail escape
@kyindex ~F, mail escape
Sometimes it is necessary to view the contents of another message,
while composing. These two escapes allow it. Both take the message
list as their argument. If they are used without argument, the
contents of the current message is printed. The difference between
@samp{~f} and @samp{~F} is that the former uses ignored and retained
lists to select headers to be displayed, whereas the latter prints
all headers.
@node Inserting Value of a Mail Variable
@subsubsection Inserting Value of a Mail Variable: ~i
@kyindex ~i, mail escape
The @samp{~i} escape enters the value of the named mail variable into
the body of the message being composed.
@node Executing Other Mail Commands
@subsubsection Executing Other Mail Commands: ~: and ~-
@kyindex ~:, mail escape
@kyindex ~-, mail escape
You can execute a mail command from within compose mode using @samp{~:}
or @samp{~-} escapes. For example, typing
@example
~: from :t
@end example
@noindent
will display the from lines of all tagged messages. Note, that executing
mail-sending commands from within the compose mode is not allowed.
An attempt to execute such a command will result in diagnostic message
``Command not allowed in an escape sequence'' being displayed.
Also, when starting compose mode immediately from the shell
(e.g. running @samp{mail address@@domain}), most mail commands are
meaningless, since there is no mailbox to operate upon. In this case,
the only commands that can reasonably be used are: @code{alias},
@code{unalias}, @code{alternate}, @code{set}, and @code{unset}.
@node Executing Shell Commands
@subsubsection Executing Shell Commands: ~! and ~|
@kyindex ~!, mail escape
@kyindex ~|, mail escape
The @samp{~!} escape executes specified command and returns you to
@command{mail} compose mode without altering your message. When used without
arguments, it starts your login shell. The @samp{~|} escape pipes the
message composed so far through the given shell command and replaces the
message with the output the command produced. If the command produced
no output, @command{mail} assumes that something went wrong and retains
the old contents of your message.
@c *********************************************************************
@node Reading Mail
@subsection Reading Mail
To read messages from a given mailbox, use one of the following ways of
invoking @command{mail}:
@table @code
@item mail
To read messages from your system mailbox.
@item mail -f
@itemx mail --file
To read messages from your mailbox (@file{$HOME/mbox}). If the
@option{--user} option (see below) is also given, read messages
from that user's @file{mbox}.
@item mail -f @var{path_to_mailbox}
@itemx mail --file @var{path_to_mailbox}
To read messages from the specified mailbox.
@item mail -u @var{user}
@itemx mail --user=@var{user}
To read messages from the system mailbox belonging to @var{user}.
@end table
@emph{Please note}, that usual mailbox permissions won't allow you
to use the last variant of invocation, unless you are a super-user.
Similarly, the last but one variant is also greatly affected by the
permissions the target mailbox has.
Notice that @var{path_to_mailbox} is not an argument to
@option{--file} (@option{-f}) option, but rather the first
non-optional argument on the command line. Therefore, the
following three invocations are equivalent:
@example
$ mail -fin mymbox
$ mail -f mymbox -in
$ mail --file -in mymbox
$ mail --file -i mymbox -n
@end example
Additionally, for conformance to the GNU standards, the
following form is also accepted:
@example
$ mail --file=mymbox -i -n
@end example
Unless you have started mail with @option{--norc} command line option,
it will read the contents of the system-wide configuration file.
Then it reads the contents of user configuration file, if any.
For detailed description of these files, see @ref{Mail Configuration Files}.
After this initial setup, @command{mail} displays the first page of header
lines and enters interactive mode. In interactive mode, @command{mail}
displays its prompt (@samp{?}, if not set otherwise) and executes the
commands the user enters.
@menu
* Quitting the Program::
* Obtaining Online Help::
* Moving Within a Mailbox::
* Changing mailbox/directory::
* Controlling Header Display::
* Displaying Information::
* Displaying Messages::
* Marking Messages::
* Disposing of Messages::
* Saving Messages::
* Editing Messages::
* Aliasing::
* Replying::
* Controlling Sender Fields::
* Incorporating New Mail::
* Shell Escapes::
@end menu
@c **********************************
@node Quitting the Program
@subsubsection Quitting the Program
Following commands quit the program:
@table @samp
@item quit
Terminates the session. If @command{mail} was operating upon user's system
mailbox, then all undeleted and unsaved messages that have been read and
are not marked with hold flag are saved to the user's mbox file
(@file{$HOME/mbox}). The messages, marked with @code{delete} are removed.
The program exits to the Shell, unless saving the mailbox fails, in
which case user can escape with the exit command.
@item exit
@itemx ex
@itemx xit
Program exits to the Shell without modifying the mailbox it operates
upon.
@end table
Typing EOF (@samp{C-D}) alone is equivalent to @samp{quit}.
@node Obtaining Online Help
@subsubsection Obtaining Online Help
@kyindex help, mail command
@kyindex ?, mail command
@kyindex list, mail command
@kyindex version, mail command
@kyindex warranty, mail command
Following commands can be used during the session to request online
help:
@table @samp
@item help [@var{command}]
@itemx hel [@var{command}]
@itemx ? [@var{command}]
Display detailed command synopsis. If no @var{command} is given, help for
all available commands is displayed.
@item list
@itemx *
Print a list of available commands.
@item version
@itemx ve
Display program version.
@item warranty
@itemx wa
Display program warranty statement.
@end table
@node Moving Within a Mailbox
@subsubsection Moving Within a Mailbox
@kyindex next, mail command
@kyindex prev, mail command
@table @samp
@item ^
Move to the first undeleted message.
@item $
Move to the last undeleted message.
@item next
@itemx n
Move to the next message.
@item previous
@itemx prev
Move to the previous message.
@end table
@node Changing mailbox/directory
@subsubsection Changing Mailbox/Directory
@kyindex chdir, mail command
@kyindex file, mail command
@kyindex folder, mail command
@table @samp
@item cd [@var{dir}]
@itemx chdir [@var{dir}]
@itemx ch [@var{dir}]
Change to the specified directory. If @var{dir} is omitted, @env{$HOME} is
assumed.
@item file [@var{mailbox}]
@itemx fi [@var{mailbox}]
@itemx folder [@var{mailbox}]
@itemx fold [@var{mailbox}]
Read in the contents of the specified @var{mailbox}. The current mailbox
is updated as if @code{quit} command has been issued.
If @var{mailbox} is omitted, the command prints the current mailbox
name followed by the summary information regarding it, e.g.:
@example
@cartouche
& fold
"/var/spool/mail/gray": 23 messages 22 unread
@end cartouche
@end example
@end table
@node Controlling Header Display
@subsubsection Controlling Header Display
@kyindex discard, mail command
@kyindex ignore, mail command
@kyindex retain, mail command
To control which headers in the message should be displayed, @command{mail}
keeps two lists: a @dfn{retained} header list and an @dfn{ignored}
header list. If @dfn{retained} header list is not empty, only the
header fields listed in it are displayed when printing the message.
Otherwise, if @dfn{ignored} header list is not empty, only the headers
@emph{not listed} in this list are displayed. The uppercase variants
of message-displaying commands can be used to print all the headers.
The following commands modify and display the contents of both lists.
@table @samp
@item discard [@var{header-field-list}]
@itemx di [@var{header-field-list}]
@itemx ignore [@var{header-field-list}]
@itemx ig [@var{header-field-list}]
Add @var{header-field-list} to the ignored list. When used without
arguments, this command prints the contents of ignored list.
@item retain [@var{header-field-list}]
@itemx ret [@var{header-field-list}]
Add @var{header-field-list} to the retained list. When used without
arguments, this command prints the contents of retained list.
@end table
@node Displaying Information
@subsubsection Displaying Information
@kyindex =, mail command
@kyindex headers, mail command
@kyindex from, mail command
@kyindex z, mail command
@kyindex size, mail command
@kyindex folders, mail command
@kyindex summary, mail command
@table @samp
@item =
Displays the current message number.
@item headers [@var{msglist}]
@itemx h [@var{msglist}]
Lists the current pageful of headers.
@item from [@var{msglist}]
@itemx f [@var{msglist}]
Lists the contents of @samp{From} headers for a given set of messages.
@item z [@var{arg}]
Presents message headers in pagefuls as described for @code{headers}
command. When @var{arg} is @samp{.}, it is generally equivalent to
@code{headers}. When @var{arg} is omitted or is @samp{+}, the next
pageful of headers is displayed. If @var{arg} is @samp{-}, the
previous pageful of headers is displayed. The latter two forms
of @code{z} command may also take a numerical argument meaning the
number of pages to skip before displaying the headers. For
example:
@example
& z +2
@end example
@noindent
will skip two pages of messages before displaying the header summary.
@item size [@var{msglist}]
@itemx si [@var{msglist}]
Lists the message number and message size in bytes for each message in
@var{msglist}.
@item folders
Displays the value of @code{folder} variable.
@item summary
@itemx su
Displays current mailbox summary. E.g.:
@example
@cartouche
& summary
"/var/spool/mail/gray": 23 messages 22 unread
@end cartouche
@end example
@end table
@node Displaying Messages
@subsubsection Displaying Messages
@kyindex print, mail command
@kyindex type, mail command
@kyindex Print, mail command
@kyindex Type, mail command
@kyindex decode, mail command
@kyindex struct, mail command
@kyindex top, mail command
@kyindex pipe, mail command
@kyindex |, mail command
@table @samp
@item print [@var{msglist}]
@itemx p [@var{msglist}]
@item type [@var{msglist}]
@itemx t [@var{msglist}]
Prints out the messages from @var{msglist}. The variable @code{crt}
determines the minimum number of lines the body of the message must
contain in order to be piped through pager command specified
by environment variable @code{PAGER}. If @code{crt} is set to a numeric
value, this value is taken as the minimum number of lines. Otherwise,
if @code{crt} is set without a value then the height of the terminal
screen is used to compute the threshold. The number of lines on
screen is controlled by @code{screen} variable.
@item Print [@var{msglist}]
@itemx P [@var{msglist}]
@itemx Type [@var{msglist}]
@itemx T [@var{msglist}]
Like print but also prints out ignored header fields.
@item decode [@var{msglist}]
@itemx dec [@var{msglist}]
Print a multipart message. The @code{decode} command decodes and prints
out specified message parts. E.g.
@example
@cartouche
& decode 15[2]
+---------------------------------------
| Message=15[2]
| Type=message/delivery-status
| encoding=7bit
+---------------------------------------
Content-Type: message/delivery-status
...
@end cartouche
@end example
@item top [@var{msglist}]
@itemx to [@var{msglist}]
Prints the top few lines of each message in @var{msglist}. The number
of lines printed is controlled by the variable @code{toplines} and
defaults to five.
@item pipe [@var{msglist}] [@var{shell-command}]
@itemx | [@var{msglist}] [@var{shell-command}]
Pipe the contents of specified messages through @var{shell-command}. If
@var{shell-command} is empty but the string variable @code{cmd} is set,
the value of this variable is used as a command name.
@item struct [@var{msglist}]
Prints the @acronym{MIME} structure of each message from
@var{msglist}. Empty @var{msglist} means current message.
Example:
@example
@cartouche
& struct 2
2 multipart/mixed 14k
2[1] text/plain 296
2[2] application/octet-stream 5k
2[3] text/x-diff 31k
@end cartouche
@end example
@end table
@node Marking Messages
@subsubsection Marking Messages
@kyindex tag, mail command
@kyindex hold, mail command
@kyindex preserve, mail command
@table @samp
@item tag [@var{msglist}]
@itemx ta [@var{msglist}]
Tag messages. The tagged messages can be referred to in message list
using @samp{:t} notation.
@item untag [@var{msglist}]
@itemx unt [@var{msglist}]
Clear tags from specified messages. To untag all messages tagged so far
type
@example
& untag :t
@end example
@item hold [@var{msglist}]
@itemx ho [@var{msglist}]
@itemx preserve [@var{msglist}]
@itemx pre [@var{msglist}]
Marks each message to be held in user's system mailbox. This command
does not override the effect of @code{delete} command.
@end table
@node Disposing of Messages
@subsubsection Disposing of Messages
@kyindex delete, mail command
@kyindex undelete, mail command
@kyindex dt, mail command
@kyindex dp, mail command
@table @samp
@item delete [@var{msglist}]
@itemx d [@var{msglist}]
Mark messages as deleted. Upon exiting with @code{quit} command these
messages will be deleted from the mailbox. Until the end of current
session the deleted messages can be referred to in message lists using
:d notation.
@item undelete [@var{msglist}]
@itemx u [@var{msglist}]
Clear delete mark from the specified messages.
@item dp [@var{msglist}]
@itemx dt [@var{msglist}]
Deletes the current message and prints the next message. If
@var{msglist} is specified, deletes all messages from the list and
prints the message, immediately following last deleted one.
@end table
@node Saving Messages
@subsubsection Saving Messages
@kyindex save, mail command
@kyindex Save, mail command
@kyindex write, mail command
@kyindex Write, mail command
@kyindex mbox, mail command
@kyindex touch, mail command
@kyindex copy, mail command
@kyindex Copy, mail command
@table @samp
@item save [[@var{msglist}] @var{file}]
@itemx s [[@var{msglist}] @var{file}]
Takes a message list and a file name or mailbox URL and appends each
message in turn to the end of that file or mailbox. Mailbox URLs
begin with mailbox type specifier, such as @samp{mbox://},
@samp{maildir://}, etc. The name of file or mailbox and number of
lines and characters appended to it is echoed on the terminal. When
writing to file, the numbers represent exact number of lines and
characters appended to the file. When @var{file} specifies a mailbox,
these numbers may differ by the amount of lines/characters needed to
represent message envelope for that specific mailbox type.
Each saved message is marked for deletion as if with @code{delete}
command, unless the variable @code{keepsave} is set.
@item Save [@var{msglist}]
@itemx S [@var{msglist}]
Like @code{save}, but the file to append messages to is named after the
sender of the first message in @var{msglist}. For example:
@example
@cartouche
@group
& from 14 15
U 14 smith@@noldor.org Fri Jun 30 18:11 14/358 The Save c
U 15 gray@@noldor.org Fri Jun 30 18:30 8/245 Re: The Sa
& Save 14 15
"smith" 22/603
@end group
@end cartouche
@end example
@noindent
i.e., 22 lines (603 characters) have been appended to the file ``smith''.
If the file does not exist, it is created.
@item write [[@var{msglist}] @var{file}]
@itemx w [[@var{msglist}] @var{file}]
Similar to @code{save}, except that only message body (without the
header) is saved.
@item Write [@var{msglist}]
@itemx W [@var{msglist}]
Similar to @code{Save}, except that only message body (without the
header) is saved.
@item mbox [@var{msglist}]
@itemx mb [@var{msglist}]
@itemx touch [@var{msglist}]
@itemx tou [@var{msglist}]
Mark list of messages to be saved in the user's mailbox (@file{$HOME/mbox})
upon exiting via @code{quit} command. This is the default action for
all read messages, unless you have variable @code{hold} set.
@item copy [[@var{msglist}] @var{file}]
@itemx c [[@var{msglist}] @var{file}]
Similar to @code{save}, except that saved messages are not marked for
deletion.
@item Copy [@var{msglist}]
@itemx C [@var{msglist}]
Similar to @code{Save}, except that saved messages are not marked for
deletion.
@end table
@node Editing Messages
@subsubsection Editing Messages
@kyindex edit, mail command
@kyindex visual, mail command
These command allow to edit messages in a mailbox. @emph{Please note},
that modified messages currently do not replace original ones. i.e.
you have to save them explicitly using your editor's @code{save}
command if you do not want the effects of your editing to be lost.
@table @samp
@item edit [@var{msglist}]
@itemx e [@var{msglist}]
Edits each message in @var{msglist} with the editor, specified in
@code{EDITOR} environment variable.
@item visual [@var{msglist}]
@itemx v [@var{msglist}]
Edits each message in @var{msglist} with the editor, specified in
@code{VISUAL} environment variable.
@end table
@node Aliasing
@subsubsection Aliasing
@kyindex alias, mail command
@kyindex group, mail command
@kyindex unalias, mail command
@kyindex alternates, mail command
@table @samp
@item alias [alias [@var{address}...]]
@itemx a [alias [@var{address}...]]
@itemx group [alias [@var{address}...]]
@itemx g [alias [@var{address}...]]
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.
@item unalias [@var{alias}...]
@itemx una [@var{alias}...]
Takes a list of names defined by alias commands and discards the
remembered groups of users. The alias names no longer have any
significance.
@item alternates @var{name}...
@itemx alt @var{name}...
The alternates command is useful if you have accounts on several
machines. It can be used to inform mail that the listed addresses are
really you. When you reply to messages, mail 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.
@end table
@node Replying
@subsubsection Replying
@kyindex mail, mail command
@kyindex reply, mail command
@kyindex Reply, mail command
@kyindex respond, mail command
@kyindex Respond, mail command
@kyindex followup, mail command
@kyindex Followup, mail command
@table @samp
@item mail [@var{address}...]
@itemx m [@var{address}...]
Switches to compose mode. After composing the message, sends messages to
the specified addresses.
@item reply [@var{msglist}]
@itemx respond [@var{msglist}]
@itemx r [@var{msglist}]
For each message in @var{msglist}, switches to compose mode and sends
the composed message to the sender and all recipients of the message.
@item Reply [@var{msglist}]
@itemx Respond [@var{msglist}]
@itemx R [@var{msglist}]
Like @code{reply}, except that the composed message is sent only to
originators of the specified messages.
Notice, that setting mail variable @code{flipr} (@pxref{Mail
Variables}) swaps the meanings of the two above commands,
so that @code{reply} sends the message to the sender and all
recipients of the message, whereas @code{Reply} sends it to
originators only.
@item followup [@var{msglist}]
@itemx fo [@var{msglist}]
Switches to compose mode. After composing, sends the message to the
originators and recipients of all messages in @var{msglist}.
@item Followup [@var{msglist}]
@itemx F [@var{msglist}]
Similar to @code{followup}, but reply message is sent only to
originators of messages in @var{msglist}.
@end table
To determine the sender of the message @command{mail} uses the
list of sender fields (@pxref{Controlling Sender Fields}). The first field
from this list is looked up in message headers. If it is found
and contains a valid email address, this address is used as
the sender address. If not, the second field is searched and
so on. This process continues until a field is found in the
headers, or the sender field list is exhausted, whichever happens
first.
If the previous step did not determine the sender address, the
address from SMTP envelope is used.
Let's illustrate this. Suppose your mailbox contains the following:
@example
@cartouche
U 1 block@@helsingor.org Fri Jun 30 18:30 8/245 Re: The Sa
& Print 1
From: Antonius Block <block@@helsingor.org>
To: Smeden Plog <plog@@helsingor.org>
Date: Tue, 27 Apr 2004 13:23:41 +0300
Reply-To: <root@@helsingor.org>
Subject: News
Hi
@end cartouche
@end example
@noindent
Now, you issue the following commands:
@example
@cartouche
& sender mail-followup-to reply-to from
& reply
To: <root@@helsingor.org>
Subject: Re: News
@end cartouche
@end example
@noindent
As you see, the value of @code{Reply-To} field was taken as the
sender address.
Now, let's try the following command sequence:
@example
# Clear the sender list
& nosender
# Set new sender list
& sender From
@end example
@noindent
Now, the @code{From} address will be taken:
@example
@cartouche
& reply
To: Antonius Block <block@@helsingor.org>
Subject: Re: News
@end cartouche
@end example
@node Controlling Sender Fields
@subsubsection Controlling Sender Fields
@kyindex sender, mail command
@kyindex nosender, mail command
Commands @code{sender} and @code{nosender} are used to manipulate
the contents of the sender field list.
If the command @code{sender} is used without arguments, it displays
the contents of the sender field list. If arguments are given,
each argument is appended to the sender field list. For example:
@example
@cartouche
& sender
Sender address is obtained from the envelope
& sender mail-followup-to reply-to
& sender
mail-followup-to
reply-to
& sender from
& sender
mail-followup-to
reply-to
from
@end cartouche
@end example
Command @code{nosender} is used to remove items from the sender
field list:
@example
@cartouche
& sender
mail-followup-to
reply-to
from
& nosender reply-to
& sender
mail-followup-to
from
@end cartouche
@end example
When used without arguments, this command clears the list:
@example
@cartouche
& nosender
Sender address is obtained from the envelope
@end cartouche
@end example
@node Incorporating New Mail
@subsubsection Incorporating New Mail
@kyindex incorporate, mail command
The @code{incorporate} (@code{inc}) command incorporates newly arrived
messages to the displayed list of messages. This is done automatically
before returning to @command{mail} command prompt if the variable
@code{autoinc} is set.
@node Shell Escapes
@subsubsection Shell Escapes
@kyindex shell, mail command
@kyindex !, mail command
To run arbitrary shell command from @command{mail} command prompt, use
@code{shell} (@code{sh}) command. If no arguments are specified, the
command starts the user login shell. Otherwise, it uses its first
argument as a file name to execute and all subsequent arguments are
passed as positional parameters to this command. The @code{shell}
command can also be spelled as @code{!}.
@c **********************************
@node Scripting
@subsection Scripting
@subsubheading Comments
The @samp{#} character introduces an end-of-line comment. All characters
until and including the end of line are ignored.
@subsubheading Displaying Arbitrary Text
@kyindex echo, mail command
The @samp{echo} (@samp{ec}) command prints its arguments to stdout.
@subsubheading Sourcing External Command Files
@kyindex source, mail command
The command @samp{source @var{filename}} reads commands from the named
file. Its minimal abbreviation is @samp{so}.
@anchor{Setting and Unsetting the Variables}
@subsubheading Setting and Unsetting the Variables
@kyindex set, mail command
@kyindex unset, mail command
The mail variables are set using @samp{set} (@samp{se}) command. The
command takes a list of assignments. The syntax of an assignment is
@table @samp
@item @var{name}=@var{string}
Assign a string value to the variable. If @var{string} contains
whitespace characters it must be enclosed in a pair of
double-quote characters (@samp{"})
@item @var{name}=@var{number}
Assign a numeric value to the variable.
@item @var{name}
Assign boolean @code{True} value.
@item no@var{name}
Assign boolean @code{False} value.
@end table
Example:
@example
& set askcc nocrt indentprefix="> "
@end example
@noindent
This statement sets @code{askcc} to @code{True}, @code{crt} to
@code{False}, and @code{indentprefix} to ``> ''.
To unset mail variables use @samp{unset}(@samp{uns}) command. The
command takes a list of variable names to unset.
Example:
To undo the effect of the previous example, do:
@example
& unset askcc crt indentprefix
@end example
When used without arguments, both @command{set} or @command{unset}
list all currently defined variables. The form of this listing is
controlled by @code{variable-pretty-print} (@code{varpp}) variable. If
it is set, a description precedes each variable, e.g.:
@example
# prompt user for subject before composing the message
ask
# prompt user for cc before composing the message
askcc
# output character set for decoded header fields
charset="auto"
# number of columns on terminal screen
columns=80
@end example
If @code{variable-pretty-print} is not set, only the settings are
shown, e.g.:
@example
ask
askcc
charset="auto"
columns=80
@end example
@kyindex variable, mail command
A special command is provided to list all internal @command{mail}
variables:
@example
variable [@var{names...}]
@end example
If used without arguments, it prints all known internal variables. If
arguments are given, it displays only those internal variables that
are listed in command line. For each variable, this command prints its
name, data type, current value and a short description. For example:
@example
& variable ask datefield
ask, asksub
Type: boolean
Current value: yes
prompt user for subject before composing the message
datefield
Type: boolean
Current value: [not set]
get date from the `Date:' header, instead of the envelope
@end example
@subsubheading Setting and Unsetting Shell Environment Variables
Shell environment may be modified using @samp{setenv} (@samp{sete})
command. The command takes a list of assignments. The syntax of an
assignment is:
@table @samp
@item @var{name}=@var{value}
If variable @var{name} does not already exist in the environment,
then it is added to the environment with the value @var{value}.
If @var{name} does exist, then its value in the environment is
changed to @var{value}.
@item @var{name}
Delete the variable @var{name} from the environment (``unset'' it).
@end table
@subsubheading Conditional Statements
@kyindex if, mail command
@kyindex else, mail command
@kyindex endif, mail command
The conditional statement allows to execute a set of mail commands
depending on the mode the @command{mail} program is in. The conditional
statement is:
@example
if @var{cond}
...
else
...
endif
@end example
@noindent
where @samp{...} represents the set of commands to be executed in each
branch of the statement. @var{cond} can be one of the following:
@table @samp
@item s
True if @command{mail} is operating in mail sending mode.
@item r
True if @command{mail} is operating in mail reading mode.
@item t
True if stdout is a terminal device (as opposed to a regular file).
@end table
The conditional statements can be nested to arbitrary depth. The minimal
abbreviations for @samp{if}, @samp{else} and @samp{endif} commands are
@samp{i}, @samp{el} and @samp{en}.
Example:
@example
if t
set crt prompt="& "
else
unset prompt
endif
if s
alt gray@@farlep.net gray@@mirddin.farlep.net
set
@end example
@node Mail Variables
@subsection How to Alter the Behavior of @command{mail}
Following variables control the behavior of GNU @command{mail}:
@table @code
@kwindex append
@item append
@*Type: Boolean, Read-Only
@*Default: True
@vrindex append, mail variable
Messages saved in mbox are appended to the end rather than prepended.
This is the default and cannot be changed. This variable exists only
for compatibility with other @command{mailx} implementations.
@kwindex appenddeadletter
@item appenddeadletter
@*Type: Boolean.
@*Default: False.
@vrindex appenddeadletter, mail variable
If this variable is @code{True}, the contents of canceled letter is
appended to the user's @file{dead.letter} file. Otherwise it overwrites
its contents.
@kwindex askbcc
@item askbcc
@*Type: Boolean.
@*Default: False.
@vrindex askbcc, mail variable
When set to @code{True} the user will be prompted to enter @code{Bcc}
field before composing the message.
@kwindex askcc
@item askcc
@*Type: Boolean.
@*Default: True.
@vrindex askcc, mail variable
When set to @code{True} the user will be prompted to enter @code{Cc}
field before composing the message.
@kwindex asksub
@item asksub
@*Type: Boolean.
@*Default: True in interactive mode, False otherwise.
@vrindex asksub, mail variable
When set to @code{True} the user will be prompted to enter @code{Subject}
field before composing the message.
@kwindex autoinc
@item autoinc
@*Type: Boolean.
@*Default: True.
@vrindex autoinc, mail variable
Automatically incorporate newly arrived messages.
@kwindex autoprint
@item autoprint
@*Type: Boolean.
@*Default: False.
@vrindex autoprint, mail variable
Causes the delete command to behave like dp - thus, after deleting a
message, the next one will be typed automatically.
@kwindex bang
@item bang
@*Type: Boolean.
@*Default: False.
@vrindex bang, mail variable
When set, every occurrence of @code{!} in arguments to @code{!}
command is replaced with the last executed command.
@anchor{byname}
@kwindex byname
@item byname
@*Type: Boolean
@*Default: Unset
@vrindex byname, mail variable
Record outgoing messages in a file named after the first recipient.
The name is the login-name portion of the address found first on the
@samp{To:} line in the mail header. This variable overrides the
@samp{record} variable.
It is set by the @option{--byname} (@option{-F}) command line option.
@anchor{datefield}
@kwindex datefield
@item datefield
@*Type: Boolean.
@*Default: False.
@vrindex datefield, mail variable
By default the date in a header summary is taken from the @acronym{SMTP}
envelope of the message. Setting this variable tells @command{mail}
to use the date from @code{Date:} header field, converted to
local time. Notice, that for messages lacking this field @command{mail}
will fall back to using @acronym{SMTP} envelope.
@xref{fromfield}.
@kwindex charset
@item charset
@*Type: string
@*Default: @samp{auto}
@vrindex charset, mail variable
The value of this variable controls the output character set for the
header fields encoding using RFC 2047. If the variable is unset, no
decoding is performed and the fields are printed as they are. If the
variable is set to @samp{auto}, @command{mail} tries to deduce the
name of the character set from the value of @code{LC_ALL} environment
variable. Otherwise, its value is taken as the name of the charset.
@kwindex cmd
@item cmd
@*Type: String.
@*Default: Unset.
@vrindex cmd, mail variable
Contains default shell command for @code{pipe}.
@kwindex columns
@item columns
@*Type: Numeric.
@*Default: Detected at startup by querying the terminal device. If this
fails, the value of environment variable @code{COLUMNS} is used.
@vrindex columns, mail variable
This variable contains the number of columns on terminal screen.
@kwindex crt
@item crt
@*Type: Boolean or Numeric
@*Default: True in interactive mode, False otherwise.
@vrindex crt, mail variable
The variable @code{crt} determines the minimum number of lines the body
of the message must contain in order to be piped through pager command
specified by environment variable @code{PAGER}. If @code{crt} is set
to a numeric value, this value is taken as the threshold. Otherwise,
if @code{crt} is set without a value, then the height of the terminal
screen is used to compute the threshold. The number of lines on
screen is controlled by @code{screen} variable.
@kwindex debug
@item debug
@*Type: String to boolean
@*Default: Not set
@vrindex debug, mail variable
Sets mailutils debug level. If set to string, the value must be a
valid Mailutils debugging specification. @xref{Debug Statement}, for
a description.
If unset (i.e. @code{set nodebug}), clears and disables all debugging
information. If set to @samp{true} (i.e. @code{set debug}), sets
maximum debugging (@samp{<trace7}) on mailbox and its underlying
objects.
@kwindex decode-fallback
@item decode-fallback
@*Type: String.
@*Default: @samp{none}.
@vrindex decode-fallback, mail variable
This variable controls the way to represent characters that cannot
be rendered using current character set. It can have three values:
@table @samp
@item none
Such characters are not printed at all. The conversion process stops
at the first character that cannot be rendered.
@item copy-pass
The characters are displayed @samp{as is}. Notice, that depending on
your setup, this may screw-up your terminal settings.
@item copy-octal
Unprintable characters are represented by their octal codes. Printable
ones are printed @samp{as is}.
@end table
@kwindex debug
@item debug
@*Type: Boolean
@*Default: Unset
@vrindex debug, mail variable
This variable is not used. It exists for compatibility with other
@command{mailx} implementations and for future use.
@kwindex dot
@item dot
@*Type: Boolean.
@*Default: False.
@vrindex dot, mail variable
If @code{True}, causes @command{mail} to interpret a period alone on a line as the
terminator of a message you are sending.
@kwindex emptystart
@item emptystart
@*Type: Boolean.
@*Default: False.
@vrindex emptystart, mail variable
If the mailbox is empty, @command{mail} normally prints @samp{No mail for user} and
exits immediately. If this option is set, @command{mail} will start no matter is
the mailbox empty or not.
@kwindex editheaders
@item editheaders
@*Type: Boolean.
@*Default: False.
@vrindex editheaders, mail variable
When set, @command{mail} will include message headers in the text to
be the @code{~e} and @code{~v} escapes, thus allowing you to customize
the headers.
@kwindex escape
@item escape
@*Type: String.
@*Default: ~
@vrindex escape, mail variable
If defined, the first character of this option gives the character to
denoting escapes.
@kwindex flipr
@item flipr
@*Type: Boolean
@*Default: Unset
@vrindex flipr, mail variable
If set, the variable @code{flipr} swaps the meanings of @code{reply}
and @code{Reply} commands (@pxref{Replying}).
@kwindex folder
@item folder
@*Type: String.
@*Default: Unset.
@vrindex folder, mail variable
The name of the directory to use for storing folders of messages. If
unset, @env{$HOME} is assumed.
@anchor{fromfield}
@kwindex fromfield
@item fromfield
@*Type: Boolean.
@*Default: True.
By default the sender address is taken from the @samp{From} header.
Unsetting this variable tells @command{mail} to obtain it from the
@acronym{SMTP} envelope, instead.
@xref{datefield}.
@kwindex header
@item header
@*Type: Boolean.
@*Default: True, unless started with @option{--nosum} (@option{-N}) option.
@vrindex header, mail variable
Whether to run @code{headers} command automatically after entering
interactive mode.
@kwindex headline
@item headline
@*Type: String
@*Default: @samp{%>%a%4m %18f %16d %3l/%-5o %s}
A format string to use for the header summary. The @samp{%} character
introduces a @dfn{format specifier}. Valid format specifiers are:
@multitable @columnfractions 0.2 0.8
@headitem Letter @tab Meaning
@item %a @tab Message attributes.
@item %d @tab The date when the message was received.
@item %f @tab The address of the message sender.
@item %l @tab The number of lines of the message.
@item %m @tab Message number.
@item %o @tab The number of octets (bytes) in the message.
@item %s @tab Message subject (if any).
@item %S @tab Message subject (if any) in double quotes.
@item %> @tab A @samp{>} for the current message, otherwise a space.
@item %< @tab A @samp{<} for the current message, otherwise a space.
@item %% @tab A `%' character.
@end multitable
Some additional symbols are allowed between @samp{%} and the specifier
letter. The @samp{-} character immediately following @samp{%}
indicates that this field should be left aligned. Similarly, the
@samp{+} character indicates right alignment. Default alignment
depends on the type of the specifier: the specifiers that produce
numeric values (@samp{%l}, @samp{%m}, and @samp{%o}) are aligned to
the right, whereas the ones producing string values are aligned to the
left.
A number following @samp{%} or the alignment flag, indicates the
field width. Consider, for example, the following specifiers:
@table @asis
@item %m
Print current message number. Take as much screen columns as necessary
to output it.
@item %4m
@itemx %+4m
Print current message number. Occupy 4 screen columns, truncate the
output if it does not fit that width. Align the output to the right.
@item %-4m
Same as above, but align to the left.
@end table
@kwindex hold
@item hold
@*Type: Boolean.
@*Default: False.
@vrindex hold, mail variable
When set to @code{True}, the read or saved messages will be stored in
user's mailbox (@file{$HOME/mbox}). Otherwise, they will be held in
system mailbox also. This option is in effect only when operating
upon user's system mailbox.
@kwindex ignore
@item ignore
@*Type: Boolean.
@*Default: False.
@vrindex ignore, mail variable
When set to @code{True}, @command{mail} will ignore keyboard interrupts
when composing messages. Otherwise an interrupt will be taken as a
signal to abort composing.
@kwindex ignoreeof
@item ignoreeof
@*Type: Boolean.
@*Default: False.
@vrindex ignoreeof, mail variable
Controls whether typing EOF character terminates the letter being
composed.
@kwindex indentprefix
@item indentprefix
@*Type: String.
@*Default: "\t" (a tab character).
@vrindex indentprefix, mail variable
String used by the @code{~m} tilde escape for indenting quoted messages.
@kwindex inplacealiases
@item inplacealiases
@*Type: Boolean
@*Default: False
If set, @command{mail} will expand aliases in the address header field
before entering send mode (@pxref{Composing Mail}). By default, the
address header fields are left intact while composing, the alias
expansion takes place immediately before sending message.
@kwindex keep
@item keep
@*Type: Boolean, Read-Only
@*Default: True
@vrindex append, mail variable
Truncate the user's system mailbox when it is empty, instead of
removing it. This is the default and cannot be changed. This variable
exists only for compatibility with other @command{mailx} implementations.
@kwindex keepsave
@item keepsave
@*Type: Boolean.
@*Default: False.
@vrindex keepsave, mail variable
Controls whether saved messages should be kept in system mailbox too.
This variable is in effect only when operating upon a user's system
mailbox.
@kwindex mailx
@item mailx
@*Type: Boolean.
@*Default: False.
@vrindex mailx, mail variable
When set, enables @dfn{mailx compatibility mode}. This mode
has the following effects:
@itemize @bullet
@item When composing a message @command{mail} will ask
for @code{Cc} and @code{Bcc} addresses after composing the body.
The default behavior is to ask for these values before composing
the body.
@item In send mode, if the composition was interrupted, @command{mail}
will exit with zero status. By default it exits with zero status only
if the message was sent successfully.
@end itemize
@kwindex metamail
@item metamail
@*Type: Boolean or String.
@*Default: True.
@vrindex metamail, mail variable
This variable controls operation of @code{decode} command. If
it is unset, @code{decode} will not attempt any interpretation
of the content of message parts. Otherwise, if @code{metamail}
is set to @code{true}, @code{decode} will use internal metamail
support to interpret message parts. Finally, if @code{metamail}
is assigned a string, this string is treated as command line of
the external @command{metamail} command which will be used to
display parts of a multipart message. For example:
@example
# Disable MIME interpretation:
set nometamail
# Enable built-in MIME support:
set metamail
# Use external program to display MIME parts:
set metamail="metamail -m mail -p"
@end example
@kwindex mimenoask
@item mimenoask
@*Type: String
@*Default: Empty
@vrindex mimenoask, mail variable
By default @command{mail} asks for confirmation before running
interpreter to view a part of the multi-part message. If this variable
is set, its value is treated as a comma-separated list of MIME types
for which no confirmation is needed. Elements of this list may include
shell-style globbing patterns, e.g. setting
@example
set mimenoask=text/*,image/jpeg
@end example
@noindent
will disable prompting before displaying any textual files, no
matter what their subtype is, and before displaying files with
type @samp{image/jpeg}.
@kwindex metoo
@item metoo
@*Type: Boolean.
@*Default: False.
@vrindex metoo, mail variable
Usually, when an alias is expanded that contains the sender, the sender
is removed from the expansion. Setting this option causes the sender to
be included in the group.
@kwindex mode
@item mode
@*Type: String, Read-Only
@*Default: The name of current operation mode.
@vrindex mode, mail variable
This variable keeps the name of the current operation mode. Its
possible values are:
@table @asis
@item headers
The program is started with the @option{--headers} (@option{-H}) command
line option (@pxref{Invoking Mail}).
@item exist
The program is started with the @option{--exist} (@option{-e}) command
line option (@pxref{Invoking Mail}).
@item print
The program is started with the @option{--print} (@option{-p}) command
line option (@pxref{Invoking Mail}).
@item read
The progran operates in read mode. This is the default.
@item send
The program operates in send mode. This means it was given one or more
recipient addresses in the command line.
@end table
@kwindex nullbody
@item nullbody
@* Type: Boolean
@* Default: True
@vrindex nullbody, mail variable
Controls whether @command{mail} accepts messages with an empty
body. The default value, @code{true}, means such messages are sent,
and a warning (traditionally saying @samp{Null message body; hope
that's ok}) is displayed. The text of the warning can be set using
@code{nullbodymsg} variable (see below).
If @code{nullbody} is unset, @command{mail} will silently ignore such
messages. This can be useful in @file{crontab} files, to avoid sending
mails when nothing important happens. For example, the @file{crontab}
entry below will send mail only if the utility @command{some-prog}
outputs something on its standard output or error:
@example
@group
*/5 * * * * some-prog 2>&1 | \
/bin/mail -E'set nonullbody' -s 'Periodic synchronization'
@end group
@end example
@kwindex showenvelope
@item showenvelope
@*Type: Boolean
@*Default: Unset
If this variable is set, the @code{print} command will include the
@acronym{STMP} envelope in its output.
@kwindex nullbodymsg
@item nullbodymsg
@*Type: String
@*Default: Null message body; hope that's ok
@vrindex nullbodymsg
Keeps the text of the warning, displayed by @command{mail} before
sending an empty message. When available, the translation of
this text, in accordance with the current locale, is displayed.
Unsetting this variable disables the warning.
@kwindex onehop
@item onehop
@*Type: Boolean
@*Default: Unset
@vrindex onehop, mail variable
This variable is not used. It exists for compatibility with other
@command{mailx} implementations and for future use.
@kwindex outfolder
@item outfolder
@*Type: String.
@*Default: Unset.
@vrindex outfolder, mail variable
Contains the directory in which files created by @code{save},
@code{write}, etc. commands will be stored. When unset, current
directory is assumed.
@kwindex page
@item page
@*Type: Boolean.
@*Default: False.
@vrindex page, mail variable
If set to @code{True}, the @code{pipe} command will emit a linefeed
character after printing each message.
@kwindex prompt
@item prompt
@*Type: String.
@*Default: "? "
@vrindex prompt, mail variable
Contains the command prompt sequence.
@kwindex quiet
@item quiet
@*Type: Boolean
@*Default: Unset
@vrindex quiet, mail variable
This variable is not used. It exists for compatibility with other
@command{mailx} implementations and for future use.
@kwindex quit
@item quit
@*Type: Boolean.
@*Default: False, unless started with @option{--quit} (@option{-q}) option.
@vrindex quit, mail variable
When set, causes keyboard interrupts to terminate the program.
@kwindex rc
@item rc
@*Type: Boolean.
@*Default: True, unless started with @option{--norc} (@option{-N}) option.
@vrindex rc, mail variable
When this variable is set, @command{mail} will read the system-wide
configuration file upon startup. See @ref{Mail Configuration Files}.
@kwindex readonly
@item readonly
@*Type: Boolean
@*Default: False
@vrindex readonly, mail variable
When set, mailboxes are opened in readonly mode. In this mode, any
@command{mail} commands that alter the contents of the mailbox are
disabled. These commands include, but are not limited to:
@code{delete}, @code{save} and @code{mbox}.
@kwindex record
@item record
@*Type: String.
@*Default: Unset.
@vrindex record, mail variable
When set, any outgoing message will be saved to the named file.
@kwindex recursivealiases
@item recursivealiases
@*Type: Boolean
@*Default: True
When set, @command{mail} will expand aliases recursively.
@kwindex regex
@item regex
@*Type: Boolean.
@*Default: True.
@vrindex regex, mail variable
Setting this to @code{True} enables use of regular expressions in
@samp{/.../} message specifications.
@kwindex replyprefix
@item replyprefix
@*Type: String
@*Default: @samp{Re: }
@vrindex replyprefix, mail variable
Sets the prefix that will be used when constructing the subject line
of a reply message.
@kwindex replyregex
@item replyregex
@*Type: String
@*Default: @samp{^re: *}
@vrindex replyregex, mail variable
Sets the regular expression used to recognize subjects of reply
messages. If the @code{Subject} header of the message matches this
expression, the value of @code{replyprefix} will not be prepended to
it before replying. The expression should be a POSIX extended regular
expression. The comparison is case-insensitive.
For example, to recognize usual English, Polish, Norwegian and German
reply subject styles, use:
@example
set replyregex="^(re|odp|aw|ang)(\\[[0-9]+\\])?:[[:blank:]]"
@end example
@noindent
(Notice the quoting of backslash characters).
@anchor{return-address}
@kwindex return-address
@item return-address
@*Type: String
@*Default: unset
@vrindex return-address, mail variable.
Sets the return email address to use when sending messages. If unset,
the address is composed from the current user name and the host name.
@kwindex save
@item save
@*Type: Boolean.
@*Default: True.
@vrindex save, mail variable
When set, the aborted messages will be stored in the user's
@file{dead.file}. See also @code{appenddeadletter}.
@kwindex screen
@item screen
@*Type: Numeric.
@*Default: Detected at startup by querying the terminal device. If this
fails, the value of environment variable @code{LINES} is used.
@vrindex screen, mail variable
This variable contains the number of lines on terminal screen.
@kwindex sendmail
@item sendmail
@*Type: String.
@*Default: sendmail:/usr/lib/sendmail
@vrindex sendmail, mail variable
Contains URL of the mail transport agent.
@kwindex sendwait
@item sendwait
@*Type: Boolean
@*Default: Unset
@vrindex sendwait, mail variable
This variable is not used. It exists for compatibility with other
@command{mailx} implementations and for future use.
@kwindex showto
@item showto
@*Type: Boolean
@*Default: False
@vrindex showto, mail variable
If the message was sent by the user, print its recipient address in
the header summary.
@kwindex Sign
@item Sign
@*Type: String.
@*Default: Unset.
@vrindex Sign, mail variable
Contains the filename holding users signature. The contents of this
file is appended to the end of a message being composed by @code{~A}
escape.
@kwindex sign
@item sign
@*Type: String.
@*Default: Unset.
@vrindex sign, mail variable
Contains the user's signature. The contents of this variable is appended
to the end of a message being composed by @code{~a} escape. Use
@code{Sign} variable, if your signature occupies more than one line.
@kwindex showto
@item showto
@*Type: Boolean
@*Default: unset
@vrindex showto, mail variable
If this variable is set, @command{mail} will show @code{To:} addresses
instead of @code{From:} for all messages that come from the user that
invoked the program.
@kwindex subject
@item subject
@*Type: String.
@*Default: Unset.
@vrindex subject, mail variable
Contains default subject line. This will be used when @code{asksub} is
off.
@kwindex toplines
@item toplines
@*Type: Numeric.
@*Default: 5
@vrindex toplines, mail variable
Number of lines to be displayed by @code{top} and @code{Top} commands.
@kwindex variable-strict
@item variable-strict
@itemx varstrict
@*Type: Boolean.
@*Default: False.
Setting this variable enables strict control over variable
settings. In this mode, @command{mail} refuses to set read-only
variables. Also, if the user is trying to set an unknown variable,
@command{mail} prints a warning.
@xref{Setting and Unsetting the Variables}.
@kwindex variable-pretty-print
@item variable-pretty-print
@itemx varpp
@*Type: Boolean.
@*Default: False.
If this variable is set, the listing ouput by @command{set} contains short
descriptions before each variable. @xref{Setting and Unsetting the Variables}.
@kwindex verbose
@item verbose
@*Type: Boolean.
@*Default: False.
@vrindex verbose, mail variable
When set, the actual delivery of messages is displayed on the user's terminal.
@kwindex xmailer
@item xmailer
@*Type: Boolean.
@*Default: Set.
@vrindex xmailer, mail variable
Controls whether the header @samp{X-Mailer} should be added to
outgoing messages. The default value of this header is
@example
X-Mailer: mail (GNU Mailutils @value{VERSION})
@end example
@end table
@node Mail Configuration Files
@subsection Personal and System-wide Configuration Files
Upon startup, @command{mail} reads the contents of the two command files:
the system-wide configuration file, and the user's configuration
file. Each line read from these files is processed like a usual
@command{mail} command.
When run with @option{--norc} (@option{-N}) option, @command{mail} does
not read the contents of system-wide configuration file. The user's
file, if it exists, is always processed.
The user's configuration file is located in the user's home
directory and is named @file{.mailrc}. The location and name of
the system-wide configuration file is determined when configuring the
package via @option{--with-mail-rc} option. It defaults to
@file{@var{sysconfdir}/mail.rc}.
@page
@node messages
@section @command{messages} --- Count the Number of Messages in a Mailbox
@pindex messages
@UNREVISED
@command{Messages} prints on standard output the number of messages
contained in each folder specified in command line. If no folders
are specified, it operates upon user's system mailbox. For each
folder, the following output line is produced:
@example
Number of messages in @var{folder}: @var{number}
@end example
@noindent
where @var{folder} represents the folder name, @var{number} represents
the number of messages.
Following configuration file statements affect the behaviour of
@command{messages}:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@end multitable
The program accepts following command line options:
@table @option
@item -q
@itemx --quiet
@itemx -s
@itemx --silent
Be quiet. Display only number of messages per mailbox, without leading text.
@item -?
@itemx --help
Output help message and exit.
@item --usage
Output short usage summary and exit.
@item -V
@itemx --version
Output program version and exit.
@end table
@page
@node movemail
@section @command{movemail} --- Moves Mail from the User Maildrop to the Local File
@pindex movemail
@UNREVISED
The purpose of @command{movemail}, as its name implies, is to move mail
from one location to another. For example, the following invocation:
@example
movemail /var/mail/smith INBOX
@end example
@noindent
moves messages from file @file{/var/mail/smith} to file @file{INBOX}.
You will probably never have to run this program manually. It is
intended as a replacement for @command{movemail} from GNU Emacs. The
@command{movemail} program is run by Emacs @code{Rmail}
module. @xref{Rmail,,,emacs,Reading Mail with Rmail}, for detailed
description of @code{Rmail} interface.
Mailutils version of @command{movemail} is fully
backward-compatible with its Emacs predecessor, so it should run
flawlessly with older versions of Emacs. Emacs versions
starting from 22.1 contain improved @code{Rmail} interface and
are able to take advantage of all new features mailutils
@command{movemail} provides.
@menu
* Movemail Configuration::
* Movemail Options:: Description of the Available Options
* Ownership:: Setting Destination Mailbox Ownership
* Summary:: Short Movemail Invocation Summary
@end menu
@node Movemail Configuration
@subsection Movemail Configuration
@UNREVISED
Following configuration file statements affect the behavior of
@command{movemail}:
@deffn {Movemail Config} preserve @var{bool}
If @var{bool} is @samp{true}, do not remove messages from the source mailbox.
@end deffn
@deffn {Movemail Config} reverse @var{bool}
If @var{bool} is @samp{true}, reverse message sorting order.
@end deffn
@deffn {Movemail Config} emacs @var{bool}
If @var{bool} is @samp{true}, output information used by Emacs rmail interface.
@end deffn
@deffn {Movemail Config} ignore-erros @var{bool}
Continue moving messages after errors. By default,
@command{mailfromd} exits immediately if it cannot copy a message.
@end deffn
@deffn {Movemail Config} program-id @var{fmt}
Set program identifier, i.e. a string which will prefix all
diagnostic messages issued by the program. By default, program
name is used.
The @var{fmt} is a format string that may contain references to the
following variables (@pxref{Variables}):
@table @code
@item progname
The program name.
@item source
URL of the source mailbox.
@item source_user
User part of the source mailbox URL.
@item source_host
Host part of the source mailbox URL.
@item source_path
Path part of the source mailbox URL.
@item dest
URL of the destination mailbox
@item dest_user
User part of the destination mailbox URL.
@item dest_host
Host part of the destination mailbox URL.
@item dest_path
Path part of the destination mailbox URL.
@end table
Setting @code{program-id} may be necessary if several @code{movemail}
instances are run simultaneously (e.g. invoked from a script) to
discern between the instances. For example:
@example
program-id "$@{progname@}: $@{source@} => $@{dest@}"
@end example
@end deffn
@deffn {Movemail Config} uidl @var{bool}
Avoid copying the message if a message with the same UIDL already
exists in the destination mailbox.
@end deffn
@deffn {Movemail Config} verbose @var{level}
Set verbosity level.
@end deffn
@deffn {Movemail Config} mailbox-ownership @var{method-list}
Define list of methods for setting ownership of the destination
mailbox. The @var{method-list} argument can contain the following
elements:
@anchor{mailbox-ownership-methods}
@table @asis
@item copy-id
Copy owner UID and GID from the source mailbox. This method works only
with local mailboxes, i.e.: @samp{mbox} (UNIX mailbox), @samp{maildir}
and @samp{mh}.
@item copy-name
Get owner name from the source mailbox URL and obtain UID and GID for
this user using mailutils authorization methods.
@item set-id=@var{uid}[:@var{gid}]
Set supplied @var{uid} and @var{gid}. If @var{gid} is not supplied,
it is read from the @file{/etc/passwd} record for this UID.
@item set-name=@var{user}
Make destination mailbox owned by @var{user}.
@end table
@end deffn
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@item pam @tab @xref{PAM Statement}.
@item sql @tab @xref{SQL Statement}.
@item virtdomain @tab @xref{Virtdomain Statement}.
@item radius @tab @xref{Radius Statement}.
@item ldap @tab @xref{LDAP Statement}.
@item auth @tab @xref{Auth Statement}.
@end multitable
@node Movemail Options
@subsection Movemail Options
@UNREVISED
This subsection discusses @command{movemail} options from the point of
view of an Emacs @code{Rmail} user.
To set various options to @command{movemail} from @code{Rmail}, use
@code{rmail-movemail-flags} variable, or @samp{Rmail Movemail Flags}
section from the menu.
Some POP servers return messages in reversed order. To fix the
order, use @option{-p} option or its synonym @option{--reverse}.
If the remote server supports @acronym{TLS} encryption, use
@option{--tls} to instruct @command{movemail} to initiate encrypted
connection.
@node Ownership
@subsection Setting Destination Mailbox Ownership
@UNREVISED
@node Summary
@subsection Movemail Usage Summary
@example
movemail [@var{option}...] @var{inbox} @var{destfile} [@var{remote-password}]
@end example
The first argument, @var{inbox}, is the @acronym{url} (@FIXME-pxref{URL}) of
the source mailbox. The second argument, @var{destfile}, traditionally
means destination file, i.e. the UNIX mailbox to copy messages
to. However, mailutils @command{movemail} extends the meaning of this
parameter. You may actually specify any valid @acronym{URL} as
@var{destfile} parameter.@footnote{Rmail does not use this
feature}. Finally, optional third argument is a traditional way of
specifying user passwords for remote (@acronym{POP} or @acronym{IMAP})
mailboxes.
Following is the summary of available command line options:
@table @option
@item --emacs
Output information used by Emacs rmail interface
@item --ignore-errors
Continue moving messages after an error occurs.
@item -p
@itemx --preserve
@itemx --keep-messages
Preserve the source mailbox
@item --program-id=@var{fmt}
Set program identifier for diagnostic purposes. See @ref{Movemail
Configuration,program-id}, for a detailed discussion of this feature.
@item -r
@itemx --reverse
Reverse the sorting order
@item --tls[=@var{bool}]
Enable (default) or disable TLS support
@item -u
@item --uidl
Use UIDLs to avoid downloading the same message twice.
@item -P @var{method-list}
@itemx --owner=@var{method-list}
Define list of methods for setting ownership of the destination
mailbox. @xref{mailbox-ownership-methods}, for a description of
@var{method-list}. This option is useful only when running
@command{movemail} as root.
@item -v
@item --verbose
Increase verbosity level.
@end table
@page
@node readmsg
@section @command{readmsg} --- Extract Messages from a Folder
@pindex readmsg
The @command{readmsg} utility extracts messages from a mailbox
according to the criteria specified in the command line. These
criteria are:
@enumerate
@item A lone @samp{*} means ``select all messages in the mailbox''.
@item
A list of message numbers may be specified. Values
of @samp{0} and @samp{$} in the list both mean the last
message in the mailbox. For example:
@example
readmsg 1 3 0
@end example
extracts three messages from the folder: the first, the third, and the last.
@item
Finally, the selection may be some text to match. This will select a mail
message which exactly matches the specified text. For example,
@example
readmsg staff meeting
@end example
extracts the message which contains the words @samp{staff meeting}.
Note that it will not match a message containing @samp{Staff Meeting}
-- the matching is case sensitive. Normally only the first message
which matches the pattern is printed.
@end enumerate
Unless one of the informational options is used, at least one command
line argument must be present. Informational options are:
@option{--help} (@option{-?}), @option{--usage}, and
@option{--version} (@option{-V}).
@menu
* Opt-readmsg:: Invocation of @command{readmsg}.
* Conf-readmsg:: Configuration of @command{readmsg}.
@end menu
@node Opt-readmsg
@subsection Invocation of @command{readmsg}.
@table @option
@item -a
@itemx --show-all
If a pattern is use for selection show all messages that match pattern
by default only the first one is presented.
@item -d
@itemx --debug
Display mailbox debugging information.
@item -f @var{mailbox}
@itemx --folder=@var{mailbox}
Specified the default mailbox.
@item -h
@itemx --header
Show the entire header and ignore the weedlist.
@item -n
@itemx --no-header
Do not print the message header.
@item -p
@itemx --form-feed
Put form-feed (Control-L) between messages instead of newline.
@anchor{weedlist option}
@item -w @var{weedlist}
@itemx --weedlist=@var{weedlist}
A whitespace or coma separated list of header names to show per message.
Default is @option{--weedlist="From Subject Date To CC Apparently-"}.
@end table
@node Conf-readmsg
@subsection Configuration of @command{readmsg}.
Following configuration statements affect the behavior of
@command{readmsg}:
@deffn {Readmsg Conf} header @var{bool}
If @var{bool} is @samp{true}, display entire headers.
@end deffn
@deffn {Readmsg Conf} weedlist @var{str}
Set the weedlist. The @var{str} argument is
a string, containing a list of header names, separated by whitespace,
commands or colons. This corresponds to the @option{--weedlist} command
line option (@pxref{Opt-readmsg, --weedlist}).
@end deffn
@deffn {Readmsg Conf} no-header @var{bool}
If @var{bool} is @samp{true}, exclude all headers.
@end deffn
@deffn {Readmsg Conf} form-feeds @var{bool}
If @var{bool} is @samp{true}, output formfeed character between
messages.
@end deffn
@deffn {Readmsg Conf} folder @var{url}
Set the @acronym{URL} of the mailbox folder to read.
@end deffn
@deffn {Readmsg Conf} show-all-match @var{bool}
If @var{bool} is @samp{true}, print all messages matching pattern, not
only the first.
@end deffn
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@end multitable
@node sieve
@section @command{sieve}
@pindex sieve
@UNREVISED
Sieve is a language for filtering e-mail messages at time of final
delivery, described in RFC 3028. GNU Mailutils provides two
implementations of this language: a stand-alone @dfn{sieve interpreter}
and a @dfn{sieve translator and filter}. The following sections describe these
utilities in detail.
@menu
* sieve interpreter:: A Sieve Interpreter
* sieve.scm:: A Sieve to Scheme Translator and Filter
@end menu
@node sieve interpreter
@subsection A Sieve Interpreter
Sieve interpreter @command{sieve} allows to apply Sieve scripts to an
arbitrary number of mailboxes. GNU @command{sieve} implements a superset
of the Sieve language as described in RFC 3028. @xref{Sieve Language},
for a description of the Sieve language. @xref{GNU Extensions}, for a
discussion of differences between the GNU implementation of Sieve and
its standard.
@menu
* Invoking Sieve::
* Sieve Configuration::
* Logging and Debugging::
* Extending Sieve::
@end menu
@node Invoking Sieve
@subsubsection Invoking @command{sieve}
The @command{sieve} invocation syntax is:
@example
sieve [@var{options}] @var{script}
@end example
@noindent
where @var{script} denotes the filename of the sieve program to parse,
and @var{options} is one or more of the following:
@table @option
@item -c
@itemx --compile-only
Compile script and exit.
@item --clear-library-path
@itemx --clearpath
Clear Sieve library path. See also @ref{Sieve Configuration,
clear-library-path}.
@item --clear-include-path
Clear Sieve include path. See also @ref{Sieve Configuration,
clear-include-path}.
@item -d[@var{flags}]
@itemx --debug[=@var{flags}]
Specify debug flags. The @var{flags} argument is a sequence of one or
more of the following letters:
@multitable @columnfractions .40 .45
@item @samp{g} @tab Enable main parser traces
@item @samp{T} @tab Enable mailutils traces
@item @samp{P} @tab Trace network protocols
@item @samp{t} @tab Enable sieve trace
@item @samp{i} @tab Trace the program instructions
@end multitable
@item -D
@itemx --dump
Compile the script, dump disassembled code on standard output and exit.
@item -e @var{address}
@itemx --email @var{address}
Override the user email address. This is useful for @code{reject} and
@code{redirect} actions. By default, the user email address is deduced
from the user name and the full name of the machine where
@command{sieve} is executed. See also @ref{Sieve Configuration,
email}.
@item -I @var{dir}
@itemx --includedir=@var{dir}
Append directory @var{dir} to the list of directories searched for
include files. See also @ref{Sieve Configuration, include-path}.
@item -f
@itemx --mbox-url=@var{mbox}
Mailbox to sieve (defaults to user's system mailbox). See also
@ref{Sieve Configuration, mbox-url}.
@item -k
@itemx --keep-going
Keep on going if execution fails on a message. See also
@ref{Sieve Configuration, keep-going}.
@item -L @var{dir}
@item --libdir=@var{dir}
Append directory @var{dir} to the list of directories searched for
library files. See also @ref{Sieve Configuration, library-path}.
@item -n
@itemx --no-actions
Dry run: do not execute any actions, just print what would be done.
@item -t @var{ticket}
@itemx --ticket=@var{ticket}
Ticket file for mailbox authentication. See also
@ref{Sieve Configuration, ticket}.
@item -v
@itemx --verbose
Log all actions executed. See also @ref{Sieve Configuration, verbose}.
@end table
@node Sieve Configuration
@subsubsection Sieve Configuration
The behavior of @command{sieve} is affected by the following
configuration statements:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@item logging @tab @xref{Logging Statement}.
@item mailer @tab @xref{Mailer Statement}.
@end multitable
The following statements configure sieve-specific features:
@deffn {Sieve Conf} sieve @{ ... @}
This block statement configures search paths @command{sieve} uses to
locate its loadable modules. @xref{Require Statement}, for a detailed
information of this feature.
This statement may contain the following sub-statements:
@code{clear-library-path}, @code{clear-include-path},
@code{library-path}, @code{include-path}, which are described below.
@end deffn
@deffn {Sieve Conf} clear-library-path @var{bool}
Used within the @code{sieve} block statement.
If @var{bool} is @samp{true}, clear library search path.
@end deffn
@deffn {Sieve Conf} clear-include-path @var{bool}
Used within the @code{sieve} block statement.
If @var{bool} is @samp{true}, clear include search path.
@end deffn
@deffn {Sieve Conf} library-path @var{path}
Used within the @code{sieve} block statement.
Add directories to @command{sieve} library search path. Argument is a
string containing a colon-separated list of directories.
@end deffn
@deffn {Sieve Conf} include-path @var{path}
Used within the @code{sieve} block statement.
Add directories to the include search path. Argument is a
string containing a colon-separated list of directories.
@end deffn
@deffn {Sieve Conf} keep-going @var{bool}
If @var{bool} is @samp{true}, do not abort if execution of a Sieve
script fails on a particular message.
@end deffn
@deffn {Sieve Conf} mbox-url @var{url}
Sets @acronym{URL} of the mailbox to be processed.
@end deffn
@deffn {Sieve Conf} ticket @var{file}
Sets the name of the ticket file for user authentication.
@end deffn
@deffn {Sieve Conf} debug @var{flags}
Sets Sieve debug flags. @xref{Logging and Debugging}, for a detailed
description.
@end deffn
@deffn {Sieve Conf} verbose @var{bool}
If @var{bool} is @samp{true}, log all executed actions.
@end deffn
@deffn {Sieve Conf} line-info @var{bool}
If @var{bool} is @samp{true}, print source locations along with action
logs. This statement takes effect only if @code{verbose true} is also
set.
@end deffn
@deffn {Sieve Conf} email @var{addr}
Set user e-mail address. This is useful for @code{reject} and
@code{redirect} actions. By default, the user email address is deduced
from the user name and the full name of the machine where @command{sieve} is
executed.
@end deffn
@node Logging and Debugging
@subsubsection Logging and debugging
The default behavior of @command{sieve} is to remain silent about
anything except errors. However, it is sometimes necessary to see
which actions are executed and on which messages. This is particularly
useful when debugging the sieve scripts. The @option{--verbose}
(@option{-v}) option outputs log of every action executed.
Option @option{--debug} allows to produce even more detailed debugging
information. This option takes an argument specifying the
debugging level to be enabled. The argument can consist of the
following letters:
@table @samp
@item @samp{t}
This flag enables sieve tracing. It means that every test will be logged
when executed.
@item @samp{T}
This flag enables debugging of underlying @code{mailutils} library.
@item @samp{P}
Trace network protocols: produces log of network transactions executed
while running the script.
@item @samp{g}
Enable main parser traces. This is useful for debugging the sieve grammar.
@item @samp{i}
Trace the program instructions. It is the most extensive debugging
level. It produces the full execution log of a sieve program, showing
each instruction and states of the sieve machine. It is only useful
for debugging the code generator.
@end table
@emph{Note}, that there should be no whitespace
between the short variant of the option (@option{-d}), and its
argument. Similarly, when using long option (@option{--debug}),
its argument must be preceded by equal sign.
If the argument to @option{--debug} is omitted, it defaults to
@samp{TPt}.
Option @option{--dump} produces the disassembled dump of the compiled
sieve program.
By default @command{sieve} output all diagnostics on standard error and verbose
logs on standard output. This behaviour is changed when
@option{--log-facility} is given in the command line (@FIXME-pxref{logging}).
This option causes @command{sieve} to output its diagnostics to
the given syslog facility.
@node Extending Sieve
@subsubsection Extending @command{sieve}
The basic set of sieve actions, tests and comparators may be extended
using loadable extensions. Usual @code{require} mechanism is used for
that.
When processing arguments for @code{require} statement, @command{sieve}
uses the following algorithm:
@enumerate 1
@item Look up the name in a symbol table. If the name begins with
@samp{comparator-} it is looked up in the comparator table. If it
begins with @samp{test-}, the test table is used instead. Otherwise
the name is looked up in the action table.
@item If the name is found, the search is terminated.
@item Otherwise, transform the name. First, any @samp{comparator-} or
@samp{test-} prefix is stripped. Then, any character other than
alphanumeric characters, @samp{.} and @samp{,} is replaced with
dash (@samp{-}). The name thus obtained is used as a file name
of an external loadable module.
@item Try to load the module. The module is searched in the
following search paths (in the order given):
@enumerate 1
@item Mailutils module directory. By default it is
@file{$prefix/lib/mailutils}.
@item The value of the environment variable @env{LTDL_LIBRARY_PATH}.
@item Additional search directories specified with the
@code{library-path} statement (@pxref{Sieve Configuration,
library-path}) in Sieve configuration file.
@item Additional search directories specified with the.
@option{--libdir} command line option (@FIXME-pxref{libdir}).
@item Additional search directories specified with the
@code{#searchpath} Sieve directive (@pxref{#searchpath}).
@item System library search path: The system dependent library
search path (e.g. on Linux it is set by the contents of the file
@file{/etc/ld.so.conf} and the value of the environment variable
@env{LD_LIBRARY_PATH}).
@end enumerate
The value of @env{LTDL_LIBRARY_PATH} and @env{LD_LIBRARY_PATH} must be
a colon-separated list of absolute directories, for example,
@samp{"/usr/lib/mypkg:/lib/foo"}.
In any of these directories, @command{sieve} first attempts to find
and load the given filename. If this fails, it tries to append the
following suffixes to the file name:
@enumerate 1
@item the libtool archive extension @samp{.la}
@item the extension used for native dynamic libraries on the host
platform, e.g., @samp{.so}, @samp{.sl}, etc.
@end enumerate
@item If the module is found, @command{sieve} executes its
initialization function (see below) and again looks up the name
in the symbol table. If found, search terminates successfully.
@item If either the module is not found, or the symbol wasn't
found after execution of the module initialization function,
search is terminated with an error status. @command{sieve} then displays
the following diagnostic message:
@example
source for the required action NAME is not available
@end example
@end enumerate
@c ***********************************************************************
@page
@node sieve.scm
@subsection A Sieve to Scheme Translator and Filter
@UNREVISED
A Sieve to Scheme Translator @command{sieve.scm} translates a given
Sieve script into an equivalent Scheme program and optionally executes
it. The program itself is written in Scheme and requires presence of
Guile version 1.8 or newer on the system. For more information on
Guile refer to @ref{Top,,Overview,guile,The Guile Reference Manual}.
@table @option
@item -f @var{filename}
@itemx --file @var{filename}
Set input file name.
@item -o @var{filename}
@itemx --output @var{filename}
Set output file name
@item -L @var{dirname}
@itemx --lib-dir @var{dirname}
Set sieve library directory name
@item -d @var{level}
@itemx --debug @var{level}
Set debugging level
@end table
The Scheme programs produced by @command{sieve.scm} can be used with
@command{guimb} or @command{maidag}.
@c ***********************************************************************
@page
@node guimb
@section @command{guimb} --- A Mailbox Scanning and Processing Language
@pindex guimb
@UNREVISED
@command{Guimb} is for mailboxes what @command{awk} is for text files.
It processes mailboxes, applying the user-supplied scheme procedures
to each of them in turn and saves the resulting output in mailbox
format.
The following configuration statements affect the behavior of
@command{guimb}:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@end multitable
@menu
* Specifying Scheme Program to Execute::
* Specifying Mailboxes to Operate Upon::
* Passing Options to Scheme::
* Command Line Option Summary::
@end menu
@node Specifying Scheme Program to Execute
@subheading Specifying Scheme Program to Execute
The Scheme program or expression to be executed is passed to
@command{guimb} via the following options:
@table @option
@item -s @var{file}
@itemx --source @var{file}
Load Scheme source code from @var{file}.
@item -c @var{expr}
@itemx --code @var{expr}
Execute given scheme expression.
@end table
The above switches stop further argument processing, and pass all
remaining arguments as the value of @code{(command-line)}.
If the remaining arguments must be processed by @command{guimb} itself,
use following options:
@table @option
@item -e @var{expr}
@itemx --expression @var{expr}
Execute scheme expression.
@item -f @var{file}
@itemx --file @var{file}
Load Scheme source code from @var{file}.
@end table
You can specify both of them. In this case, the @var{file} is read
first, then @var{expr} is executed. You may still pass any additional
arguments to the script using @option{--guile-arg} option.
@node Specifying Mailboxes to Operate Upon
@subheading Specifying Mailboxes to Operate Upon
There are four basic ways of passing mailboxes to @command{guimb}.
@table @code
@item guimb [@var{options}] [@var{mailbox}...]
The resulting mailbox is not saved, unless the user-supplied
scheme program saves it.
@item guimb [@var{options}] --mailbox @var{defmbox}
The contents of @var{defmbox} is processed and is replaced with the resulting
mailbox contents. Useful for applying filters to user's mailbox.
@item guimb [@var{options}] --mailbox @var{defmbox} @var{mailbox} [@var{mailbox}...]
The contents of specified mailboxes is processed, and the resulting
mailbox contents is appended to @var{defmbox}.
@item guimb [@var{options}] --user @var{username} [@var{mailbox}...]
The contents of specified mailboxes is processed, and the resulting
mailbox contents is appended to the user's system mailbox. This allows
to use @command{guimb} as a mail delivery agent.
@end table
If no mailboxes are specified in the command line, @command{guimb} reads
and processes the system mailbox of the current user.
@node Passing Options to Scheme
@subheading Passing Options to Scheme
Sometimes it is necessary to pass some command line options to the
scheme procedure. There are three ways of doing so.
When using @option{--source} (@option{-s}) or @option{--code}
(@option{-c}) options, all the rest of the command line following
the option's argument is passed to Scheme program verbatim. This
allows for making guimb scripts executable by the shell. If your system
supports @samp{#!} magic at the start of scripts, add the following two
lines to the beginning of your script to allow for its immediate execution:
@example
#! /usr/local/bin/guimb -s
!#
@end example
@noindent
(replace @samp{/usr/local/bin/} with the actual path to the @command{guimb}).
Otherwise, if you use @option{--file} or @option{--expression} options,
the additional arguments may be passed to the Scheme program @option{-g}
(@option{--guile-arg}) command line option. For example:
@example
guimb --guile-arg -opt --guile-arg 24 --file @var{progfile}
@end example
In this example, the scheme procedure will see the following command line:
@example
@var{progfile} -opt 24
@end example
Finally, if there are many arguments to be passed to Scheme, it is more
convenient to enclose them in @option{-@{} and @option{-@}} escapes:
@example
guimb -@{ -opt 24 -@} --file @var{progfile}
@end example
@node Command Line Option Summary
@subheading Command Line Option Summary
This is a short summary of the command line options available to
@command{guimb}.
@table @option
@item -d
@itemx --debug
Start with debugging evaluator and backtraces.
@item -e @var{expr}
@itemx --expression @var{expr}
Execute given Scheme expression.
@item -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item -f @var{progfile}
@itemx --file @var{progfile}
Read Scheme program from @var{progfile}.
@item -g @var{arg}
@itemx --guile-command @var{arg}
Append @var{arg} to the command line passed to Scheme program.
@item -@{ ... -@}
Pass all command line options enclosed between @option{-@{} and @option{-@}}
to Scheme program.
@item -m
@itemx --mailbox @var{mbox}
Set default mailbox name.
@item -u
@itemx --user @var{name}
Act as local MDA for user @var{name}.
@item -h
@itemx --help
Display help message.
@item -v
@itemx --version
Display program version.
@end table
@page
@node maidag
@section maidag
@pindex maidag
@UNREVISED
The name @samp{maidag} stands for @i{Mai}l @i{d}elivery @i{ag}ent. It
is a general-purpose @acronym{MDA} offering a rich set of
features. It can operate both in traditional mode, reading the message
from its standard input, and in @acronym{LMTP} mode. @command{Maidag}
is able to deliver mail to any mailbox format, supported by GNU
Mailutils. These formats, among others, include @samp{remote+smtp},
@samp{remote+prog} and @samp{remote+sendmail} which are
equivalent to forwarding a message over @acronym{SMTP} to a remote
node. Thus, @command{maidag} supersedes both @command{mail.local} and
@command{mail.remote} utilities from GNU Mailutils versions prior to
2.0.
@command{Maidag} is also able to process incoming messages using
Sieve, Scheme or Python scripts and, based on results of this
processing, to take a decision on whether to actually deliver and
where to deliver them. Due to its extensive scripting facilities,
@command{maidag} offers much more flexibility than other popular
@acronym{MDA}s, such as @command{procmail}.
@menu
* Sendmail-maidag:: Using @command{maidag} with Sendmail.
* Exim-maidag:: Using @command{maidag} with Exim.
* MeTA1-maidag:: Using @command{maidag} with MeTA1.
* Mailbox Quotas::
* Maidag Scripting::
* Forwarding::
* Url-mode:: Delivering Messages to a URL.
* Remote Mailbox Delivery::
* Conf-maidag:: Maidag Configuration File Summary
@end menu
@node Sendmail-maidag
@subsection Using @command{maidag} with Sendmail.
@cindex Sendmail
When used as a @acronym{MDA} with Sendmail, @command{maidag} must be
invoked from the local mailer definition in the @file{sendmail.cf}
file. It must have the following flags set: @samp{lswS}. These mean:
the mailer is local, quote characters should be stripped off the
address before invoking the mailer, the user must have a valid account
on this machine and the userid should not be reset before calling the
mailer. Additionally, the flags @samp{fn} may be specified to allow
@command{maidag} to generate the usual @samp{From } envelope instead
of the one supplied by @command{sendmail}.
If you wish to use @command{maidag} with non-local authentication,
such as @acronym{SQL} or @acronym{LDAP}, you also need to remove the
@samp{w} flag, since in that case the user is not required to have a
valid account on the machine that runs @command{sendmail}.
Here is an example of mailer definition in @file{sendmail.cf}
@example
Mlocal, P=/usr/local/sbin/maidag,
F=lsDFMAw5:/|@@qSPfhn9,
S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
T=DNS/RFC822/X-Unix,
A=mail $u
@end example
To define local mailer in @samp{mc} source file, it will suffice to
set:
@example
define(`LOCAL_MAILER_PATH', `/usr/local/sbin/maidag')
define(`LOCAL_MAILER_ARGS', `mail $u')
@end example
@node Exim-maidag
@subsection Using @command{maidag} with Exim.
@cindex Exim
Using @command{maidag} with Exim is quite straightforward. The
following example illustrates the definition of the appropriate transport
and director in @file{exim.conf}:
@example
# transport
maidag_pipe:
driver = pipe
command = /usr/local/sbin/maidag $local_part
return_path_add
delivery_date_add
envelope_to_add
# director
maidag:
driver = localuser
transport = maidag_pipe
@end example
@node MeTA1-maidag
@subsection Using @command{maidag} with MeTA1.
@cindex LMTP
@cindex MeTA1
MeTA1 (@uref{http://meta1.org}) communicates with the delivery agent
using @acronym{LMTP}.
LMTP mode is enabled in @command{maidag} by the @samp{lmpt yes}
statement. The socket to listen on must be specified using
@code{server} statement (@pxref{Server Settings}). For the purposes of
this section, let's suppose @command{maidag} will listen on a
@acronym{UNIX} socket @file{/var/spool/meta1/lmtpsock}. Then, the
following (minimal) @command{maidag} configuration will do the job:
@example
# @r{Start in LMTP mode.}
lmtp yes;
# @r{Run as daemon.}
mode daemon;
# @r{Switch to this group after startup.}
group meta1c;
# @r{Configure server:}
server unix:///var/spool/meta1/lmtpsock @{
transcript no;
@};
@end example
To configure MeTA1 to use this socket, add the following statement to
the @samp{smtpc} section in @file{/etc/meta1/meta1.conf}:
@example
LMTP_socket="lmtpsock";
@end example
@node Mailbox Quotas
@subsection Mailbox Quotas
@dfn{Mailbox quota} is a limit on the size of the mailbox. When a
mailbox size reaches this limit, @command{maidag} stops accepting
messages for this recipient and returns an error condition to the
sender. The error code is accompanied by the following error message:
@example
@var{user}: mailbox quota exceeded for this recipient
@end example
Furthermore, if accepting the incoming message would make the
mailbox size exceed the quota, such a message will be rejected as
well. In this case, the error message is:
@example
@var{user}: message would exceed maximum mailbox size for this recipient
@end example
In both cases, the default return code will be @samp{service
unavailable} (corresponding to the @acronym{SMTP} return code
@samp{550}), unless the following statement is present in the
@command{maidag} configuration file:
@example
exit-quota-tempfail yes;
@end example
@noindent
in which case a temporary error will be returned.
The mailbox quota can be retrieved from the following sources:
@enumerate 1
@item Authentication method.
@item @acronym{DBM} file.
@item @acronym{SQL} database.
@end enumerate
@menu
* DBM Quotas:: Keeping Quotas in DBM File.
* SQL Quotas:: Keeping Quotas in SQL Database.
@end menu
@node DBM Quotas
@subsubsection Keeping Quotas in DBM File
To use @acronym{DBM} quota database, GNU Mailutils must
be compiled with one of the following command line options:
@option{--with-gdbm}, @option{--with-berkeley-db}, @option{--with-ndbm},
@option{--with-tokyocabinet}, or @option{--with-kyotocabinet}.
Examine the output of @command{maidag --show-config-options}, if not sure.
The quota database should have the following structure:
@table @asis
@item Key
Key represents the user name. Special key @samp{DEFAULT} means default
quota value, i.e. the one to be used if the user is not explicitly
listed in the database.
@item Value
Mailbox quota for this user. If it is a number, it represents the
maximum mailbox size in bytes. A number may optionally be followed by
@samp{kb} or @samp{mb}, meaning kilobytes and megabytes, respectively.
A special value @samp{NONE} means no mailbox size limit for this user.
@end table
Here is an example of a valid quota database
@example
# Default quota value:
DEFAULT 5mb
# Following users have unlimited mailbox size
root NONE
smith NONE
# Rest of users
plog 26214400
karin 10mB
@end example
To use the @acronym{DBM} quota database, specify its absolute name using
@code{quota-db} configuration statement, e.g.:
@example
quota-db /etc/mail/quota.db;
@end example
@node SQL Quotas
@subsubsection Keeping Quotas in SQL Database
Configuration statement @code{quota-query} allows to specify a special
query to retrieve the quota from the database. Currently (as of mailutils
version @value{VERSION}) it is assumed that this table can be accessed
using the credentials set in @samp{sql} configuration statement
(@pxref{SQL Statement}).
For example, suppose you have the following quota table:
@example
create table mailbox_quota (
user_name varchar(32) binary not null,
quota int,
unique (user_name)
);
@end example
@noindent
To retrieve user quota the following query can be used:
@example
SELECT quota FROM mailbox_quota WHERE user_name='$@{user@}'
@end example
There are no special provisions for specifying group quotas, similar to
@samp{DEFAULT} in @acronym{DBM} databases. This is because group quotas can
easily be implemented using @acronym{SQL} language. @command{Maidag}
always uses the first tuple from the set returned by mailbox quota
query. So, you may add a special entry to the @code{mailbox_quota}
table that would keep the group quota. In the discussion below we assume
that the @code{user_name} column for this entry is lexicographically
less than any other user name in the table. Let's suppose the group
quota name is @samp{00DEFAULT}. Then the following query:
@example
SELECT quota
FROM mailbox_quota
WHERE user_name IN ('$@{user@}','00DEFAULT')
ORDER BY user_name DESC
@end example
@noindent
will return two tuples if the user is found in
@code{mailbox_quota}. Due to @code{ORDER} statement, the first tuple
will contain the quota for the user, which will be used by
@command{maidag}. On the other hand, if the requested user name is not
present in the table, the above query will return a single tuple
containing the group quota.
The following configuration statement instructs @command{maidag} to
use this query for retrieving the user quota:
@example
quota-query "SELECT quota "
"FROM mailbox_quota "
"WHERE user_name IN ('$@{user@}','00DEFAULT') "
"ORDER BY user_name DESC";
@end example
@node Maidag Scripting
@subsection Maidag Scripting
@command{Maidag} can use global or per-user @dfn{mail filters} to
decide whether to deliver the message, and where to deliver it. As of
Mailutils version @value{VERSION}, such mail filters may be written in
the following languages:
@itemize @bullet
@item Sieve
@xref{Sieve Language}.
@item Scheme
@item Python
@end itemize
Mail filters to use are specified using @samp{script} configuration
statement. The following meta-symbols can be used in its argument:
@table @asis
@item ~
@itemx %h
Expands to the recipient home directory.
@item %u
Expands to the recipient user name.
@end table
By default, a filename extension decide which scripting language will
be used. User can alter the choice using @samp{language} configuration
statement. For example:
@example
language "python"
script "~/.maidag-py-filter"
@end example
@menu
* Sieve Maidag Filters::
* Scheme Maidag Filters::
* Python Maidag Filters::
@end menu
@node Sieve Maidag Filters
@subsubsection Sieve Maidag Filters
@kwindex script
The file name of the Sieve filter to use is specified using
@samp{script} configuration statement. For example, the following
configuration statement:
@example
script "~/.maidag.sv"
@end example
@noindent
instructs @command{maidag} to use file @file{.maidag.sv} in the
recipient home directory as a Sieve filter.
Normal message delivery is attempted if execution of the Sieve code
ended with @code{keep} action (either implicit or explicit).
Other Sieve actions are executed as described in @ref{Actions}. For
example, to deliver message to another mailbox, use the
@code{fileinto} action.
Any modifications to headers or body of the message performed by the
Sieve code will be visible in the delivered message.
@node Scheme Maidag Filters
@subsubsection Scheme Maidag Filters
@kwindex script
The file name of the Scheme mail filter is specified using
@samp{script} configuration statement. For example, the following
configuration statement:
@example
script "~/.maidag.scm"
@end example
@noindent
instructs `maidag' to use file `.maidag.scm' in the recipient home
directory as a Scheme filter.
@node Python Maidag Filters
@subsubsection Python Maidag Filters
@kwindex script
The file name of the Python mail filter is specified using
@samp{script} configuration statement. For example, the following
configuration statement:
@example
script "~/.maidag.py"
@end example
@noindent
instructs `maidag' to use file `.maidag.py' in the recipient home
directory as a Python filter.
@noindent
A simple example of a mail filter written in Python:
@example
from mailutils import *
import maidag
import re
msg = message.Message (maidag.message)
hdr = msg.header
try:
if 'List-Post' in hdr and 'Received' in hdr \
and hdr['Received'].find ('fencepost.gnu.org') != -1:
# check envelope's sender address
m = re.search (r'([\w\-]+)-bounces\+([\w]+)=.*',
msg.envelope.get_sender ())
if m:
lbox = m.group (1)
user = m.group (2)
# open destination mailbox and append message
dst = mailbox.MailboxDefault ('~/Mail/%s' % lbox)
dst.open ('ac')
dst.append_message (msg)
dst.close ()
# set deleted flag so maidag will not deliver msg elsewhere
msg.attribute.set_deleted ()
except Exception:
pass
@end example
@node Forwarding
@subsection Forwarding
@cindex forward
@dfn{Forward file} is a special file in the user's home directory that
contains the email address of the mailbox where the user wants to
forward his mail. Normally, forward files are processed by
@acronym{MTA}. However, there are some @acronym{MTA} that lack this
feature. One of them is MeTA1.
@command{Maidag} provides a forwarding feature that is useful to
compensate the lack of it.
@kwindex forward-file
Name of the forward file is given using @code{forward-file}
configuration statement. A common usage is:
@example
forward-file .forward;
@end example
The forward file is always searched in the recipient home directory.
@kwindex forward-file-checks
Before actually using the file, a number of safety checks are
performed on it. If the file fails to pass one of these checks, no
forwarding is performed and the message is delivered as usual. These
checks can be configured using @code{forward-file-checks} statement.
Its argument is a list of the following keywords:
@table @asis
@item groupwritablefile
@itemx file_iwgrp
The file must not be group writable.
@item worldwritablefile
@itemx file_iwoth
The file must not be world writable.
@item linkedfileinwritabledir
@itemx link
The file cannot be a symlink in a writable directory.
@item fileingroupwritabledir
@itemx dir_iwgrp
The file cannot reside in a group writable directory.
@item fileinworldwritabledir
@itemx dir_iwoth
The file cannot reside in a world writable directory.
@item all
All of the above checks.
@end table
The default is @samp{forward-file-checks all}.
Each of these keywords may be prefixed by @samp{no} to disable this
particular check. For example:
@example
forward-file-checks (nodir_iwoth, nodir_iwgrp);
@end example
@node Url-mode
@subsection Delivering Messages to a URL.
When invoked with the @option{--url} command line option,
@command{maidag} treats its arguments as a list of mailbox
@acronym{URL}s and attempts to deliver the message to each of them.
For example:
@example
$ maidag --url maildir:///home/smith/Mail
@end example
@node Remote Mailbox Delivery
@subsection Remote Mailbox Delivery
@command{Maidag} can be used to deliver mail to remote mailboxes, such
as @samp{imap} or @samp{remote+smtp}. If the mailbox @acronym{URL}
is @samp{remote+smtp} or @samp{remote+sendmail}, the message is
actually forwarded over @acronym{SMTP} to the remote node, so
@command{maidag} acts as a message transfer agent. For example:
@example
$ maidag --url remote+smtp://10.10.1.100:24
@end example
This command line will send the message to the machine
@samp{10.10.1.100} using port @samp{24} (private mail system).
The @samp{remote+prog} mailbox may be of special use. Delivering to
this mailbox results in invoking the specified command with the given
arguments and passing the message to its standard input. There are two
ways to specify a @samp{remote+prog} mailbox:
@table @asis
@item remote+prog://@var{program}?@var{args}
Here, @var{program} is the absolute pathname of the program binary,
and @var{args} are its arguments, separated by @samp{&} signs.
@item |@var{program} @var{args}
In this notation, @var{args} are command line arguments separated by
white space.
@end table
In both cases, @var{args} do not include @code{argv[0]}.
The @samp{remote+prog} mailbox may be used, in particular, to implement
mailing lists with MeTA1.
For example, suppose that the @command{maidag} configuration contains:
@example
auth @{
authorization sql:system;
authentication generic:system;
@}
sql @{
interface mysql;
db mail;
getpwnam "SELECT user as name, mailbox, "
"'x' as passwd, 500 as uid, 2 as gid, "
"'/nonexistent' as dir, '/sbin/nologin' as shell "
"FROM userdb "
"WHERE user='$@{user@}'";
@}
@end example
Then, the following entries in the @samp{userdb} table implement
@email{mailman@@yourdomain} mailing list:
@example
mysql> select * from userdb;
+---------------------+---------------------------------------+
| user | mailbox |
+---------------------+---------------------------------------+
| mailman | |/usr/bin/mailman post mailman |
| mailman-admin | |/usr/bin/mailman admin mailman |
| mailman-bounces | |/usr/bin/mailman bounces mailman |
| mailman-confirm | |/usr/bin/mailman confirm mailman |
| mailman-join | |/usr/bin/mailman join mailman |
| mailman-leave | |/usr/bin/mailman leave mailman |
| mailman-owner | |/usr/bin/mailman owner mailman |
| mailman-request | |/usr/bin/mailman request mailman |
| mailman-subscribe | |/usr/bin/mailman subscribe mailman |
| mailman-unsubscribe | |/usr/bin/mailman unsubscribe mailman |
+---------------------+---------------------------------------+
@end example
@node Conf-maidag
@subsection Maidag Configuration File Summary
The behavior of @command{maidag} is affected by the following configuration
statements:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@item pam @tab @xref{PAM Statement}.
@item sql @tab @xref{SQL Statement}.
@item virtdomain @tab @xref{Virtdomain Statement}.
@item radius @tab @xref{Radius Statement}.
@item ldap @tab @xref{LDAP Statement}.
@item auth @tab @xref{Auth Statement}.
@item mailer @tab @xref{Mailer Statement}.
@item server @tab @xref{Server Settings}. Used only in
@acronym{LMTP} mode.
@item acl @tab @xref{ACL Statement}.
@item tcp-wrappers @tab @xref{Tcp-wrappers Statement}.
@end multitable
@deffn {Maidag Config} ex-multiple-delivery-success @var{bool}
In case of multiple delivery, exit with code 0 if at least one
delivery has succeeded.
@end deffn
@deffn {Maidag Config} ex-quota-tempfail @var{bool}
Indicate temporary failure if the recipient is over his mail quota.
By default, permanent failure is returned. @xref{Mailbox Quotas}.
@end deffn
@deffn {Maidag Config} quota-db @var{file}
Set the name of DBM quota database file. @xref{DBM Quotas}.
@end deffn
@deffn {Maidag Config} sieve-filter @var{pattern}
Set file name or name pattern of the Sieve filter file.
@xref{Sieve Maidag Filters}.
@end deffn
@deffn {Maidag Config} message-id-header @var{name}
When logging Sieve actions, identify messages by the value of this
header.
@end deffn
@deffn {Maidag Config} guile-filter @var{pattern}
File name or name pattern for Guile filter file.
@xref{Scheme Maidag Filters}.
@end deffn
@deffn {Maidag Config} debug @var{flags}
Set additional debugging flags. Valid flags are:
@table @asis
@item g
Print @command{guimb} stack traces.
@item t
Enable @command{sieve} trace (@code{MU_SIEVE_DEBUG_TRACE}).
@item i
Enable @command{sieve} instructions trace
(@code{MU_SIEVE_DEBUG_INSTR}).
@item l
Log executed Sieve actions.
@end table
@end deffn
@deffn {Maidag Config} stderr @var{bool}
Log to stderr instead of syslog.
@end deffn
@deffn {Maidag Config} forward-file @var{file}
Process forward file @var{file}. @xref{Forwarding}.
@end deffn
@deffn {Maidag Config} forward-file-checks @var{list}
Configure safety checks for the forward file.
@xref{Forwarding, forward-file-checks}.
@end deffn
@deffn {Maidag Config} lmtp @var{bool}
Run in @acronym{LMTP} mode.
@end deffn
@deffn {Maidag Config} group @var{list}
In @acronym{LMTP} mode, retain supplementary groups from @var{list}.
@end deffn
@deffn {Maidag Config} listen @var{url}
In @acronym{LMTP} mode, listen on @var{url}. Valid @acronym{URL}s are:
@samp{tcp://@var{host}:@var{port}} (note that port is mandatory),
@samp{file://@var{socket-file-name}} or
@samp{socket://@var{socket-file-name}}.
@end deffn
@deffn {Maidag Config} reuse-address @var{bool}
Reuse existing address (@acronym{LMTP} mode). Default is @samp{yes}.
@end deffn
@page
@node mimeview
@section mimeview
@pindex mimeview
For each file given in its command line, @command{mimeview} attempts
to autodetect its type and invoke an appropriate file viewer.
To detect the file type, @command{mimeview} uses @file{mime.types}
file. This file is a part of Common UNIX Printing System,
@ref{mime.types,,,mime.types(5), mime.types man page}. By default
@command{mimeview} searches for @file{mime.types} in
@file{$prefix/etc/cups/}@footnote{The exact location is determined at
configuration time by setting environment variable
@env{DEFAULT_CUPS_CONFDIR}. On most sites running
@example
./configure DEFAULT_CUPS_CONFDIR=/etc/cups
@end example
@noindent
should be recommended.}, however its exact location can be specified
at runtime as well (see @option{--mimetypes} below).
Once file MIME type is successfully determined, @command{mimeview}
consults @file{mailcap} files in order to determine how to display
the file. It does so essentially in the same manner as
@command{metamail} utility, i.e., it scans all files specified
in @code{METAMAIL} environment variable until it finds an entry
describing the desired file format or until the list of files is
exhausted. If @code{METAMAIL} variable is not set, @command{mimeview}
uses the following default path instead:
@example
$HOME/.mailcap:/usr/local/etc/mailcap:\
/usr/etc/mailcap:/etc/mailcap:\
/etc/mail/mailcap:/usr/public/lib/mailcap
@end example
@menu
* Mimeview Invocation::
* Mimeview Config::
@end menu
@node Mimeview Invocation
@subsection Mimeview Invocation
The following table summarizes options specific for @command{mimeview}:
@table @option
@item -a[@var{type-list}]
@itemx --no-ask[=@var{type-list}]
By default @command{mimeview} asks for confirmation before running
interpreter to view a message. If this option is used without
argument, it disables the default behavior for all message
types. Otherwise, if argument @var{type-list} is given, it specifies
a comma-separated list of MIME types for which no questions should be
asked. Elements of this list may include shell-style globbing
patterns, e.g. setting
@example
--no-ask='text/*,image/jpeg'
@end example
@noindent
will disable prompting before displaying any textual files, no
matter what their subtype is, and before displaying files with
type @samp{image/jpeg}.
Notice, that when the long form is used, its argument
must be separated from the option by a single equal sign, as shown
in the example above. When the short form (@option{-a}) is used, its argument
must follow the option immediately, without any intervening whitespace,
e.g. @option{-a'text/*'}).
@item -d[@var{flags}]
@itemx --debug[=@var{flags}]
Enables debugging output. @var{Flags} is a sequence of characters
specifying the desired debugging level. Following characters are
meaningful in @var{flags}:
@table @asis
@item g
Enables debugging of @file{mime.types} parser
@item l
Enables debugging of @file{mime.types} lexical analyzer (warning:
produces @emph{very} copious output)
@item 1
Prints basic information about actions to be executed and reports
about exit status of executed commands.
@item 2
Additionally displays each file name along with its MIME type
@item 3
Additionally traces the process of looking up the matching entry
in @code{mailcap} files.
@item digits from 4 to 9
The same as 3, currently.
@end table
If @var{flags} are not given, the default @samp{9} is assumed.
@item --metamail[=@var{file}]
Run @command{metamail} to display files, instead of using the internal
mechanisms. If @var{file} is specified, it is taken as
@command{metamail} command line.
@item -h
@itemx --no-interactive
@itemx --print
This options tells @command{mimeview} that it should run in
non-interactive mode. In this mode prompting is disabled, and
the normal mailcap @code{command} field is not executed. Instead
@command{mimeview} will execute the command specified in
the @code{print} field. If there is nothing in the print field,
the mailcap entry is ignored and the search continues for a matching
mailcap entry that does have a @code{print} field.
Notice, that unlike in @command{metamail -h}, this option does
not force @command{mimeview} to send the output to the printer
daemon.
When used with @option{--metamail} option, this option passes
@option{-h} flag to the invocation of @command{metamail}.
By default @command{mimeview} behaves as if given
@option{--no-interactive} option whenever its standard input is not
a @asis{tty} device.
@item -n
@itemx --dry-run
Do not do anything, just print what would be done. Implies
@option{--debug=1}, unless the debugging level is set up explicitly.
@item -t @var{file}
@itemx --mimetypes @var{file}
Use @var{file} as @file{mime.types} file. If @var{file} is a
directory, use @file{@var{file}/mime.types}
@end table
@node Mimeview Config
@subsection Mimeview Config
The following configuration statements affect the behavior of
@command{mimeview}:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@end multitable
@deffn {Mimeview Config} debug @var{number}
Set @command{mimeview} debug level. @xref{Mimeview Invocation,
--debug}, for a description of debug levels.
@end deffn
@deffn {Mimeview Config} mimetypes @var{file}
Read @var{file} instead of the default @file{mime.types}.
@end deffn
@deffn {Mimeview Config} metamail @var{program}
Use @var{program} to display files.
@end deffn
@page
@node pop3d
@section POP3 Daemon
@pindex pop3d
@UNREVISED
The @command{pop3d} daemon implements the Post Office Protocol
Version 3 server.
@command{pop3d} has two operation modes:
@table @asis
@item Inetd
The server is started from @file{/etc/inetd.conf} file:
@example
pop3 stream tcp nowait root /usr/local/sbin/pop3d pop3d
@end example
This is the default operation mode.
@item Standalone
The server runs as daemon, forking a child for each new connection.
@end table
The server operation mode is configured using @code{mode} statement
(@pxref{Server Settings, mode}).
@menu
* Login delay::
* Auto-expire::
* Bulletins::
* Conf-pop3d:: Pop3d Configuration
* Command line options::
@end menu
@node Login delay
@subsection Login delay
POP3 clients often login frequently to check for new mail. Each new
connection implies authenticating the user and opening his maildrop
and can be very resource consuming. To reduce server load, it is
possible to impose a minimum delay between any two consecutive logins.
This is called @samp{LOGIN-DELAY} capability and is described in RFC
2449.
As of version @value{VERSION}, GNU Mailutils @command{pop3d} allows
to set global login delay, i.e. such enforcement will affect all POP3
users. If a user attempts to log in before the specified login delay
expires, he will get the following error message:
@example
-ERR [LOGIN-DELAY] Attempt to log in within the minimum login delay interval
@end example
The message will be issued after a valid password is entered. This prevents
this feature from being used by malicious clients for account
harvesting.
To enable the login delay capability, specify the minimum delay
using @code{login-delay} configuration statement, e.g.:
@example
login-delay 60;
@end example
The @command{pop3d} utility keeps each user's last login time in a
special DBM file, called @dfn{login statistics database}, so to be
able to use this feature, Mailutils must be compiled with DBM support.
By default, the login statistics database is called
@file{/var/run/pop3-login.db}. You can change its name using
@code{stat-file} configuration statement:
@example
login-delay 60;
stat-file /tmp/pop.login.db;
@end example
The login delay facility will be enabled only if @command{pop3d} is
able to access the statistics database for both reading and
writing. If it is not, it will report this using @command{syslog} and
start up without login delay restrictions. A common error message
looks like:
@example
Unable to open statistics db: Operation not permitted
@end example
You can check whether your @command{pop3d} uses login delays by
connecting to it and issuing the @samp{CAPA} command. If login delays
are in use, there response will contain the string @samp{LOGIN-DELAY
@var{n}}, where @var{n} is the actual login delay value.
@node Auto-expire
@subsection Auto-expire
Automatic expiration of messages allows you to limit the period of
time users are permitted to keep their messages on the server. It is
enabled by @code{expire} configuration statement:
@table @code
@item expire @var{n};
Enable automatic expiration of messages after @var{n} days.
@end table
The current implementation works as follows. When a message is
downloaded by @code{RETR} or @code{TOP} command, it is marked with
@samp{X-Expire-Timestamp: @var{n}} header, where @var{n} is current
value of UNIX timestamp. The exact expiration mechanism
depends on you. Mailutils allows you two options:
@enumerate
@item
Expired messages are deleted by @command{pop3d} upon closing the
mailbox. You specify this mechanism using @code{delete-expired}
configuration statement:
@table @command
@item delete-expired @var{bool};
If @var{bool} is @samp{true}, delete expired messages after receiving
the @code{QUIT} command.
@end table
@item
Expired messages remain in the mailbox after closing it. The system
administrator is supposed to run a cron job that purges the mailboxes.
Such a cron job can be easily implemented using @command{sieve} from
GNU Mailutils and the following script:
@example
@group
require "timestamp";
# @r{Replace "5" with the desired expiration period}
if timestamp :before "X-Expire-Timestamp" "now - 5 days"
@{
discard;
@}
@end group
@end example
This script will remove expired messages 5 days after the
retrieval. Replace @samp{5} with the desired expiration period and
make sure it equals the argument to @command{expire} configuration keyword.
@end enumerate
The statement @code{expire 0} means the client is not permitted to
leave mail on the server. It always implies @code{delete-expired true}.
@node Bulletins
@subsection Bulletins
The bulletin feature allows you to send important announcements to
all POP3 users without mailing them. It works by creating a
@dfn{bulletin source mailbox} and sending the announcements to it.
After a user successfully authenticates, @command{pop3d} checks the
last @dfn{bulletin number} the user receives. The bulletin number
refers to the number of the bulletin message in the bulletin source
mailbox. If the latter contains more messages, these are appended to
the user mailbox.
The user last bulletin number can be kept in two places. First, it
can be stored in file @file{.popbull} in his home directory. Secondly,
if Mailutils is compiled with DBM support, the numbers can be kept in
a DBM file, supplied via @code{bulletin-db} configuration statement. If
both the database and the @file{.popbull} file are present, the data
from the database take precedence.
To enable this feature, use the following configuration statements:
@table @code
@item bulletin-source @var{mbox}
Set the @acronym{URL} of the bulletin source mailbox.
@item bulletin-db @var{file}
Set the name of the database file to keep last bulletin numbers in.
@end table
The following example instructs @command{pop3d} to look for the
bulletin messages in @acronym{MH} folder @file{/var/spool/bull/mbox}
and to keep the database of last delivered bulletin numbers in
@file{/var/spool/bull/numbers.db}:
@example
@group
bulletin-source mh:/var/spool/bull/mbox;
bulletin-db /var/spool/bull/numbers.db;
@end group
@end example
@node Conf-pop3d
@subsection Pop3d Configuration
The following configuration file statements affect the behavior of
@command{pop3d}.
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@item logging @tab @xref{Logging Statement}.
@item pam @tab @xref{PAM Statement}.
@item sql @tab @xref{SQL Statement}.
@item virtdomain @tab @xref{Virtdomain Statement}.
@item radius @tab @xref{Radius Statement}.
@item ldap @tab @xref{LDAP Statement}.
@item auth @tab @xref{Auth Statement}.
@item server @tab @xref{Server Settings}.
@item acl @tab @xref{ACL Statement}.
@item tcp-wrappers @tab @xref{Tcp-wrappers Statement}.
@end multitable
@deffn {Pop3d Conf} undelete @var{bool}
On startup, clear deletion marks from all the messages.
@end deffn
@deffn {Pop3d Conf} expire @var{n}
Automatically expire read messages after @var{n}
days. @xref{Auto-expire}, for a detailed description.
@end deffn
@deffn {Pop3d Conf} delete-expired @var{bool}
Delete expired messages upon closing the mailbox. @xref{Auto-expire},
for a detailed description.
@end deffn
@deffn {Pop3d Conf} tls-required @var{bool}
Always require @code{STLS} command before entering authentication
phase.
@end deffn
@deffn {Pop3d Conf} login-delay @var{duration}
Set the minimal allowed delay between two successive logins.
@xref{Login delay}, for more information.
@end deffn
@deffn {Pop3d Conf} stat-file @var{file}
Set the name of login statistics file for the @code{login-delay}
facility. @xref{Login delay}, for more information.
@end deffn
@deffn {Pop3d Conf} bulletin-source @var{file}
Get bulletins from the specified mailbox. @xref{Bulletins}, for a
detailed description.
@end deffn
@deffn {Pop3d Conf} bulletin-db @var{file}
Set bulletin database file name. @xref{Bulletins}, for a
detailed description.
@end deffn
@node Command line options
@subsection Command line options
The following table summarizes all @command{pop3d} command line options.
@table @option
@item -d[@var{number}]
@itemx --daemon[=@var{number}]
Run in standalone mode. An optional @var{number} specifies the maximum number
of child processes allowed to run simultaneously. When it is omitted,
it defaults to 10 processes.
@emph{Please note}, that there should be no whitespace between the
@option{-d} and its parameter.
@item -i
@itemx --inetd
Run in inetd mode.
@item -h
@itemx --help
Display short help message and exit.
@item --foreground
Remain in foreground.
@item --tls[=@var{bool}]
Enable TLS. If optional argument is supplied and is @samp{false}, then
disable it.
@item --debug-auth
Enable debugging of authentication functions.
@end table
@page
@node imap4d
@section IMAP4 Daemon
@pindex imap4d
@UNREVISED
GNU @command{imap4d} is a daemon implementing @sc{imap4} rev1 protocol
for accessing and handling electronic mail messages on a server. It can
be run either as a standalone program or from @file{inetd.conf} file.
@menu
* Namespace:: Namespace.
* Conf-imap4d:: Configuration.
* Starting imap4d:: Invocation Options.
@end menu
@node Namespace
@subsection Namespace
@cindex namespace
@cindex IMAP4 namespace
GNU @command{imap4d} supports a notion of @dfn{namespaces} defined
in RFC 2342. A namespace is a set of directories upon which the user
has certain permissions. It should be understood that these permissions
apply only if the underlying filesystem allows them.
The three namespaces supported by @command{imap4d} are:
@table @asis
@item Personal Namespace
A namespace that is within the personal scope of the authenticated user
on a particular connection. The user has all permissions on this namespace.
@item Other Users' Namespace
A namespace that consists of mailboxes from the ``Personal Namespaces''
of other users. The user can read and list mailboxes from this
namespace. However, he is not allowed to use @samp{%} and @samp{*}
wildcards with @command{LIST} command, that is he can access a
mailbox only if he knows exactly its location.
@item Shared Namespace
A namespace that consists of mailboxes that are intended to be shared
amongst users and do not exist within a user's Personal Namespace.
The user has all permissions on this namespace.
@end table
@noindent
By default, @command{imap4d} starts with the following namespaces:
@table @asis
@item Personal Namespace
The home directory of the user, if exists.
@item Other Users' Namespace
Empty
@item Shared Namespace
Empty
@end table
@emph{Note}, that this means that by default, a user won't be able to
see or otherwise access mailboxes residing in the directories other than
his own home.
To change these defaults, use @code{shared-namespace} and
@code{other-namespace} configuration statements:
@table @command
@item shared-namespace @var{list}
Set shared namespace.
@item other-namespace @var{list}
Set other users' namespace.
@end table
For both statements, the argument is a list of directories that belong
to this namespace, e.g.:
@example
shared-namespace (/var/spool/mail,/var/mail);
@end example
If during the session the user creates a mailbox within either of
these namespaces, the mode of the mailbox is determined by the
following configuration statements:
@table @command
@item shared-mailbox-mode @var{mode}
Set file mode for mailboxes created in shared namespace.
@item other-mailbox-mode @var{mode}
Set file mode for mailboxes created in other users' namespace.
@end table
In both cases, the argument, @var{mode} is a list of symbolic mode
settings, similar to that used by @command{chmod}. It is a list of
comma-separated mode change commands. Each command begins with a
letter @samp{g}, which means set mode bits for file group, or
@samp{o}, which means set mode bits for other users (note, that there
is no @samp{u} specifier, since user ownership of his mailbox cannot
be changed). This letter is followed by an @samp{=} (or @samp{+}), and
a list of modes to be set. This list can contain only two letters:
@samp{r} to set read permission, and @samp{w} to set write permission.
For example, the following statement sets read and write permissions
for the group:
@example
shared-namespace-mode g=rw;
@end example
@node Conf-imap4d
@subsection Configuration of @command{imap4d}.
The behavior of @command{imap4d} is altered by the following
configuration statements:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item tls @tab @xref{TLS Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@item logging @tab @xref{Logging Statement}.
@item pam @tab @xref{PAM Statement}.
@item sql @tab @xref{SQL Statement}.
@item virtdomain @tab @xref{Virtdomain Statement}.
@item radius @tab @xref{Radius Statement}.
@item ldap @tab @xref{LDAP Statement}.
@item auth @tab @xref{Auth Statement}.
@item server @tab @xref{Server Settings}.
@item acl @tab @xref{ACL Statement}.
@item tcp-wrappers @tab @xref{Tcp-wrappers Statement}.
@end multitable
@deffn {Imap4d Conf} shared-namespace @var{list}
Set shared namespace. @var{List} is a list of
strings. @xref{Namespace}, for a detailed description.
@end deffn
@deffn {Imap4d Conf} other-namespace @var{list}
Set other users' namespace. @var{List} is a list of
strings. @xref{Namespace}, for a detailed description.
@end deffn
@deffn {Imap4d Conf} shared-mailbox-mode @var{str}
Set file mode for mailboxes created within shared namespace.
@xref{Namespace}, for a detailed description.
@end deffn
@deffn {Imap4d Conf} other-mailbox-mode @var{str}
Set file mode for mailboxes created within other users' namespace.
@xref{Namespace}, for a detailed description.
@end deffn
@deffn {Imap4d Conf} login-disabled @var{bool}
Disable @code{LOGIN} command, if @var{bool} is @samp{true}.
@end deffn
@deffn {Imap4d Conf} create-home-dir @var{bool}
Create nonexistent user home directories. See also home-dir-mode, below.
@end deffn
@deffn {Imap4d Conf} home-dir-mode @var{mode}
Set file mode for created user home directories. Mode is specified in
octal.
The default value for @var{mode} is @samp{700} (@samp{drwx------} in
@code{ls} terms).
@end deffn
@deffn {Imap4d Conf} tls-required @var{bool}
Require successful @code{STARTTLS} command before entering
authentication phase.
@end deffn
@deffn {Imap4d Conf} preauth @var{mode}
Configure PREAUTH mode. Valid arguments are:
@table @asis
@item prog:///@var{program-name}
@command{Imap4d} invokes an external program to authenticate the
connection. The command line is obtained from the supplied string,
by expanding the following meta-variables:
@table @code
@item $@{client_address@}
Remote IP address in dotted-quad notation;
@item $@{client_port@}
Remote port number;
@item $@{server_address@}
Local IP address;
@item $@{server_port@}
Local port number.
@end table
If the connection is authenticated, the program should print the
user name, followed by a newline character, on its standard
output and exit with code @samp{0}.
Otherwise, it should exit with a non-zero exit code.
@item ident[://:@var{port}]
The remote machine is asked about the requester identity
using the identification protocol (RFC 1413). Both plaintext and
DES encrypted replies are understood. Optional @var{port} specifies
the port to use, if it differs from the default @samp{113}. It can be
either a decimal port number or a symbolic name of a service, listed
in @file{/etc/services}.
@item stdio
PREAUTH mode is enabled automatically if imap4d is started
from command line in interactive mode (@option{-i} command line
option). The current login name is used as the user name.
@end table
@end deffn
@deffn {Imap4d Conf} preauth-only @var{bool}
If @var{bool} is @samp{true}, use only preauth mode. If unable to
setup it, disconnect immediately.
@end deffn
@deffn {Imap4d Conf} ident-keyfile @var{file}
Set DES keyfile for decoding encrypted ident responses. Used with
@samp{ident://} preauth mode.
@end deffn
@deffn {Imap4d Conf} ident-encrypt-only @var{bool}
Use only encrypted IDENT responses.
@end deffn
@deffn {Imap4d Conf} id-fields @var{list}
Set list of fields to return in response to ID command.
Valid field names are:
@table @asis
@item name
Package name (@samp{GNU Mailutils}).
@item version
Package version (@samp{@value{VERSION}}).
@item vendor
Vendor name (@samp{GNU}).
@item support-url
The string @samp{http://www.gnu.org/software/mailutils}
@item address
The string @samp{51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA}.
@item os
OS name.
@item os-version
OS version number.
@item command
Name of the @command{imap4d} binary.
@item arguments
Invocation command line.
@item environment
List of environment variables with their values.
@end table
@end deffn
@node Starting imap4d
@subsection Starting @command{imap4d}
@command{imap4d} may run either in @dfn{standalone} or in @dfn{inetd}
operation modes. When run in ``standalone'' mode, the server disconnects
from the terminal and runs as a daemon, forking a child for each new
connection.
The ``inetd'' mode allows to start the server from
@file{/etc/inetd.conf} file. This is the default operation mode.
@example
imap4 stream tcp nowait root /usr/local/sbin/imap4d imap4d
@end example
@subheading Command Line Options
@table @option
@item -d[@var{number}]
@itemx --daemon[=@var{number}]
Run in standalone mode. An optional @var{number} specifies the maximum number
of child processes the daemon is allowed to fork. When it is omitted,
it defaults to 20 processes.
@emph{Please note}, that there should be no whitespace between the
@option{-d} and its parameter.
@item -h
@itemx --help
Display short help message and exit.
@item -i
@itemx --inetd
Run in inetd mode.
@item --foreground
Run in foreground.
@item --preauth
Start in preauth mode
@item --tls[=@var{bool}]
Enable TLS support
@item --debug-auth
Debug authentication functions.
@item -v
@itemx --version
Display program version and exit.
@end table
@page
@node comsatd
@section Comsat Daemon
@pindex comsatd
@UNREVISED
Comsatd is the server which receives reports of incoming mail and
notifies users, wishing to get this service. It can be started
either from @file{inetd.conf} or as a standalone daemon.
@menu
* Starting comsatd:: Invocation.
* Configuring comsatd:: Configuration of @command{comsatd}.
* dot.biffrc:: A per-user configuration file.
@end menu
@node Starting comsatd
@subsection Starting @command{comsatd}
@command{Comsatd} uses following option groups: @FIXME-xref{mailbox},
@FIXME-xref{daemon}, @FIXME-xref{logging}.
@table @option
@item -C @var{file}
@itemx --convert-config=@var{file}
Convert the configuration file @var{file} to the new
format. @var{File} must be a @command{comsatd} configuration file in
Mailutils v. 1.x format. The converted file is printed on the standard
output. For example, the following command can be used to convert old
@command{comsatd} configuration file to new format:
@example
$ comsatd --convert-config=/etc/comsatd.conf > /etc/mailutils.d/comsatd
@end example
@item -d
@itemx --daemon
Run as a standalone daemon.
@item -i
@itemx --inetd
The server is started from @file{/etc/inetd.conf} file:
@example
comsat dgram udp wait root /usr/sbin/comsatd \
comsatd -c /etc/comsat.conf
@end example
This is the default operation mode.
@item -t
@itemx --test
Test mode. In this mode, @command{comsatd} takes two arguments:
@acronym{URL} of a mailbox and @acronym{QID} of the message from that
mailbox, e.g.:
@example
$ comsatd --test /var/mail/root 34589
@end example
@end table
@node Configuring comsatd
@subsection Configuring @command{comsatd}
Following configuration statements affect the behavior of
@command{comsatd}:
@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug @tab @xref{Debug Statement}.
@item logging @tab @xref{Logging Statement}.
@item mailbox @tab @xref{Mailbox Statement}.
@item locking @tab @xref{Locking Statement}.
@item acl @tab @xref{ACL Statement}.
@end multitable
@menu
* General Settings::
* Security Settings::
@end menu
@node General Settings
@subsubsection General Settings
These statements control the general behavior of the comsat daemon:
@deffn {Comsatd Conf} max-lines @var{number}
Set maximum number of message body lines to be output.
@end deffn
@deffn {Comsatd Conf} allow-biffrc @var{bool}
Enable or disable processing of user's @file{.biffrc} file. By default,
it is enabled.
@end deffn
@node Security Settings
@subsubsection Security Settings
These statements control the way @command{comsatd} fights possible
flooding attacks.
@deffn {Comsatd Conf} max-requests @var{number}
Set maximum number of incoming requests per
@samp{request-control-interval}.
@end deffn
@deffn {Comsatd Conf} request-control-interval @var{duration}
Set the request control interval.
@end deffn
@deffn {Comsatd Conf} overflow-delay-time @var{duration}
Set initial amount of time to sleep, after the first overflow occurs.
@end deffn
@deffn {Comsatd Conf} overflow-control-interval @var{duration}
Set overflow control interval. If two consecutive overflows happen
within that interval, the overflow-delay-time is doubled.
@end deffn
@node dot.biffrc
@subsection A per-user Configuration File
By default, when a notification arrives, @command{comsatd} prints subject,
from headers and the first five lines from the new message to the user's
tty. The user is allowed to change this behavior by using his own
configuration file. This file should be located in the user's home
directory and should be named @file{.biffrc}. It must be owned by the
user and have its permissions bits set to 0600. (@emph{Please note},
that the use of per-user configuration files may be disabled, by
specifying @samp{allow-biffrc no} in the main configuration file, see
@pxref{Configuring comsatd}).
The @file{.biffrc} file consists of a series of statements. Each
statement occupies one line and defines an action to be taken upon
arrival of a new mail. Very long lines may be split using @samp{\} as
the last character on the line. As usual, comments may be introduced with
@samp{#} character.
The actions specified in @file{.biffrc} file are executed in turn.
The following actions are defined:
@table @asis
@item beep
Produce an audible signal.
@item echo [-n] @var{string} [@var{string}...]
Output the arguments to the user's terminal device. If several
arguments are given they will be output separated by single
spaces. The newline character will be printed at the end of the
output, unless the @option{-n} option is used.
@item exec @var{prog} @var{arglist}
Execute program @var{prog} with arguments from @var{arglist}. @var{prog}
must be specified with absolute pathname. It may not be a setuid or
setgid program.
@end table
In the description above, @var{string} denotes any sequence of
characters. This sequence must be enclosed in a pair of double-quotes,
if it contains whitespace characters. The @samp{\} character inside a
string starts a C escape sequence. Following meta-characters may be
used in strings:
@table @asis
@item $u
Expands to username
@item $h
Expands to hostname
@item $H@{name@}
Expands to value of message header @samp{name}.
@item $B(@var{c},@var{l})
Expands to message body. @var{c} and @var{l} give maximum number of
characters and lines in the expansion. When omitted, they default to 400, 5.
@end table
@subsubheading Example I
Dump to the user's terminal the contents of @samp{From} and
@samp{Subject} headers followed by at most 5 lines of message body.
@example
@group
echo "Mail to \a$u@@$h\a\n---\n\
From: $H@{from@}\n\
Subject: $H@{Subject@}\n\
---\n\
$B(,5)\
---\n"
@end group
@end example
@noindent
The above example can also be written as:
@example
@group
echo Mail to \a$u@@$h\a
echo ---
echo From: $H@{From@}
echo Subject: $H@{Subject@}
echo ---
echo $B(,5)
echo ---
@end group
@end example
@subsubheading Example II
Produce a bell, then pop up the xmessage window on display :0.0 with
the text formatted in the same manner as in the previous example.
@example
@group
beep
exec /usr/X11R6/bin/xmessage \
-display :0.0 -timeout 10 "Mail to $u@@$h \n---\n\
From: $H@{from@}\n\
Subject: $H@{Subject@}\n\
---\n\
$B(,5)\
---\n"
@end group
@end example
@page
@node mh
@section MH --- The MH Message Handling System
@UNREVISED
@include mu-mh.texi
@page
@node mailutils
@section mailutils
@pindex mailutils
The @command{mailutils} utility is a multi-purpose tool shipped with
Mailutils. It can be used for various mail and database-related
tasks, as well as an auxiliary tool for compiling and linking programs
with Mailutils.
@menu
* mailutils invocation syntax::
* mailutils help:: Display a terse help summary.
* mailutils info:: Show Mailutils configuration.
* mailutils cflags:: Show compiler options.
* mailutils ldflags:: List libraries required to link.
* mailutils query:: Query configuration values.
* mailutils 2047:: Decode/encode email message headers.
* mailutils filter:: Apply a chain of filters to the input.
* mailutils acl:: Test access control lists.
* mailutils wicket:: Scan wickets for matching URLs.
* mailutils dbm:: DBM management tool.
* mailutils logger:: Log data using Mailutils log facility.
* mailutils pop:: POP3 client shell.
* mailutils imap:: IMAP4 client shell.
* mailutils send:: Send a message.
* mailutils smtp:: Run a SMTP session.
@end menu
@node mailutils invocation syntax
@subsection Invocation Syntax
@command{Mailutils} is a command line tool. Its invocation syntax is:
@example
mailutils [@var{options}] @var{command} [@var{args}]
@end example
where @var{options} are options that affect the behavior of
@command{mailutils} as a whole, @var{command} instructs it what it is to do
and @var{args} are any arguments the @var{command} needs in order to be
executed.
The commands are:
@table @asis
@item 2047
Decodes or encodes email message headers.
@item acl
Tests Mailutils access control lists.
@item cflags
Shows compiler options needed to compile with Mailutils.
@item dbm
Invokes a DBM management tool.
@item ;filter
Applies a chain of filters to the input.
@item help
Displays a terse help summary.
@item imap
Invokes an IMAP4 client shell (in development).
@item info
Displays information about Mailutils compile-time configuration.
@item ldflags
Constructs a @command{ld}(1) command line for linking a program with Mailutils.
@item logger
Logs information using Mailutils log facility.
@item pop
Invokes a POP3 client shell.
@item query
Queries configuration values.
@item wicket
Scans wicket for matching URLs
@end table
@node mailutils help
@subsection mailutils help
The @command{mailutils help} command lists all available options and command
names along with short descriptions of what each of them does. It is
similar to the @command{mailutils --help} option.
A command name can be supplied as an argument to
@command{help}, in which case it will display a help page for that
particular command, e.g.:
@example
mailutils help ldflags
@end example
will output help for the @command{ldflags} command. It is synonymous
to the @option{--help} option used with that particular command, e.g.:
@command{mailutils ldflags --help}.
@node mailutils info
@subsection mailutils info
The @command{mailutils info} command displays information about Mailutils
compile-time configuration. In normal form its output lists a single
configuration flag per line, e.g.:
@example
$ mailutils info
VERSION=2.99.93
SYSCONFDIR=/etc
MAILSPOOLDIR=/var/mail/
SCHEME=mbox
LOG_FACILITY=mail
IPV6
USE_LIBPAM
HAVE_LIBLTDL
WITH_GDBM
WITH_GNUTLS
WITH_GSASL
@end example
A configuration flag can consist either of a single word, indicating
that a particular capability has been enabled at compile time, or of a
keyword/value pair delimited by an equal sign, which indicates a
particular value used by default for that feature. For example,
@samp{IPV6} means that Mailutils was compiled with support for IPv6,
whereas @samp{SYSCONFDIR=/etc} means that the default place for
configuration files is in @file{/etc} directory.
Such short output is convenient for using @command{mailutils info} in scripts
to decide whether it is possible to use a given feature. To assist
human users, the @option{--verbose} (@option{-v}) option is provided.
It prints a short description next to each flag:
@example
$ mailutils info --verbose
VERSION=2.99.93 - Version of this package
SYSCONFDIR=/etc - System configuration directory
MAILSPOOLDIR=/var/mail/ - Default mail spool directory
SCHEME=mbox - Default mailbox type
LOG_FACILITY=mail - Default syslog facility
IPV6 - IPv6 support
USE_LIBPAM - PAM support
HAVE_LIBLTDL - a portable `dlopen' wrapper library
WITH_GDBM - GNU DBM
WITH_GNUTLS - TLS support using GNU TLS
WITH_GSASL - SASL support using GNU SASL
@end example
@node mailutils cflags
@subsection mailutils cflags
The @command{mailutils cflags} command shows compiler options needed to
compile a C source with Mailutils. It is intended for use in
configuration scripts and Makefiles, e.g.:
@example
CFLAGS=-g -O2 `mailutils cflags`
@end example
@node mailutils ldflags
@subsection mailutils ldflags
The @command{mailutils ldflags} command is a counterpart of @command{cflags}
which is used for linking. It constructs a @command{ld} command line
for linking a program with Mailutils.
When used without arguments, it outputs @command{ld} arguments which
would link only with the core Mailutils library @file{libmailutils}, e.g.:
@example
$ mailutils ldflags
-L/usr/local/lib -lmailutils
@end example
This command accepts a number of keywords which allow to select a
particular subset of Mailutils libraries to link with. In particular,
the argument @samp{all} instructs it to link in all available libraries:
@example
$ mailutils ldflags all
-L/usr/local/lib -lmu_mbox -lmu_mh -lmu_maildir -lmu_imap -lmu_pop \
-lmu_mailer -lmu_compat -lmailutils -lmu_auth -lgsasl -lgnutls -lgcrypt \
-lldap -lgnuradius -lpam -ldl
@end example
Other available keywords are:
@table @asis
@item mbox
Link in the UNIX mbox format support.
@item mh
Link in the MH format support.
@item maildir
Link in the Maildir format support.
@item imap
Link in the IMAP protocol support.
@item pop
Link in the POP protocol support.
@item nntp
Link in the NNTP protocol support.
@item mailer
Enable support for mailers.
@item sieve
Link in the support for Sieve mail filtering language.
@item dbm
Link in the support for DBM databases (libmu_dbm library).
@item compat
Provide a compatibility layer for Mailutils 2.x.
@item auth
Link in the Mailutils authentication library.
@item guile
Provide Guile language bindings.
@item python
Provide Python language bindings.
@item cfg
Link in the Mailutils configuration library.
@item argp
Link in the library for command line parsing.
@end table
@node mailutils query
@subsection mailutils query
The @command{mailutils query} command queries values from Mailutils
configuration files. It takes one or more configuration paths
(@pxref{Paths}) as its arguments. On output, it displays the values
it found, each value on a separate line. If the requested value is a
block statement it is displayed in full. For example, if main
configuration file contained:
@example
logging @{
syslog yes;
facility mail;
@}
@end example
Then:
@example
$ mailutils query .logging.syslog
syslog yes;
$ mailutils query .logging.syslog .logging.facility
syslog yes;
facility mail;
$ mailutils query .logging
logging @{
syslog yes;
facility mail;
@};
@end example
Several command line options allow to modify output format. The
@option{--value} option instructs the command to output only values:
@example
$ mailutils query --value .logging.syslog
yes
@end example
The @option{--path} option instructs it to print full pathnames for
each value:
@example
$ mailutils query --path .logging.syslog
logging.syslog: yes
@end example
The @option{--program} option instructs @command{mailutils} to behave as if
it was called under another program name. For example, the following
command:
@example
$ mailutils query --program=pop3d .server.transcript
@end example
will return the value of the @samp{.server.transcript} statement which
the @command{pop3d} utility would see.
By default, @command{mailutils query} operates on the main configuration
file. Another configuration file can be supplied using the
@option{--file} (@option{-f}) option:
@example
$ mailutils query --file /usr/local/etc/file.conf .pidfile
@end example
@node mailutils 2047
@subsection mailutils 2047
The @command{mailutils 2047} command is a filter for decoding or encoding
email message headers formatted in accordance with RFC 2047 (see
@uref{http://www.faqs.org/rfcs/rfc2047.html}. By default, it operates
in encode mode and assumes the @samp{iso-8859-1} encoding. If
arguments are supplied in the command line, they are treated as the
text to operate upon. Otherwise the command acts as a UNIX filter,
reading lines from the standard input and printing results on the
standard output.
For example:
@example
$ mailutils 2047 'Keld J@o{}rn Simonsen <keld@@dkuug.dk>'
=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@@dkuug.dk>
@end example
The decode mode can be requested via the @option{--decode}
(@option{-d}) option:
@example
$ mailutils 2047 --decode '=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= \
<keld@@dkuug.dk>'
Keld J@o{}rn Simonsen <keld@@dkuug.dk>
@end example
The @option{--charset} (@option{-c}) option changes the default
character set. It is meaningful both in decode and in encode modes.
In decode mode it instructs the utility to convert the output to the
given character set. In encode mode it indicates the encoding of the
input data, which will be reflected in the resulting string:
@example
$ mailutils 2047 --charset=utf-8 'Keld J@o{}rn Simonsen <keld@@dkuug.dk>'
=?utf-8?Q?Keld J=C3=B8rn Simonsen <keld@@dkuug.dk>?=
@end example
The @option{--encoding} (@option{-E}) option can be used in encode
mode to change the output encoding. Valid arguments for this option
are: @samp{quoted-printable} (the default) or @samp{base64}.
The @option{--newline} (@option{-n}) option prints an additional
newline character after each line of output.
@node mailutils filter
@subsection mailutils filter
The @command{mailutils filter} command applies a chain of filters to the
input. The filters to apply and their arguments are given
in the command line. The full invocation syntax is:
@example
mailutils filter [@var{option}] @var{filter-chain}
@end example
The syntax for @var{filter-chain} in Backus-Naur form follows:
@example
<filter-chain> ::= <filter> | <filter-chain> "+" <filter>
<filter> ::= <filter-spec> <@var{ARG}>*
<filter-spec> ::= <@var{WORD}> | "~" <@var{WORD}>
@end example
@noindent
where @var{<WORD>} stands for the filter name and @var{<ARG>}
represents filter arguments. To obtain a list of known filter names,
run:
@example
mailutils filter --list
@end example
Filters are applied in the order of their appearence, from left to
right and operate in encode mode. The plus sign has the same meaning
as pipe in shell. The default mode can be changed using the
@option{--decode} (@option{-d}) and @option{--encode} (@option{-e}) options.
Whatever the default mode is, a @samp{~} character before filter
name reverts the mode for that filter alone.
For example, to encode the contents of file @file{file.txt} in Base64
run:
@example
mailutils filter base64 < file.txt
@end example
To convert it to base64 and use CRLF as line delimiters, run:
@example
mailutils filter base64 + crlf < file.txt
@end example
The following command will decode the produced output:
@example
mailutils filter --decode crlf + base64
@end example
It can also be written as
@example
mailutils filter ~crlf + ~base64
@end example
The following example converts the input from ISO-8859-2 to UTF-8,
quotes eventual @samp{From} occurring at the beginning of a line,
encodes the result in Base64 and changes line delimiters to CRLF:
@example
mailutils filter iconv iso-8859-2 utf-8 + from + base64 + crlf
@end example
This final example removes UNIX-style comments from the input and
joins continuation lines:
@example
mailutils filter --decode inline-comment -S '#' + linecon
@end example
Such invocation can be useful in shell scripts to facilitate
configuration file processing.
@node mailutils acl
@subsection mailutils acl
The @command{mailutils acl} command tests Mailutils Access Control Lists. By
default it reads ACL from the Mailutils configiration file section
@samp{acl}. The command takes a list of IP addresses as its
arguments, applies the ACL to each of them in turn and prints the result.
To select the ACL to test, two options are provided. The
@option{--file} (@option{-f}) option supplies the name of
configuration file to read instead of the default one. The
@option{--path} (@option{-p} option supplies the pathname
(@pxref{Paths}) of the ACL section to use instead of the default @samp{.acl}. For example, to test ACL in section @samp{server 213.130.1.232} of file @file{/etc/pop3d.conf} use:
@example
mailutils acl --file=/etc/pop3d.conf \
--path=/server="213.130.1.232"/acl @var{address}
@end example
As an example of its use, consider file @file{test.conf} with the
following contents:
@example
acl @{
deny from 10.10.10.1;
deny from 10.10.1.0/24;
log from any "Connect from $@{address@}";
allow from 10.0.0.0/8;
allow from 192.168.1.0/24;
deny from any;
@}
@end example
Then, running @command{mailutils acl --file=test.conf 127.0.0.1} you will get:
@example
Testing 127.0.0.1:
mailutils: Connect from 127.0.0.1
127.0.0.1: deny
@end example
More examples:
@example
$ mailutils acl --file=test.conf 127.0.0.1 10.10.10.1 \
10.10.1.3 10.5.3.1 192.168.1.0 192.168.2.0
Testing 127.0.0.1:
mailutils: Connect from 127.0.0.1
127.0.0.1: deny
Testing 10.10.10.1:
10.10.10.1: deny
Testing 10.10.1.3:
10.10.1.3: deny
Testing 10.5.3.1:
mailutils: Connect from 10.5.3.1
10.5.3.1: accept
Testing 192.168.1.0:
mailutils: Connect from 192.168.1.0
192.168.1.0: accept
Testing 192.168.2.0:
mailutils: Connect from 192.168.2.0
192.168.2.0: accept
@end example
The @command{mailutils} option @option{--debug-level} will give you a deeper
insight into the address matching algorithm:
@example
$ mailutils --debug-level=acl.trace9 acl --file test.conf 127.0.0.1
Testing 127.0.0.1:
mailutils: Checking sockaddr 127.0.0.1
mailutils: 1:deny: Does 10.10.10.1/255.255.255.255 match 127.0.0.1? no;
mailutils: 2:deny: Does 10.10.1.0/255.255.255.0 match 127.0.0.1? no;
mailutils: 3:log: Does any match 127.0.0.1? yes;
mailutils: Expanding "Connect from $@{address@}";
mailutils: Expansion: "Connect from 127.0.0.1";.
mailutils: Connect from 127.0.0.1
mailutils: 4:accept: Does 10.0.0.0/255.0.0.0 match 127.0.0.1? no;
mailutils: 5:accept: Does 192.168.0.0/255.255.0.0 match 127.0.0.1? no;
mailutils: 6:deny: Does any match 127.0.0.1? yes;
127.0.0.1: deny
@end example
@xref{Debugging Categories,acl}.
@node mailutils wicket
@subsection mailutils wicket
The @command{mailutils wicket} command looks up matching URLs in the
Mailutils ticket file (by default, @file{~/.mu-tickets}) and prints
them. The URLs to look for are supplied in the command line.
Consider the following ticket file as an example:
@example
smtp://foo:bar@@*
smtp://bar:baz@@gnu.org
*://baz:qux@@*
*://quux:bar@@gnu.org
@end example
Now, running @command{mailutils wicket smtp://bar@@gnu.org} will show:
@example
smtp://bar@@gnu.org: /home/@var{user}/.mailutils-tickets:2
@end example
@noindent
(where @var{user} is your login name). This means that this URL
matches the line 2 in your @file{.mailutils-tickets} file. The
@command{wicket} command does not show the actual matching line to
avoid revealing eventual security-sensitive information. You can
instruct it to do so using the @option{--verbose} (@option{-v})
option:
@example
$ mailutils wicket -v smtp://bar@@gnu.org
smtp://bar@@gnu.org: /home/@var{user}/.mu-tickets:2: smtp://bar:***@@gnu.org
@end example
As you see, even in that case the tool hides the actual password part
by replacing it with three asteriscs. If you are working in a secure
environment, you can tell @command{mu wicket} to show passwords as
well, by supplying the @option{-v} option twice.
A counterpart of @option{--verbose} is the @option{--quite}
(@option{-q}) option, which instructs @command{wicket} to suppress any
output, excepting error messages. This can be used in scripts, which
analyze the @command{mailutils wicket} exit code to alter the control flow.
The @command{mailutils wicket} tool exits with code 0 if all URLs were
matched and with code 1 if some of them were not matched in the ticket
file. If an error occurred, the code 2 is returned.
@node mailutils dbm
@subsection mailutils dbm
The @command{mailutils dbm} tool manages DBM files using @file{libmu_dbm}
The invocation syntax is:
@example
mailutils dbm @var{subcommand} [@var{options}] @var{file} [@var{keys}]
@end example
@noindent
or
@example
mailutils dbm [@var{options}] @var{subcommand} @var{file} [@var{keys}]
@end example
@noindent
where @var{subcommand} selects the operation mode, @var{options}
modify the tool behavior and @var{file} specifies the DBM file to
operate upon. Some @var{command}s allow for optional @var{keys} to be
specified.
The @var{file} argument can be either a DBM file name or a Database URL.
@menu
* Create a Database::
* Add Records to a Database::
* Delete Records::
* List the Database::
* Dump the Database::
* Dump Formats::
* Dbm Exit Codes::
@end menu
@node Create a Database
@subsubsection Create a Database
The @option{create} subcommand and its synonym @option{load} instruct
the tool to create a new database:
@example
mailutils dbm create file.db
@end example
If the argument file already exists, it will be truncated prior to
adding new records to it.
The data to populate the database with are read from the standard
input. The @command{mailutils dbm} command supports several formats for
these data, which are discussed later. In the simplest case (a so
called @samp{format 0.0}) each input line must consist of two fields
separated by any amount of whitespace. The first field is treated as
a key and the second one as the corresponding value.
The usual way to read data from a file is, of course, by redirecting
the file to the standard input as in:
@example
mailutils dbm create file.db < input.txt
@end example
There is also a special option for that purpose: @option{--file}
(@option{-f}). Thus, the following command is equivalent to the one
above:
@example
mailutils dbm create --file input.txt file.db
@end example
The @option{--file} option has the advantage that it allows, in
conjunction with another options, for copying input file metadata
(owner UID, GID and file mode) to the created database. For example,
the following command ensures that the created database file will have
the same metadata as the input file:
@example
mailutils dbm create --file input.txt --copy-permissions file.db
@end example
The @option{--copy-permissions} (@option{-P}) option is the one that
does the job.
There are also other ways to control mode and ownership of the created
database, which are described below.
More advanced dump formats (e.g. @samp{version 1.0} format) carry
additional information about the file, including its original name,
ownership and mode. If input is in one of these formats, the file
name argument becomes optional. If it is not supplied, the name
stored in the input stream will be used. For example, supposing that
the file @file{users.dump} is in format 1.0, the following command
suffices to restore the original filename, ownership, mode and, of
course, data:
@example
mailutils dbm create --file users.dump
@end example
@node Add Records to a Database
@subsubsection Add Records to a Database
The @option{add} subcommand adds records to a database. Records are
read from the standard input and must be formatted as for
@option{create}:
@example
mailutils dbm add file.db
@end example
If the argument file does not exist, it will be created.
Adding a record with a key which is already present in the database
produces an error. To replace existing records, use the
@option{replace} subcommand instead.
The same options that affect the behavior of @option{create} apply to
@option{add} and @samp{replace} as well, e.g.:
@example
mailutils dbm replace --file input.txt --copy-permissions file.db
@end example
@node Delete Records
@subsubsection Delete Records
To delete records, use the @option{delete} subcommand. It reads a
list of keys to delete to be specified as arguments in the command
line:
@example
mailutils dbm delete file.db foo bar
@end example
The command above will delete from @file{file.db} records with keys
@samp{foo} and @samp{bar}.
It is not an error to attempt to delete a key that does not exist in
the database, although such use will produce a warning message.
By default, keys are matched literally. It is also possible to use
various pattern matching techniques, depending on the option
specified.
The @option{--glob} (@option{-G}) option instructs the tool to use UNIX globbing pattern matching. For example, the command below will delete all keys starting with @samp{foo} and ending with a decimal digit:
@example
mailutils dbm delete file.db 'foo*[0-9]'
@end example
@noindent
(note the quoting necessary to prevent shell from interpreting the
metacharacters itself).
Another option, @option{--regex} (@option{-R}) instructs @command{mailutils}
to treat supplied keys as extended regular expressions:
@example
mailutils dbm delete --regex file.db 'foo.*[0-9]@{1,3@}'
@end example
Both options are affected by the @option{--ignore-case} (@option{-i})
option, which turns on case-insensitive matching.
Using pattern matching to delete records can be a risky operation as
selecting a wrong pattern will lead to removing wrong records. It is
recommended to first use the list mode described below to verify that
the patterns match the right keys.
@node List the Database
@subsubsection List the Database
The @option{list} command lists the content of the database:
@example
mailutils dbm list file.db
@end example
By default, entire content is listed on the standard output.
If supplied more than one command line argument, this mode treats the
rest of arguments after the database file name as the keys to look for
and lists only records with these keys:
@example
$ mailutils dbm list file.db foo bar
foo 1
bar 56
@end example
The @option{--glob} and @option{--regex} options instruct the tool to
use UNIX globbing or extended regular expression matching,
correspondingly. These were described in detail above.
@node Dump the Database
@subsubsection Dump the Database
The @option{dump} subcommand dumps the database to the standard output
in a format suitable for backup or sending over the network (a
version 1.0 format).
@example
mailutils dbm dump file.db < file.dump
@end example
The produced file is suitable for input to the @option{create} (@option{load}) command. Among other uses, it provides an easy way to convert databases between various formats supported by Mailutils. For example this is how to convert the database file @file{file.db} to the GDBM database @file{new.db}:
@example
mailutils dbm dump file.db | mailutils dbm create gdbm://new.db
@end example
Both @option{list} and @option{dump} subcommands share the same set of
options. In fact, they are pretty similar, except that use different
defaults. The @option{list} subcommand is designed to produce a
human-readable output, whereas the dump subcommand is oriented towards
backup purposes.
@node Dump Formats
@subsubsection Dump Formats
As of version @value{VERSION}, @command{mailutils dbm} supports two formats
for dumping DBM databases. Both formats are line-oriented. Comments
are introduced with a sharp (@samp{#}) sign in the column 0 of a line,
followed by at least one white space character (space or tab). Sharp
sign followed by a colon (@samp{#:}) introduces a @dfn{paragmatic
comment}, which carries some additional information to the loader.
@anchor{dump version 0.0}
The @dfn{version 0.0} format is suitable for databases whose records
contain only ASCII data. In this format, each record occupies a
separate line, which consists of the key and value separated by a
single @sc{tab} character. Empty lines are ignored. For example:
@example
$ mailutils list /etc/mail/users.db
root guessme
smith pAssword
qed fooBar
@end example
The output in version 0.0 format is human readable and can be used as
input to the popauth utility (@FIXME-pxref{popauth}. However, version 0.0
has serious drawbacks. First of all, it is not suitable for databases
that contain binary data. Secondly, it cannot properly handle keys
beginning with a sharp sign or containing @sc{tab}. The version 1.0
format is free from these drawbacks.
@anchor{dump version 1.0}
The @dfn{version 1.0} dump format begins with a @dfn{header}
containing important information about the file, such as its file
name, ownership and file mode. This information is stored in
pragmatic comments and allows @command{mailutils dbm load} to easily recreate
an exact copy of the file. The following comments are defined:
@table @asis
@item #:version=1.0
Indicates that the data that follow are in version 1.0 format.
@item #:filename=@var{s}
Original database file name, without directory parts.
@item #:uid=@var{n}
Owner UID.
@item #:user=@var{s}
Owner name.
@item #:gid=@var{n}
Owner GID
@item #:group=@var{s}
Owner group name.
@item #:mode=@var{o}
File mode in octal
@end table
Following this header are actual data. Each record is output in two
parts: key and value. Each part begins with a @samp{#:len=@var{n}}
construct on a line by itself, where @var{n} is the length of the data
in decimal. This line is followed by one or more lines of the actual
data, encoded in base64. The data are formatted so that each line
does not exceed 76 bytes in length (not counting the terminating
newline). An example of this format follows:
@example
# Database dump file created by GNU Mailutils 2.99.93 on
# Tue Nov 1 13:28:03 2011
#:version=1.0
#:file=users.db
#:uid=0,user=root,gid=25,group=mail,mode=640
#:len=6
c21pdGgA
#:len=9
cEFzc3dvcmQA
#:len=5
cm9vdAA=
#:len=8
Z3Vlc3NtZQA=
#:len=4
cWVkAA==
#:len=7
Zm9vQmFyAA==
@end example
@node Dbm Exit Codes
@subsubsection Dbm Exit Codes
The table below summarizes exit codes used by @command{mailutils dbm}:
@multitable @columnfractions 0.2 0.3 0.5
@headitem Code @tab Symbolic name @tab Meaning
@item 0 @tab EX_OK @tab Successful termination
@item 64 @tab EX_USAGE @tab Command line usage error
@item 65 @tab EX_DATAERR @tab Error in user-supplied data: the input
file is badly formatted, or some of the data supplied in the command
line are invalid (e.g. user name, uid or the like), etc.
@item 66 @tab EX_NOINPUT @tab Cannot open input file
@item 67 @tab EX_NOUSER @tab No such user or UID when trying to set
output file ownership
@item 69 @tab EX_UNAVAILABLE @tab Operation cannot be performed due to
some kind of problem (e.g. access to the file denied, etc.)
@item 70 @tab EX_SOFTWARE @tab Internal software error
@item 74 @tab EX_IOERR @tab Input/output error
@end multitable
@node mailutils logger
@subsection mailutils logger
The @command{mailutils logger} tool logs information using Mailutils log facility.
Syntax:
@example
mailutils logger [@var{options}] [@var{message}]
@end example
The @var{message} argument, if supplied, gives the text to log. If not supplied, the utility reads lines of text from standard input or a file (if the @option{--file} option is given) and sends them to log:
@example
# Send text to log
$ mailutils logger I am here
# Log each line from file.txt
$ mailutils logger --file file.txt
# Read stdin and log it:
$ mailutils logger
@end example
The default logging channel is bound to standard error. To bind it to
syslog, use the @option{--syslog} command line option. In that case
@command{mailutils} uses facility @samp{user} and priority @samp{err}. You
can change this by using the @option{--priority} (@option{-p}) option.
Its argument is either a syslog facility name or facility and severity
names separated by a dot. For example, the following invocation will use
facility @samp{auth}, severity @samp{info}:
@example
mailutils logger --priority auth.info
@end example
The syslog tag can be set using the @option{--tag} (@option{-t}) option:
@example
mailutils logger --tag myprog
@end example
The default tag is @samp{mu-logger}.
The @option{--severity} (@option{-s}) option sets the Mailutils
severity level. Its argument can be any of the following:
@samp{debug}, @samp{info}, @samp{notice}, @samp{warning},
@samp{error}, @samp{crit}, @samp{alert}, @samp{emerg}.
Finally, the @option{--locus} (@option{-l}) option binds log messages
to a location in a file. Its argument has the following syntax:
@example
@var{file}:@var{line}[:@var{col}]
@end example
@noindent
where @var{file} is the file name, @var{line} is the line number and
optional @var{col} is the column number in that file.
For example, the following invocation:
@example
mailutils logger --locus mailutils.rc:34 Suspicious statement
@end example
will send the following to the log:
@example
mu-logger: mailutils.rc:34: Suspicious statement
@end example
@node mailutils pop
@subsection mailutils pop
The @command{mailutils pop} command invokes an interactive POP3 client shell.
It reads commands from the standard input, executes them and displays
the results on the standard output. If the standard input is
connected to a terminal, the readline and history facilities are
enabled (provided that Mailutils is configured with GNU Readline).
The @command{mailutils pop} commands form two major groups. POP3 protocol
commands interact with the remote POP3 server and display responses
obtained from it. These commands are named after their POP3
equivalents. Another group, @dfn{internal commands}, are used to
configure the shell itself.
@subsubheading POP protocol commands
@table @asis
@item connect [-tls] @var{hostname} [@var{port}]
Open connection to @var{hostname}. If the @option{-tls} option is
given, TLS encryption (also known as POPS protocol) will be used. If
@var{port} argument is not given, the command uses port 110 for a
plain POP connection or 995 for POPS (if @option{-tls} is given).
@item stls
Start TLS negotiation. This command is valid only after successful
unencrypted connection has been initiated (using @command{connect}
without @option{-tls} argument).
@item user @var{name}
Send user name to the server. The @command{pass} command must follow.
@item pass [@var{password}]
Send password. This command is valid only after @command{user}. If
the @var{password} argument is omitted, the shell will ask you to
enter it. While entering, both echoing and history recording will be
disabled. Use this to avoid compromising your password.
@item apop @var{user} [@var{password}]
Authenticate with APOP. If the @var{password} argument is omitted,
you will be asked to supply it. While entering, both echoing and
history recording will be disabled.
@item capa [-reread] [@var{name}...]
List server capabilities. Any number of arguments is accepted. If given, the shell will display only the named capabilities, otherwise it displays entire list. By default @command{capa} reuses the response of its previous invocation (if there was any), instead of resending the @samp{CAPA} command to the server. To force it do so, use the @option{-reread} option.
@item noop
Send a @samp{NOOP} (@dfn{no operation}) command to the server.
@item stat
Get the mailbox size and number of messages in it.
@item uidl [@var{number}]
Shows unique message identifiers. Without arguments, shows
identifiers for each message in the mailbox. If @var{number} is
given, the command returns the UIDL of that particular message only.
@item list [@var{number}]
Lists messages. See above for the meaning of @var{number}. Each line
of the produced listing contains describes a single message and
contains at least the message number and size in bytes. Depending on
the POP3 server implementation, additional fields may be present. For
example, Mailutils @command{pop3d} can also output number of lines in
the message in the additional third field.
@item retr @var{number}
Retrieve a message.
@item top @var{msgno} [@var{number}]
Display message headers and first @var{number} (default 5) of lines of its body.
@item dele @var{number}
Mark message for deletion.
@item rset
Remove deletion marks.
@item quit
Quit pop3 session.
@item disconnect
Close existing connection.
@end table
@subsubheading Internal commands
@table @asis
@item verbose [on|off|mask|unmask] [secure [payload]]
Control output verbosity. Without arguments the @command{verbose}
command shows current settings.
The argument @samp{off} (the default) turns off all additional output.
The @samp{verbose on} command enables POP3 protocol tracing output.
Additional arguments can be used to provide more verbosity. The
@samp{secure} argument enables display of user passwords in the trace
output and the @samp{payload} argument enables showing payload data
(e.g. response body sent in the reply to @samp{RETR} command, etc.)
Thus, the full diagnostics output is obtained by
@example
verbose on secure payload
@end example
The @samp{mask} and @samp{unmask} arguments allow to disable and
enable such additional verbosity. For example, supposing the command
above is in action, the following command will suppress the display of
user passwords in the traces:
@example
verbose mask secure
@end example
Similarly, @command{verbose unmask secure} will turn it back again.
@item prompt @var{string}
Set command prompt. The argument can contain @dfn{variable
references} in any of the following forms:
@example
$@var{name}
$@{@var{name}@}
@end example
@noindent
where @var{name} is the variable name. Such references are expanded
to the actual value of the variable at the time of expansion. The
following variables are defined:
@multitable @columnfractions 0.4 0.6
@headitem Variable @tab Expansion
@item user @tab Login name of the authenticated POP3 user. If the session is not authenticated yet, expands to @samp{[nouser]}.
@item host @tab Name of the remote host, or @samp{[nohost]} if no
connection is established.
@item program-name @tab Name of the program, as typed on the command
line to invoke it.
@item canonical-program-name @tab @samp{mailutils}
@item package @tab @samp{Mailutils}
@item version @tab Mailutils version number (@value{VERSION})
@item status @tab Session status. One of: @samp{disconnected},
@samp{connected} or @samp{logged in}.
@end multitable
For example:
@example
prompt "[$@{user@}@@$host "
@end example
Notice the use of quotes to include the space character in the prompt.
@item exit
Exit the program.
@item help [@var{command}]
@itemx ? [@var{command}]
Without arguments displays a list of commands with possible arguments
and short descriptions.
With one argument, displays a terse description for the given @var{command}.
@item history
Shows command history.
@end table
@node mailutils imap
@subsection mailutils imap
The @command{mailutils imap} command is reserved for an interactive IMAP4
client shell. It does not do much now (as of version @value{VERSION}.
@node mailutils send
@subsection mailutils send
@WRITEME
@node mailutils smtp
@subsection mailutils smtp
@WRITEME