programs.texi
94 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
@c This is part of the GNU Mailutils manual.
@c Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************
@sc{gnu} Mailutils provides a set of programs for handling the email.
@menu
* authentication:: Authorization and authentication principles.
* configuration:: Common configuration file.
* imap4d:: IMAP4 daemon.
* pop3d:: POP3 daemon.
* frm:: List headers from a mailbox.
* mail:: Send and receive mail.
* mail.local:: Deliver mail to the local mailbox.
* messages:: Count the number of messages in a mailbox.
* readmsg:: Extract messages from a folder.
* sieve:: Mail filtering utility.
* guimb:: Mailbox scanning and processing language.
* comsatd:: Comsat daemon.
* mailutils-config:: Get the information about the Mailutils build.
@end menu
@page
@node authentication
@section Authorization and authentication principles.
@cindex authorization
@cindex authentication
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
either a one of them succeeds or the list is exhausted. In 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.
We represent the module lists as column-separated lists of module
names. 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 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 the @acronym{sql} database. The set
of @option{--sql-} options (@pxref{auth}) is used to configure
access to the database.
@item virtdomain
User credentials are retrieved from a ``virtual domain'' user
database.
@end table
The modules available for use in authentication list are:
@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 the @acronym{sql}
database using query supplied by @option{--sql-getpass} option
(@pxref{auth}).
@item pam
The user is authenticated via pluggable authentication module
(@acronym{pam}). The @acronym{pam} service name to be used is
configured via @option{--pam-service} option (@pxref{auth})
@end table
Unless overridden by @option{--authentication} command line option,
the list of authentication modules is:
@example
generic:system:pam:sql
@end example
@noindent
Unless overridden by @option{--authorization} command line option,
the list of authorization modules is:
@example
system:sql:virtdomains
@end example
@page
@node configuration
@section Mailutils configuration file
@cindex Mailutils configuration file
@cindex mailutils.rc
There are some command line options that are used so often that it is
inconvenient to specify them in the command line each time you run
a Mailutils utility. The @dfn{configuration files} provide a way to
add default command line arguments without having to type them in
the command line. Upon startup, each Mailutils utility scans and
processes the contents of the three startup files, none of which
are required to exist:
@enumerate
@item
the site-wide configuration file
@file{mailutils.rc}, found in your your system configuration directory
(usually @file{/etc} or @file{/usr/local/etc}).
@item
the user-specific configuration file
Usually @file{~/.mailutils}, unless @file{~/.mailutils} is a directory,
in which case @file{~/.mailutils/mailutils} is used.
@item
the programs-specific configuration file
Usually @file{~/.mu.@var{program}rc}, unless @file{~/.mailutils} is a
directory, in which case @file{~/.mailutils/@var{program}rc} is used
(where @var{program} means the program name).
@end enumerate
These files have simple line-oriented syntax. Comments begin with the
pound sign (@samp{#}) and extend through the end of the line
@footnote{If @samp{#} is not the first character on the line, it
should be separated from the previous word by any amount of whitespace.}.
Very long lines may be split across several lines by escaping final newline
with a backslash (@samp{\}) character.
In the non-program-specific configuration files, any configuration line
must start with a @dfn{tag}. In the program-specific configuration
file the tag must not be present, all options are for that specific
program.
A tag is either a name of a particular Mailutils utility or @dfn{option
group}, prefixed with colon (@samp{:}). The command line options common for
several Mailutils programs are divided into @dfn{option groups} or
@dfn{capabilities}, e.g. the options @option{--mail-spool} and
@option{--lock-flags} form group @samp{mailbox}. These groups are discussed
in detail below.
When processing the non-program-specific configuration files,
a Mailutils utility selects
those lines whose tag is either the name of that utility or the name
of the option group supported by it. In the program-specific configuration
file, all lines are selected. For each line found, its tag (if present)
is stripped away, and the rest of the line is split up into words.
These words are regarded as command line options and are inserted to
the program arguments @emph{before} any options from the command line.
Thus the options from @file{.mailutils} take precedence over those
from @file{mailutils.rc}, and the options from the command line take
precedence over those from all three configuration files.
The word splitting occurs at whitespace characters and is similar to
that performed by the shell. If an option must contain embedded
whitespace, it should be enclosed in a pair of quotes (either double
or single quotes).
@menu
* default:: Options understood by most @sc{gnu} utilities.
* mailbox:: Specifies the mail spool location, and locking strategy.
* mailer:: Sets the mailer URL.
* address:: Specifies the default email address and domain.
* daemon:: Options common for daemon programs.
* auth:: Authentication-specific options.
* logging:: Logging control options.
* sieve: sieve group. Sieve specific options
* config sample:: A sample configuration file.
@end menu
@node default
@subsection default --- Options understood by most @sc{gnu} utilities.
Each program also understands the following informational options:
@table @option
@item -u
@itemx --usage
Display a short usage message and exit.
@item -h
@itemx --help
Display help message and exit.
@item -L
@itemx --license
Display @sc{gnu} General Public License and exit.
@item -v
@itemx --version
Display program version and exit.
@end table
@node mailbox
@subsection mailbox --- Specifies the mail spool location, and locking strategy.
@cindex :mailbox
Option group @samp{mailbox} consists of options used to specify the
location of the mail spool, and the locking strategy.
@table @option
@item -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item --lock-flags=@var{flags}
Set the default mailbox lock flags (E=external, R=retry, T=time, P=pid).
@end table
@node mailer
@subsection mailer --- Sets the default mailer URL.
@cindex :mailer
This option group overrides the default mailer URL (@url{sendmail:}).
@table @option
@item -m @var{url}
@itemx --mailer @var{url}
@end table
@node address
@subsection address --- Specifies the default email address and domain.
@cindex :address
Option group @samp{address} consists of options used to specify how to
qualify email addresses.
An unqualified address (one without an @var{@@}) is qualified by appending
@var{@@}@var{defaultdomain}. @var{defaultdomain} is the return of
gethostname(), or the result of gethostbyname() on the return of
gethostname() (if the DNS lookup is successful).
If the email address of the current user is needed, either the address set by
--email-addr is returned, or the current uid is looked up in the user
database, and qualified with the @var{defaultdomain}.
@table @option
@item -E @var{email}
@itemx --email-addr=@var{email}
Set the current user's email address, this it makes more sense to use
this in one of the per-user configuration files.
@item -D @var{domain}
@itemx --email-domain=@var{domain}
Set the default email domain, this might make sense to use in either
the global or one of the per-user configuration files.
@end table
@node daemon
@subsection daemon --- Options common for daemon programs.
@cindex :daemon
@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 -i
@itemx --inetd
Run in inetd mode.
@item -p @var{number}
@itemx --port @var{number}
Listen on given port @var{number}. This option is meaningful only in
standalone mode. It defaults to port 143.
@item -t @var{number}
@itemx --timeout @var{number}
Set idle timeout to given @var{number} of seconds. The daemon breaks the
connection if it receives no commands from the client within that number
of seconds.
@end table
@node auth
@subsection auth --- Authentication-specific options.
@cindex :auth
These options control the authorization and authentication module
lists. For a description of authentication concepts, refer to
@xref{authentication}.
@table @option
@item --authorization @var{modlist}
This option allows to set up a list of modules to be used for
authorization. @var{modlist} is a colon-separated list of
modules. Valid modules are:
@table @asis
@item system
User credentials are retrieved from the system user database
(@file{/etc/password}).
@item sql
User credentials are retrieved from the @acronym{sql} database. The set
of @option{--sql-} options (see below) is used to configure
access to the database.
@item virtdomain
User credentials are retrieved from a ``virtual domain'' user
database.
@end table
@item --authentication @var{modlist}
This option allows to set up a list of modules to be used for
authentication. @var{modlist} is a colon-separated list of
modules. Valid modules are:
@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 the @acronym{sql}
database using query supplied by @option{--sql-getpass} option
(see below).
@item pam
The user is authenticated via pluggable authentication module
(@acronym{pam}). The @acronym{pam} service name to be used is
configured via @option{--pam-service} option (see below)
@end table
@item --pam-service @var{name}
When compiled with @acronym{pam} support, this option specifies the
name of @acronym{pam} service to be used when authenticating.
@end table
The following options exist in this group if the package was configured
with @option{--enable-sql} option. They take effect only if the
@samp{sql} module is used in authentication and/or authorization.
Currently only MySQL is supported.
@table @option
@item --sql-getpwnam @var{query}
@acronym{sql} query to retrieve a passwd entry based on username
@item --sql-getpwuid @var{query}
@item --sql-getpass @var{query}
@acronym{sql} query to retrieve a password from the database
@item --sql-host @var{name}
Name or IP of MySQL server to connect to.
@item --sql-user @var{name}
@acronym{sql} user name
@item --sql-passwd @var{string}
@acronym{sql} connection password
@item --sql-db @var{string}
Name of the database to connect to.
@item --sql-port @var{number}
Port to use
@end table
@node logging
@subsection logging --- Logging control options.
@cindex :logging
@table @option
@item --log-facility @var{facility}
Output logs to the specified @command{syslog} facility. The following
facility names are recognized: @samp{user}, @samp{daemon}, @samp{mail},
@samp{auth} and @samp{local0} through @samp{local7}. These names are
case-insensitive.
@end table
@node sieve group
@subsection Sieve specific options
@cindex :sieve
The following options comprise this group:
@table @option
@item -I @var{dir}
@itemx --includedir=@var{dir}
Append directory @var{dir} to the list of directories searched for
include files.
@item -L @var{dir}
@itemx --libdir=@var{dir}
Append directory @var{dir} to the list of directories searched for
library files.
@end table
@node config sample
@subsection A sample configuration file.
@cindex mailutils.rc, an example
The following configuration file specifies that all Mailutils programs
should use @file{/var/spool/mail} as a local mailspool
directory. Programs performing authentication will use @acronym{pam}
service @samp{mailutils}. All programs, except @command{imap4d} will
issue log messages via @samp{mail} facility, @command{imap4d} will use
facility @samp{local1}.
@example
@group
:mailbox --mail-spool /var/spool/mail
:auth --authentication pam --pam-service mailutils
:logging --log-facility mail
imap4d --daemon=20 --timeout=1800 --log-facility local1
@end group
@end example
@page
@node imap4d
@section IMAP4 daemon
@pindex imap4d
@sc{gnu} 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:: Imap4d namespace.
* Starting imap4d:: Invocation options.
@end menu
@node Namespace
@subsection Imap4d Namespace
@cindex namespace
@cindex IMAP4 namespace
@sc{gnu} 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 @option{--shared-namespace} and
@option{--other-namespace} options.
@node Starting imap4d
@subsection Starting 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
The program uses following option groups: @xref{mailbox},
@xref{daemon}, @xref{logging}, @xref{auth}.
@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 -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item -O @var{pathlist}
@itemx --other-namespace=@var{pathlist}
Set the list of directories forming the ``Other User's'' namespace.
@var{pathlist} is a list of directory names separated by colons.
@item -p @var{number}
@itemx --port @var{number}
Listen on given port @var{number}. This option is meaningful only in
standalone mode. It defaults to port 143.
@item -S @var{pathlist}
@itemx --shared-namespace=@var{pathlist}
Set the list of directories, forming the ``Shared''
namespace. @var{pathlist} is a list of directory names separated by colons.
@item -t @var{number}
@itemx --timeout @var{number}
Set idle timeout to given @var{number} of seconds. Default is 1800 seconds (30
minutes). The daemon breaks the connection if it receives no commands
from the client within that number of seconds.
@item -v
@itemx --version
Display program version and exit.
@end table
@page
@node pop3d
@section POP3 daemon
@pindex pop3d
The @command{pop3d} daemon implements the Post Office Protocol server.
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. This
mode is triggered by @option{-d} command line switch.
@end table
The program uses following option groups: @xref{mailbox},
@xref{daemon}, @xref{logging}, @xref{auth}.
@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 10 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 -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item -p @var{number}
@itemx --port @var{number}
Listen on given port @var{number}. This option is meaningful only in
standalone mode. It defaults to port 110.
@item -t @var{number}
@itemx --timeout @var{number}
Set idle timeout to given @var{number} of seconds. Default is 600 seconds (10
minutes). The daemon breaks the connection if it receives no commands
from the client within that number of seconds.
@item -v
@itemx --version
Display program version and exit.
@end table
@page
@node frm
@section frm --- List headers from a mailbox.
@pindex frm
The @command{frm} command outputs a header information of
the selected messages in a mailbox. By default, @command{frm} reads the
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 program uses following option groups: @xref{mailbox}.
The following command line options alter the behavior of the program:
@table @option
@item -f STRING
@item --field STRING
Display the header named by 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 ATTR
@itemx --status ATTR
Only display headers from messages with the given status.
ATTR may be one of the following: @samp{new}, @samp{read},
@samp{unread}. It is sufficient to specify only first letter of
an ATTR. Multiple @option{-s} options are allowed.
@item -t
@itemx --align
Tidy mode. Currently is not implemented. Included for compatibility with
@command{frm} program from Elm package.
@end table
@page
@node mail
@section mail --- send and receive mail.
@pindex mail
@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 a mailbox. The URL of the mailbox to operate upon is
taken from the argument of @option{--file} command line option. If it
is not specified, the user's system mailbox is assumed. For more
detail, see @ref{Reading Mail}.
@menu
* Invoking Mail:: Command line options.
* Specifying Messages:: How to specify message sets.
* Composing Mail:: Composing mail.
* Reading Mail:: Reading mail.
* Mail Variables:: How to alter the behavior of mail.
* Mail Configuration Files:: Personal and system-wide configuration files.
@end menu
@node Invoking Mail
@subsection Command line options
General usage of @command{mail} program is:
@example
mail [OPTION...] [address...]
@end example
@noindent
If [address...] part is present, @command{mail} switches to mail sending
mode, otherwise it operates in mail reading mode.
The program uses following option groups: @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 -f[FILE]
@itemx --file[=FILE]
Operate on mailbox FILE. If this option is not specified, the default
is user's system mailbox. If it is specified without argument, the
default is $HOME/mbox.
@emph{Please note}, that there should be no whitespace between the
short variant of the option (@option{-f}), and its parameter. Similarly,
when using long option (@option{--file}), its argument must be preceded by
equal sign.
@item -F
@itemx --byname
Save messages according to sender. Currently this option is not implemented.
@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 -r
@itemx --read
Print all mail to standard output. It is equivalent to issuing following
commands after starting @samp{mail -N}:
@example
print *
quit
@end example
@item -q
@itemx --quit
Cause interrupts to terminate program.
@item -s SUBJ
@itemx --subject=SUBJ
Send a message with a Subject of SUBJ. Valid only in sending mode.
@item -t
@itemx --to
Switch to sending mode.
@item -u USER
@itemx --user=USER
Operate on USER's mailbox. This is equivalent to:
@example
mail -f/@var{spool_path}/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.
@itemx --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 (@pxref{Marking 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
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: ~?
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.
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
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
(@pxref{Controlling Header Display}).
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
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
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
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 (@pxref{Controlling Header Display}).
@node Inserting Value of a Mail Variable
@subsubsection Inserting Value of a Mail Variable: ~i
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 ~-
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 (@pxref{Replying}) 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 ~|
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 --file
To read messages from your mailbox ($HOME/mbox).
@item mail --file=@var{path_to_mailbox}
To read messages from the specified mailbox.
@item 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.
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::
* Scripting::
* Aliasing::
* Replying::
* 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
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
@table @samp
@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
@table @samp
@item cd [@var{dir}]
@itemx chdir [@var{dir}]
@itemx ch [@var{dir}]
Change to the specified directory. If @var{dir} is omitted, $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
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
@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
@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.
For detailed description of ignored header lists, see @ref{Controlling Header Display}.
@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.
@end table
@node Marking Messages
@subsubsection Marking messages
@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
@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
@table @samp
@item save [[@var{msglist}] @var{file}]
@itemx s [[@var{msglist}] @var{file}]
Takes a message list and a file name and appends each message in turn to
the end of the file. The name of file and number of characters appended
to it is echoed on the terminal. 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
@group
@cartouche
& 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 cartouche
@end group
@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 ($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
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 Scripting
@subsubsection Scripting
@subheading Comments
The @samp{#} character introduces an end-of-line comment. All characters
until and including the end of line are ignored.
@subheading Displaying arbitrary text
The @samp{echo} (@samp{ec}) command prints its arguments to stdout.
@subheading Sourcing external command files
The command @samp{source @var{filename}} reads commands from the named
file. Its minimal abbreviation is @samp{so}.
@subheading Setting and unsetting the variables.
The mail variables may be 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
@subheading 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
@subheading Conditional statements
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 Aliasing
@subsubsection Aliasing
@table @samp
@item alias [alias [address...]]
@itemx a [alias [address...]]
@itemx group [alias [address...]]
@itemx g [alias [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 [alias...]
@itemx una [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 name...
@itemx alt 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
@table @samp
@item mail [address...]
@itemx m [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.
@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
@node Incorporating New Mail
@subsubsection Incorporating new mail
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
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 Mail Variables
@subsection How to alter the behavior of mail
Following variables control the behavior of @sc{gnu} @command{mail}:
@table @code
@item Sign
@*Type: String.
@*Default: Unset.
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.
@item appenddeadletter
@*Type: Boolean.
@*Default: False.
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.
@item askbcc
@*Type: Boolean.
@*Default: False.
When set to @code{True} the user will be prompted to enter @code{Bcc}
field before composing the message.
@item askcc
@*Type: Boolean.
@*Default: True.
When set to @code{True} the user will be prompted to enter @code{Cc}
field before composing the message.
@item asksub
@*Type: Boolean.
@*Default: True in interactive mode, False otherwise.
When set to @code{True} the user will be prompted to enter @code{Subject}
field before composing the message.
@item autoinc
@*Type: Boolean.
@*Default: True.
Automatically incorporate newly arrived messages.
@item autoprint
@*Type: Boolean.
@*Default: False.
Causes the delete command to behave like dp - thus, after deleting a
message, the next one will be typed automatically.
@item cmd
@*Type: String.
@*Default: Unset.
Contains default shell command for @code{pipe}.
@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.
This variable contains the number of columns on terminal screen.
@item crt
@*Type: Boolean or Numeric
@*Default: True in interactive mode, False otherwise.
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.
@item dot
@*Type: Boolean.
@*Default: False.
If @code{True}, causes @command{mail} to interpret a period alone on a line as the
terminator of a message you are sending.
@item editheaders
@*Type: Boolean.
@*Default: False.
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.
@item escape
@*Type: String.
@*Default: ~
If defined, the first character of this option gives the character to
denoting escapes.
@item folder
@*Type: String.
@*Default: Unset.
The name of the directory to use for storing folders of messages. If
unset, $HOME is assumed.
@item header
@*Type: Boolean.
@*Default: True, unless started with @option{--nosum} (@option{-N}) option.
Whether to run @code{headers} command automatically after entering
interactive mode.
@item hold
@*Type: Boolean.
@*Default: False.
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.
@item ignore
@*Type: Boolean.
@*Default: False.
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.
@item ignoreeof
@*Type: Boolean.
@*Default: False.
Controls whether typing EOF character terminates the letter being
composed.
@item indentprefix
@*Type: String.
@*Default: "\t" (a tab character).
String used by the @code{~m} tilde escape for indenting quoted messages.
@item keepsave
@*Type: Boolean.
@*Default: False.
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.
@item metoo
@*Type: Boolean.
@*Default: False.
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.
@item mode
@*Type: String.
@*Default: The name of current operation mode.
Setting this variable does not affect the operation mode of the program.
@item noregex
@*Type: Boolean.
@*Default: False.
Setting this to @code{True} enables use of regular expressions in
@samp{/.../} message specifications.
@item outfolder
@*Type: String.
@*Default: Unset.
Contains the directory in which files created by @code{save},
@code{write}, etc. commands will be stored. When unset, current
directory is assumed.
@item page
@*Type: Boolean.
@*Default: False.
If set to @code{True}, the @code{pipe} command will emit a linefeed
character after printing each message.
@item prompt
@*Type: String.
@*Default: "? "
Contains the command prompt sequence.
@item quit
@*Type: Boolean.
@*Default: False, unless started with @option{--quit} (@option{-q}) option.
When set, causes keyboard interrupts to terminate the program.
@item rc
@*Type: Boolean.
@*Default: True, unless started with @option{--norc} (@option{-N}) option.
When this variable is set, @command{mail} will read the system-wide
configuration file upon startup. See @ref{Mail Configuration Files}.
@item record
@*Type: String.
@*Default: Unset.
When set, any outgoing message will be saved to the named file.
@item save
@*Type: Boolean.
@*Default: True.
When set, the aborted messages will be stored in the user's
@file{dead.file}. See also @code{appenddeadletter}.
@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.
This variable contains the number of lines on terminal screen.
@item sendmail
@*Type: String.
@*Default: sendmail:/usr/lib/sendmail
Contains the URL of mail transport agent.
@item sign
@*Type: String.
@*Default: Unset.
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.
@item subject
@*Type: String.
@*Default: Unset.
Contains default subject line. This will be used when @code{asksub} is
off.
@item toplines
@*Type: Numeric.
@*Default: 5
Number of lines to be displayed by @code{top} and @code{Top} commands.
@item verbose
@*Type: Boolean.
@*Default: False.
When set, the actual delivery of messages is displayed on the user's terminal.
@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 mail.local
@section mail.local --- Deliver mail to the local mailbox.
@pindex mail.local
@command{mail.local} reads the standard input up to an end-of-file
and appends the received data to the local mailboxes.
@menu
* Invocation:: Mail.local options
* MTA:: Using mail.local with various MTAs
* Mailbox Quotas:: Setting up mailbox quotas.
* Sieve Filters:: Implementing user-defined Sieve mail filters.
* Scheme Filters:: Implementing user-defined Scheme mail filters.
@end menu
@node Invocation
@subsection Invoking mail.local
The program uses following option groups: @xref{mailbox}, @xref{auth},
@xref{logging}, @xref{sieve}.
@table @option
@item -f @var{addr}
@itemx --from @var{addr}
Specify the sender's name. This option forces @command{mail.local} to
add @samp{From } envelope to the beginning of the message. If it is
not specified, @command{mail.local} first looks into the first line
from the standard input. If it starts with @samp{From }, it is assumed
to contain a valid envelope. If it does not, @command{mail.local}
creates the envelope by using current user name and date.
@item -h
@itemx --help
Display this help and exit.
@item -L
@itemx --license
Display @sc{gnu} General Public License and exit.
@item -m @var{path}
@itemx --mail-spool @var{path}
Specify path to mailspool directory.
@item -q
@itemx --quota-db @var{file}
Specify path to mailbox quota database (@pxref{Mailbox Quotas}).
@item -s @var{pattern}
@itemx --source @var{pattern}
Set name pattern for user-defined mail filters written in Scheme
(@pxref{Scheme Filters}). The
metacharacters @samp{%u} and @samp{%h} in the pattern are expanded to
the current recipient user name and home directory correspondingly.
This option is available only if the package has been configured to
use Guile extension language.
@item -S @var{pattern}
@itemx --sieve @var{pattern}
Set name pattern for user-defined mail filters written is Sieve
(@pxref{Sieve Filters}). The
metacharacters @samp{%u} and @samp{%h} in the pattern are expanded to
the current recipient user name and home directory correspondingly.
@item -t @var{number}
@itemx --timeout @var{number}
Wait @var{number} seconds for acquiring the lockfile. If it doesn't
become available after that amount of time, return failure. The timeout
defaults to 5 minutes.
@item -x @var{flags}
@itemx --debug @var{flags}
Enable debugging. The debugging information will be output using syslog.
The @var{flags} is a string consisting of the following flags:
Debug flags are:
@table @samp
@item g
Start with guile debugging evaluator and backtraces. This is convenient
for debugging user-defined filters (@pxref{Scheme Filters}).
@item T
Enable libmailutil traces (MU_DEBUG_TRACE).
@item P
Enable network protocol traces (MU_DEBUG_PROT)
@item t
Enable sieve trace (MU_SIEVE_DEBUG_TRACE)
@item l
Enable sieve action logs
@end table
The digits in the range @samp{0} -- @samp{9} used in @var{flags} set
@command{mail.local} debugging level.
@item -v
@itemx --version
Display program version and exit.
@item --ex-multiple-delivery-success
Don't return errors when delivering to multiple recipients.
@item --ex-quota-tempfail
Return temporary failure if disk or mailbox quota is exceeded. By
default, 'service unavailable' is returned if the message exceeds
the mailbox quota.
@end table
@node MTA
@subsection Using mail.local with various MTAs
This section explains how to invoke @command{mail.local} from
configuration files of various Mail Transport Agents.
All examples in this section suppose that @command{mail.local}
must receive following command line switches:
@example
-s %h/.filter.scm -q /etc/mail/userquota
@end example
@menu
* sendmail:: Using mail.local with sendmail.
* exim:: Using mail.local with exim.
@end menu
@node sendmail
@subsubsection Using mail.local with sendmail.
The @command{mail.local} must be invoked from the local mailer
definition in the @file{sendmail.cf} file. It must have the
following flags set @samp{lswS}, meaning the mailer is local,
the 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, @samp{fn} flags may be specified to allow
@command{mail.local} to generate usual @samp{From } envelope
instead of the one supplied by sendmail.
Here is an example of mailer definition in @file{sendmail.cf}
@example
Mlocal, P=/usr/local/libexec/mail.local,
F=lsDFMAw5:/|@@qSPfhn9,
S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
T=DNS/RFC822/X-Unix,
A=mail -s %h/.filter.scm -q /etc/mail/userquota $u
@end example
To define local mailer in @samp{mc} source file, it will suffice to
set:
@example
define(`LOCAL_MAILER_PATH', `/usr/local/libexec/mail.local')
define(`LOCAL_MAILER_ARGS',
`mail -s %h/.filter.scm -q /etc/mail/userquota $u')
@end example
@node exim
@subsubsection Using mail.local with exim.
Using @command{mail.local} with exim is quite straightforward. The
following example illustrates the definition of appropriate transport
and director in @file{exim.conf}:
@example
# transport
mail_local_pipe:
driver = pipe
command = /usr/local/libexec/mail.local -s %h/.filter.scm \
-q /etc/mail/userquota $local_part
return_path_add
delivery_date_add
envelope_to_add
# director
mail_local:
driver = localuser
transport = mail_local_pipe
@end example
@node Mailbox Quotas
@subsection Setting up mailbox quotas
@node Sieve Filters
@subsection Implementing user-defined Sieve mail filters.
@node Scheme Filters
@subsection Implementing user-defined Scheme mail filters.
@page
@node messages
@section messages --- Count the number of messages in a mailbox.
@pindex messages
@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.
The program uses following option groups: @xref{mailbox}.
The program accepts following command line options:
@table @option
@item -q
@itemx --quite
@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 readmsg
@section readmsg --- Extract messages from a folder.
@pindex readmsg
The program, readmsg, extracts with the selection argument messages from
a mailbox. Selection can be specify by:
@enumerate
@item
A lone ``*'' means select all messages in the mailbox.
@item
A list of message numbers may be specified. Values
of ``0'' and ``$'' 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 ``staff meeting.'' Note that it
will not match a message containing ``Staff Meeting'' - the matching is case
sensitive. Normally only the first message which matches the pattern will be
printed.
@end enumerate
@subheading Command line options
@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.
@item -w @var{weedlist}
@itemx --weedlist=@var{weedlist}
A whitespace or coma separated list of header names to show per message.
Default is --weedlist=''From Subject Date To CC Apparently-''
@end table
@page
@node sieve
@section sieve
@pindex sieve
Sieve is a language for filtering e-mail messages at time of final
delivery, described in RFC 3028. @sc{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. @sc{gnu} @command{sieve} implements a superset
of the Sieve language as described in RFC 3028. @xref{Input Language},
for a description of the Sieve language. @xref{Extensions}, for a
discussion of differences between the @sc{gnu} implementation of Sieve and
its standard.
@menu
* Invoking Sieve::
* Logging and Debugging::
* Extending Sieve::
@end menu
@node Invoking Sieve
@subsubsection Invocation
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 -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 mailutil 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
@xref{Logging and Debugging}, for detailed discussion of these.
@item -D
@itemx --dump
Compile the script, dump disassembled code on standard output and exit.
@item -e @var{address}
@item --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 sieve is
executed.
@item -f
@itemx --mbox-url=@var{mbox}
Mailbox to sieve (defaults to user's system mailbox)
@item -k
@itemx --keep-going
Keep on going if execution fails on a message
@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
@item -v
@itemx --verbose
Log all actions executed.
@end table
Apart from these, @command{sieve} understands the options from the
following groups: @code{sieve}, @code{mailbox}, @code{mailer},
@code{logging}.
@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 (@pxref{logging}).
This option causes @command{sieve} to output its diagnostics to
the given syslog facility.
@node Extending Sieve
@subsubsection Extending 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 LTDL_LIBRARY_PATH.
@item Additional search directories specified with the
@code{#searchpath} directive.
@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
LD_LIBRARY_PATH).
@end enumerate
The value of LTDL_LIBRARY_PATH and 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
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 1.4 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}
@item --debug @var{level}
Set debugging level
@end table
The Scheme programs produced by @command{sieve.scm} can be used with
@command{guimb} or @command{mail.local}.
@c ***********************************************************************
@page
@node guimb
@section guimb --- A mailbox scanning and processing language.
@pindex guimb
@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 program uses following option groups: @xref{mailbox}.
@menu
* Specifying Scheme Program to Execute::
* Specifying Mailboxes to Operate Upon::
* Passing Options to Scheme::
* Guimb Invocation Summary::
@end menu
@node Specifying Scheme Program to Execute
@subsection 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
(@pxref{Passing Options to Scheme}).
@node Specifying Mailboxes to Operate Upon
@subsection 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} mailbox [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} [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
@subsection 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 progfile
@end example
In this example, the scheme procedure will see the following command line:
@example
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 progfile
@end example
@node Guimb Invocation Summary
@subsection Guimb Invocation 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 EXPR
@itemx --expression EXPR
Execute given Scheme expression.
@item -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item -f PROGFILE
@itemx --file PROGFILE
Read Scheme program from PROGFILE.
@item -g ARG
@itemx --guile-command ARG
Append 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 MBOX
Set default mailbox name.
@item -u
@itemx --user NAME
Act as local MDA for user NAME.
@item -h
@itemx --help
Display help message.
@item -v
@itemx --version
Display program version.
@end table
@page
@node comsatd
@section Comsat daemon
@pindex comsatd
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 comsatd.
* dot.biffrc:: A per-user configuration file.
@end menu
@node Starting comsatd
@subsection Starting comsatd
@command{Comsatd} uses following option groups: @xref{mailbox},
@xref{daemon}, @xref{logging}.
@table @option
@item -c @var{file}
@itemx --config @var{file}
Read configuration from given @var{file}. For more information about
comsatd configuration files, see @ref{Configuring comsatd}.
@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 -m @var{path}
@itemx --mail-spool=@var{path}
Set path to the mailspool directory
@item -p @var{number}
@itemx --port @var{number}
Specify the port number to listen on. Default is 512.
@item -v
@itemx --version
Output version and exit successfully.
@item -h
@itemx --help
Display short help message and exit.
@end table
@node Configuring comsatd
@subsection Configuring comsatd
The configuration parameters for comsatd are kept in a single
configuration file. The file uses line-oriented format: each line
contains a single statement. Comments are introduced with the @samp{#}
sign and empty lines are ignored. You can specify the configuration
file to use by using @option{-c} or @option{--config} command line switch.
The configuration file statements can logically be subdivided into
@dfn{General Settings}, @dfn{Security Settings} and @dfn{Access Control
Lists}. The following sections address each of these statement group in
detail.
@menu
* General Settings::
* Security Settings::
* Access Control Lists::
@end menu
@node General Settings
@subsubsection General Settings
These statements control the general behavior of the comsat daemon:
@table @asis
@item max-lines @var{number}
Set maximum number of message body lines to be output.
@item allow-biffrc ( yes | no )
Enable or disable processing of user's @file{.biffrc} file. By default,
it is enabled.
@end table
@node Security Settings
@subsubsection Security Settings
These statements control the way @command{comsatd} fights possible
flooding attacks.
@table @asis
@item max-requests @var{number}
Set maximum number of incoming requests per @samp{request-control-interval}.
@item request-control-interval @var{number}
Set the request control interval (seconds).
@item overflow-delay-time @var{number}
Set the initial amount of time to sleep, after the first overflow occurs.
@item overflow-control-interval @var{number}
Set the overflow control interval. If two consecutive overflows happen
within @var{number} seconds, the overflow-delay-time is doubled.
@end table
@node Access Control Lists
@subsubsection Access Control Lists
Access control lists determine from which addresses @command{comsatd}
will receive mail notification messages.
The access control lists are introduced in configuration file using
keyword @samp{acl}. General format for an ACL rule is
@example
acl @var{action} @var{netlist}
@end example
@noindent
Here, @var{action} specifies the action to be taken when a request
arrives from one of the networks, listed in @var{netlist}. There are
two possible actions: @samp{allow} and @samp{deny}.
The @var{netlist} is a whitespace-separated list of network numbers.
Each network number may be specified in one of the following forms:
@table @asis
@item @var{netnum}
Means a single host with IP address @var{netnum}.
@item @var{netnum}/@var{netmask}
@item @var{netnum}/@var{masklen}
@item @samp{any}
Denotes any IP address. It is equivalent to @samp{0.0.0.0/0}.
@end table
Upon receiving a notification message, @command{comsatd} compares its
source address against each ACL rule in the order of their appearance
in the configuration file. The first rule that matches the packet
determines whether the message will be processed or rejected. If
no matching rule was found, the default rule applies. Currently, default
rule is
@example
acl allow any
@end example
@noindent
If you don't need such behavior, specify the default rule explicitly.
For example, the common use would be:
@example
@group
acl allow 127.0.0.1
acl deny any
@end group
@end example
@noindent
which makes @command{comsatd} receive the notification messages from
localhost only.
@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 @var{string}
Output @var{string} to user's terminal device.
@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
@subsubsection 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
@subsubsection 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 mailutils-config
@section mailutils-config --- Get the information about the Mailutils build.
@pindex mailutils-config
This program is designed for developers wishing to link their programs
against libmailbox. It allows to examine the particulars of the
current build of Mailutils and to get the command line parameters
necessary for compiling and linking an application with Mailutils
libraries.
@menu
* Compiler Flags:: Getting Compiler Flags.
* Loader Flags:: Getting Loader Flags.
* General Information:: Obtaining General Build Information.
@end menu
@node Compiler Flags
@subsection Getting Compiler Flags.
When invoked with the option @option{--compile}, or its short form
@option{-c}, @command{mailutils-config} prints the flags
that must be given to the compiler for compiling the program using
Mailutils functions. An example usage:
@example
cc -omyprog.o `mailutils-config --compile` myprog.c
@end example
@node Loader Flags
@subsection Getting Loader Flags
The @option{--link}, or its short form @option{-l} prints to the
standard output the loader flags necessary to link a program against
Mailutils libraries.
When invoked without arguments, it produces the flags necessary to
link against the basic library of Mailutils: @file{libmailbox}.
Up to two arguments may be given that alter this behavior. These
are:
@table @samp
@item auth
Print flags to link against @file{libmuauth}, the library adding new
authentication methods to @file{libmailbox}.
@item guile
Print flags to link against @file{libmu_scm}, the Guile interface
library.
@end table
Both arguments may be given simultaneously, e.g.:
@example
cc -omyprog myprog.o `mailutils-config --link auth guile`
@end example
@node General Information
@subsection Obtaining General Build Information
The @option{--info}, or @option{-i} retrieves the options (flags) used
when building Mailutils. It may be used with or without
arguments.
When used without arguments, it prints the list of all
build flags, e.g.:
@example
$ mailutils-config --info
VERSION=0.1.3
USE_LIBPAM
HAVE_LIBLTDL
WITH_GUILE
WITH_READLINE
HAVE_MYSQL
ENABLE_VIRTUAL_DOMAINS
ENABLE_IMAP
ENABLE_POP
ENABLE_MH
ENABLE_SMTP
ENABLE_SENDMAIL
@end example
This option also accepts any number of arguments. When these are
given, each argument is treated as a name of a build flag.
@command{Mailutils-config} checks if such a flag was defined and
prints its full name if so. It exits with zero code if all the
flags given on the command line are defined. Otherwise, it
exits with code of 1.
The comparison of the flag names is case-insensitive. The arguments
given need not include the leading prefix (i.e. the characters up
to and including the first underscore character).
Given the previous example, the invocation
@example
$ mailutils --info readline use_libpam pop
@end example
@noindent
will produce the following output:
@example
WITH_READLINE
USE_LIBPAM
ENABLE_POP
@end example
@noindent
and will exit with a zero status.
The following command:
@example
$ mailutils --info readline gssapi pop
@end example
@noindent
will exit with status 1, and will print:
@example
WITH_READLINE
ENABLE_POP
@end example
@noindent
since @code{WITH_GSSAPI} flag is not defined.
The flags and their meanings are:
@table @asis
@c @item VERSION=" VERSION,
@item USE_LIBPAM
The Mailutils uses @sc{pam} libraries.
@item HAVE_LIBLTDL
The @sc{gnu} wrapper library @file{libltdl} is present and is used
by Mailutils. @xref{Using libltdl,,,libtool,Using libltdl}, for
more information on @file{libltdl} library.
@item WITH_BDB2
Support for Berkeley DB is compiled in (the package was configured with
@option{--with-db2} option).
@item WITH_NDBM
Support for NDBM is compiled in (the package was configured with
@option{--with-ndbm} option).
@item WITH_OLD_DBM
Support for old style DBM is compiled in (the package was configured with
@option{--with-dbm} option).
@item WITH_GDBM
Support for GDBM is compiled in (the package was configured with
@option{--with-gdbm} option). @xref{Top,,Introduction,gdbm,GNU DBM Manual}, for
information about this library.
@item WITH_GSSAPI
Support for @sc{gssapi} is compiled in (the package was configured with
@option{--with-gssapi} option).
@item WITH_GUILE
Support for Guile extension language is built (the package was
configured with @option{--with-guile} option).
@xref{Top,,Overview,guile,The Guile Reference Manual}, for information
about Guile.
@item WITH_PTHREAD
The @sc{posix} thread support is compiled in.
@item WITH_READLINE
The readline support is enabled (the package was
configured with @option{--with-readline} option).
@xref{Top,,,readline,GNU Readline Library}, for more information.
@item HAVE_MYSQL
Authentication via MySQL is supported (the package was
configured with @option{--enable-mysql} option).
@item ENABLE_VIRTUAL_DOMAINS
Support for mail virtual domains is enabled (the package was
configured with @option{--enable-virtual-domains} option).
@item ENABLE_IMAP
Support for @sc{imap4} protocol is enabled.
@item ENABLE_POP
Support for @sc{pop3} protocol is enabled.
@item ENABLE_MH
Support for mailboxes in @sc{mh} format is enabled.
@item ENABLE_SMTP
Support for @sc{smtp} mailer is enabled.
@item ENABLE_SENDMAIL
Support for Sendmail mailer is enabled.
@end table