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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml;charset=iso-8859-1" />
<title>getmail configuration (version 4)</title>
<meta name="author" content="Charles Cazabon" />
<meta name="description" content="Configuration instructions for getmail version 4" />
<meta name="keywords" content="getmail configuration, getmail 4 configuration, POP3, IMAP, SSL, domain mailbox, multidrop, fetchmail replacement, message filtering, maildir, mboxrd, MDA" />
<link rel="Contents Up Index" title="Charles Cazabon's Software" href="../" />
<style type="text/css" media="all">@import "getmaildocs.css";</style>
<style type="text/css" media="all">@import "/style/styles.css";</style>
</head>
<body id="top">
<div class="content">
<!----><h1 id="title">getmail documentation</h1>
<p class="introduction">
This is the documentation for getmail version 4. Version 4 includes
numerous changes from version 3.x; if you are using getmail version 3,
please refer to the documentation included with that version of the
software.
</p>
<p class="about">
getmail is Copyright © 1998-2004 Charles Cazabon.
</p>
<p class="about">
getmail is licensed under the
<a href="COPYING">GNU General Public License version 2</a>
(only). If you wish to obtain a license to distribute getmail under other
terms, please contact me directly.
</p>
<h1 id="toc">Table of Contents</h1>
<ul>
<li><a href="documentation.html">getmail documentation</a></li>
<li>
<ul>
<li><a href="documentation.html#title">getmail documentation</a></li>
<li>
<ul>
<li><a href="documentation.html#features">Features</a></li>
<li><a href="documentation.html#v4differences">Differences from previous versions</a></li>
<li><a href="documentation.html#requirements">Requirements</a></li>
<li><a href="documentation.html#obtaining">Obtaining getmail</a></li>
<li><a href="documentation.html#installing">Installing getmail</a></li>
<li><a href="documentation.html#mailing-lists">getmail mailing lists</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="configuration.html">getmail configuration</a></li>
<li>
<ul>
<li><a href="configuration.html#configuring">Configuring getmail</a></li>
<li>
<ul>
<li><a href="configuration.html#rcfile">Creating a getmail rc file</a></li>
<li>
<ul>
<li><a href="configuration.html#parametertypes">Parameter types and formats</a></li>
<li>
<ul>
<li><a href="configuration.html#parameter-string">string</a></li>
<li><a href="configuration.html#parameter-integer">integer</a></li>
<li><a href="configuration.html#parameter-boolean">boolean</a></li>
<li><a href="configuration.html#parameter-tuplestrings">tuple of quoted strings</a></li>
<li><a href="configuration.html#parameter-tupleintegers">tuple of integers</a></li>
<li><a href="configuration.html#parameter-tuple2tuples">tuple of 2-tuples</a></li>
</ul>
</li>
<li><a href="configuration.html#conf-retriever">Creating the <span class="file">[retriever]</span> section</a></li>
<li>
<ul>
<li><a href="configuration.html#conf-retriever-multidrop">What is a "multidrop" mailbox? How do I know if I have one?</a></li>
<li><a href="configuration.html#retriever-parameters">Common retriever parameters</a></li>
<li><a href="configuration.html#retriever-simplepop3">SimplePOP3Retriever</a></li>
<li><a href="configuration.html#retriever-brokenpop3">BrokenUIDLPOP3Retriever</a></li>
<li><a href="configuration.html#retriever-simpleimap">SimpleIMAPRetriever</a></li>
<li><a href="configuration.html#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a></li>
<li><a href="configuration.html#retriever-simpleimapssl">SimpleIMAPSSLRetriever</a></li>
<li><a href="configuration.html#retriever-multidroppop3">MultidropPOP3Retriever</a></li>
<li><a href="configuration.html#retriever-multidroppop3ssl">MultidropPOP3SSLRetriever</a></li>
<li><a href="configuration.html#retriever-multidropsdps">MultidropSDPSRetriever</a></li>
<li><a href="configuration.html#retriever-multidropimap">MultidropIMAPRetriever</a></li>
<li><a href="configuration.html#retriever-multidropimapssl">MultidropIMAPSSLRetriever</a></li>
</ul>
</li>
<li><a href="configuration.html#retriever-examples">Retriever examples</a></li>
<li><a href="configuration.html#conf-destination">Creating the <span class="file">[destination]</span> section</a></li>
<li>
<ul>
<li><a href="configuration.html#destination-maildir">Maildir</a></li>
<li><a href="configuration.html#destination-mboxrd">Mboxrd</a></li>
<li><a href="configuration.html#destination-mdaexternal">MDA_external</a></li>
<li><a href="configuration.html#destination-multidestination">MultiDestination</a></li>
<li><a href="configuration.html#destination-multisorter">MultiSorter</a></li>
<li><a href="configuration.html#destination-multiguesser">MultiGuesser</a></li>
<li><a href="configuration.html#destination-mdaqmaillocal">MDA_qmaillocal</a></li>
</ul>
</li>
<li><a href="configuration.html#conf-options">Creating the <span class="file">[options]</span> section</a></li>
<li>
<ul>
<li><a href="configuration.html#options-example"><span class="file">[options]</span> example</a></li>
</ul>
</li>
<li><a href="configuration.html#conf-filters">Creating the <span class="file">[filter-<span class="meta">something</span>]</span> sections</a></li>
<li>
<ul>
<li><a href="configuration.html#conf-filters-classifier">Filter_classifier</a></li>
<li><a href="configuration.html#conf-filters-external">Filter_external</a></li>
<li><a href="configuration.html#conf-filters-tmda">Filter_TMDA</a></li>
<li><a href="configuration.html#filter-examples"><span class="file">[filter-<span class="meta">something</span>]</span> examples</a></li>
</ul>
</li>
<li><a href="configuration.html#examplerc">getmail rc file examples</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="configuration.html#running">Running getmail</a></li>
<li>
<ul>
<li><a href="configuration.html#running-commandline-options">Commandline options</a></li>
<li><a href="configuration.html#running-mda">Using getmail as an MDA</a></li>
<li>
<ul>
<li><a href="configuration.html#running-mda-maildir">Using the <span class="file">getmail_maildir</span> MDA</a></li>
<li>
<ul>
<li><a href="configuration.html#running-mda-maildir-example">Example</a></li>
</ul>
</li>
<li><a href="configuration.html#running-mda-mbox">Using the <span class="file">getmail_mbox</span> MDA</a></li>
<li>
<ul>
<li><a href="configuration.html#running-mda-mbox-example">Example</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a href="troubleshooting.html">getmail troubleshooting</a></li>
<li>
<ul>
<li><a href="troubleshooting.html#troubleshooting">Troubleshooting problems</a></li>
<li>
<ul>
<li><a href="troubleshooting.html#error-messages">Error messages</a></li>
<li><a href="troubleshooting.html#warning-messages">Warning messages</a></li>
<li><a href="troubleshooting.html#unexpected-behaviour">Unexpected Behaviour</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="faq.html">getmail frequently-asked questions (FAQs)</a></li>
<li>
<ul>
<li><a href="faq.html#faq">Frequently-Asked Questions (FAQs)</a></li>
<li>
<ul>
<li><a href="faq.html#faq-about">About getmail</a></li>
<li><a href="faq.html#faq-configuring">Configuring getmail</a></li>
<li><a href="faq.html#faq-how">How do I …</a></li>
<li><a href="faq.html#faq-integrating">Using getmail with other software</a></li>
<li><a href="faq.html#faq-notabug">I think I found this bug in getmail …</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<!-- ********************************************************************** -->
<h1 id="configuring">Configuring getmail</h1>
<p>
Once getmail is
<a href="documentation.html#installing">installed</a>,
you need to configure it before you can retrieve mail with it. Follow these
steps:
</p>
<ol>
<li>
Create a data/configuration directory. The default is
<span class="file">$HOME/.getmail/</span>.
If you choose a different location, you will need to specify it on the
<a href="#running">getmail command line</a>.
In general, other users should not be able to read the contents of this
directory, so you should set the permissions on it appropriately.
<pre class="example">
mkdir -m 0700 $HOME/.getmail
</pre>
</li>
<li>
Create a configuration file in the configuration/data directory. The
default name is
<span class="file">getmailrc</span>.
If you choose a different filename, you will need to specify it on the
getmail command line. If you want to retrieve mail from more than one
mail account, you will need to create a separate rc file for each
account getmail should retrieve mail from.
</li>
</ol>
<!-- ********************************************************************** -->
<h2 id="rcfile">Creating a getmail rc file</h2>
<p>
The configuration file format is designed to be easy to understand (both for
getmail, and for the user). It is broken down into small sections of
related parameters by section headers which appear on lines by themselves,
enclosed in square brackets, like this:
</p>
<pre class="example">
[section name]
</pre>
<p>
Each section contains a series of parameters, declared as follows:
</p>
<pre class="example">
parameter_name = parameter_value
</pre>
<p>
A parameter value, if necessary, can span multiple lines. To indicate that
the second and subsequent lines form a continuation of the previous line,
they need to begin with leading whitespace, like this:
</p>
<pre class="example">
first_parameter = value
first parameter value continues here
second_parameter = value
</pre>
<p>
You can annotate your configuration files with comments by putting them on
lines which begin with a pound sign, like this:
</p>
<pre class="example">
first_parameter = value
# I chose this value because of etc.
second_parameter = value
</pre>
<p>
Each rc file requires at least two specific sections. The first is
<span class="file">retriever</span>,
which tells getmail about the mail account to retrieve messages from. The
second is
<span class="file">destination</span>,
which tells getmail what to do with the retrieved messages. There is also
an
<a href="#conf-options">optional section named
<span class="file">options</span>
</a>,
which gives getmail general configuration information (such as whether to
log its actions to a file), and other sections can be used to tell getmail
to filter retrieved messages through other programs, or to deliver messages
for particular users in a particular way.
</p>
<h3 id="parametertypes">Parameter types and formats</h3>
<p>
Several different types of parameters are used in getmail rc files:
</p>
<ul>
<li><a href="#parameter-string">string</a></li>
<li><a href="#parameter-integer">integer</a></li>
<li><a href="#parameter-boolean">boolean</a></li>
<li><a href="#parameter-tuplestrings">tuple of quoted strings</a></li>
<li><a href="#parameter-tupleintegers">tuple of integers</a></li>
<li><a href="#parameter-tuple2tuples">tuple of 2-tuples</a></li>
</ul>
<p>
Each parameter type has a specific format that must be used to represent it
in the getmail rc file. They are explained below. Each parameter
documented later specifies its type explicitly.
</p>
<h4 id="parameter-string">string</h4>
<p>
Specify a string parameter value with no special syntax:
</p>
<pre class="example">
parameter = my value
</pre>
<h4 id="parameter-integer">integer</h4>
<p>
Specify an integer parameter value with no special syntax:
</p>
<pre class="example">
parameter = 4150
</pre>
<h4 id="parameter-boolean">boolean</h4>
<p>
A boolean parameter is true or false; you can specify its value with the
(case-insensitive) words "true" and "false". The
values "yes", "on" and 1 are accepted as equivalent to
"true", while values "no", "off" and 0 are
accepted as equivalent to "false". Some examples:
</p>
<pre class="example">
parameter = True
parameter = false
parameter = NO
parameter = 1
</pre>
<h4 id="parameter-tuplestrings">tuple of quoted strings</h4>
<p>
A tuple of quoted strings is essentially a list of strings, with each string
surrounded by matching double- or single-quote characters to indicate where
it begins and ends. The list must be surrounded by open- and
close-parenthesis characters. A tuple may have to be a specific number of
strings; for instance, a "2-tuple" must consist of two quoted
strings, while a "4-tuple" must have exactly four. In most cases,
the number of strings is not required to be a specific number, and it will
not be specified in this fashion.
</p>
<p>
In general, a tuple of quoted strings parameter values should look like
this:
</p>
<pre class="example">
parameter = ('first string', 'second string',
"third string that contains a ' character")
</pre>
<p>
However, tuples of 0 or 1 strings require special treatment. The empty
tuple is specified with just the open- and close-parenthesis characters:
</p>
<pre class="example">
parameter = ()
</pre>
<p>
A tuple containing a single quoted string requires a comma to indicate it is
a tuple:
</p>
<pre class="example">
parameter = ("single string", )
</pre>
<h4 id="parameter-tupleintegers">tuple of integers</h4>
<p>
This is very similar to a tuple of quoted strings, above, minus the quotes.
Some examples:
</p>
<pre class="example">
parameter = (1, 2, 3, 4, 5)
parameter = (37, )
parameter = ()
</pre>
<h4 id="parameter-tuple2tuples">tuple of 2-tuples</h4>
<p>
This is a tuple of items, each of which is a 2-tuple of quoted strings. You
can think of this as a list of pairs of quoted strings.
</p>
<pre class="example">
# Three pairs
parameter = (
("first-a", "first-b"),
("second-a", "second-b"),
("third-a", "third-b"),
)
# One pair
parameter = (
("lone-a", "lone-b"),
)
</pre>
<h3 id="conf-retriever">Creating the <span class="file">[retriever]</span> section</h3>
<p>
The
<span class="file">retriever</span>
section of the rc file tells getmail what mail account to retrieve mail
from, and how to access that account. Begin with the section header line as
follows:
</p>
<pre class="example">
[retriever]
</pre>
<p>
Then, include a
<span class="file">type</span>
<a href="#parameter-string">string parameter</a>
to tell getmail what type of mail retriever to use to retrieve mail from
this account. The possible values are:
</p>
<ul>
<li>
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
— for single-user POP3 mail accounts.
</li>
<li>
<a href="#retriever-brokenpop3">BrokenUIDLPOP3Retriever</a>
— for broken POP3 servers that do not support the
<span class="file">UIDL</span>
command, or which do not uniquely identify messages; this provides basic
support for single-user POP3 mail accounts on such servers.
</li>
<li>
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
— for single-user IMAP mail accounts.
</li>
<li>
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
— same as SimplePOP3Retriever, but uses SSL encryption.
</li>
<li>
<a href="#retriever-simpleimapssl">SimpleIMAPSSLRetriever</a>
— same as SimpleIMAPRetriever, but uses SSL encryption.
</li>
<li>
<a href="#retriever-multidroppop3">MultidropPOP3Retriever</a>
— for domain mailbox (multidrop) POP3 mail accounts.
</li>
<li>
<a href="#retriever-multidroppop3ssl">MultidropPOP3SSLRetriever</a>
— same as MultidropPOP3Retriever, but uses SSL encryption.
</li>
<li>
<a href="#retriever-multidropsdps">MultidropSDPSRetriever</a>
— for domain mailbox
<a href="http://www.demon.net/helpdesk/products/mail/sdps-tech.shtml">SDPS mail accounts</a>,
as provided by the UK ISP Demon.
</li>
<li>
<a href="#retriever-multidropimap">MultidropIMAPRetriever</a>
— for domain mailbox (multidrop) IMAP mail accounts.
</li>
<li>
<a href="#retriever-multidropimapssl">MultidropIMAPSSLRetriever</a>
— same as MultidropIMAPRetriever, but uses SSL encryption.
</li>
</ul>
<h4 id="conf-retriever-multidrop">What is a "multidrop" mailbox? How do I know if I have one?</h4>
<p>
Some ISPs, mailhosts, and other service providers provide a mail service
they refer to as a "domain mailbox" or "multidrop
mailbox". This is where they register a domain for you, and mail
addressed to any local-part in that domain ends up in a single mailbox
accessible via POP3, with the message envelope (envelope sender address
and envelope recipient address) recorded properly in the message header,
so that it can be re-constructed after you retrieve the messages with
POP3 or IMAP. The primary benefit of this is that you can run your
own MTA (qmail, Postfix, sendmail, Exchange, etc.) for your domain without
having to have an SMTP daemon listening at a static IP address.
</p>
<p>
Unfortunately, a lot of what is advertised and sold as multidrop service
really isn't. In many cases, the envelope recipient address of the message
is not properly recorded, so the envelope information is lost and cannot
be reconstructed. If the envelope isn't properly preserved, it isn't
a domain mailbox, and you therefore can't use a multidrop retriever with
that mailbox.
</p>
<p>
To determine if you have a multidrop mailbox, check the following list:
if any of these items are not true, you do not have a multidrop mailbox.
</p>
<ul>
<li>
the mailbox must receive one copy of the message for each envelope
recipient in the domain; if the message was addressed to three
local-parts in the domain, the mailbox must receive three separate
copies of the message.
</li>
<li>
the envelope sender address must be recorded in a header field
named
<span class="file">Return-Path</span>
at the top of the message. If the message (incorrectly) already
contained such a header field, it must be deleted before the
envelope sender address is recorded.
</li>
<li>
the envelope recipient address must be recorded in a new header field.
These may be named various things, but are commonly
<span class="file">Delivered-To</span>,
<span class="file">X-Envelope-To</span>,
and similar values. In the case of messages which had multiple
recipients in the domain, this must be a single address, reflecting the
particular recipient of this copy of the message. Note that this
field (and the envelope recipient address) are not related to
informational header fields created by the originating MUA, like
<span class="file">To</span>
or
<span class="file">cc</span>.
</li>
</ul>
<p>
If you're not sure whether you have a multidrop mailbox, you probably don't.
You probably want to use
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
(for POP3 mail accounts) or
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
(for IMAP mail accounts) retrievers.
</p>
<p>
Specify the mail account type with one of the above values, like this:
</p>
<pre class="example">
type = <span class="meta">typename</span>
</pre>
<p>
Then, include lines for any parameters and their values which are required
by the retriever. The parameters and their types are documented below.
</p>
<h4 id="retriever-parameters">Common retriever parameters</h4>
<p>
All retriever types take several common required parameters:
</p>
<ul>
<li>
server
(<a href="#parameter-string">string</a>)
— the name or IP address of the server to retrieve mail from
</li>
<li>
username
(<a href="#parameter-string">string</a>)
— username to provide when logging in to the mail server
</li>
</ul>
<p>
All retriever types also take several optional parameters:
</p>
<ul>
<li>
port
(<a href="#parameter-integer">integer</a>)
— the TCP port number to connect to. If not provided, the default
is a port appropriate for the protocol (110 for POP3, etc.)
</li>
<li>
password
(<a href="#parameter-string">string</a>)
— password to use when logging in to the mail server. If not
provided, getmail will prompt you to enter the password when run.
</li>
</ul>
<h4 id="retriever-simplepop3">SimplePOP3Retriever</h4>
<p>
The SimplePOP3Retriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following optional parameters:
</p>
<ul>
<li>
use_apop
(<a href="#parameter-boolean">boolean</a>)
— if set to True, getmail will use APOP-style authentication to
log in to the server instead of normal USER/PASS authentication. This
is not supported by many POP3 servers. The default is
<span class="file">False</span>.
</li>
<li>
timeout
(<a href="#parameter-integer">integer</a>)
— how long (in seconds) to wait for socket operations to complete
before considering them failed. If not specified, the default is 180
seconds. You may need to increase this value in particularly poor
networking conditions.
</li>
</ul>
<h4 id="retriever-brokenpop3">BrokenUIDLPOP3Retriever</h4>
<p class="note">
This retriever class is intended only for use with broken POP3 servers
that either do not implement the
<span class="file">UIDL</span>
command, or which do not properly assign unique identifiers to messages
(preventing getmail from determining which messages it has seen before).
It will identify every message in the mailbox as a new message, and
therefore if you use this retriever class and opt not to delete messages
after retrieval, it will retrieve those messages again the next time
getmail is run. Use this retriever class only if your mailbox is hosted
on such a broken POP3 server, and the server does not provide another
means of getmail accessing it (i.e., IMAP).
</p>
<p>
The BrokenUIDLPOP3Retriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following optional parameters:
</p>
<ul>
<li>
use_apop
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
timeout
(<a href="#parameter-integer">integer</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
</ul>
<h4 id="retriever-simpleimap">SimpleIMAPRetriever</h4>
<p>
The SimpleIMAPRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following optional parameters:
</p>
<ul>
<li>
timeout
(<a href="#parameter-integer">integer</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
mailboxes
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— a list of mailbox paths to retrieve mail from, expressed as a
Python tuple. If not specified, the default is to retrieve mail from the
mail folder named
<span class="file">INBOX</span>.
You might want to retrieve messages from several different mail folders,
using a configuration like this:
<pre class="example">
mailboxes = ("INBOX", "INBOX.spam",
"mailing-lists.model-railroading")
</pre>
</li>
<li>
move_on_delete
(<a href="#parameter-string">string</a>)
— if set, messages are moved to the named mail folder before being
deleted from their original location. Note that if you configure
getmail not to delete retrieved messages (the default behaviour), they
will not be moved at all.
</li>
</ul>
<h4 id="retriever-simplepop3ssl">SimplePOP3SSLRetriever</h4>
<p>
The SimplePOP3SSLRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following optional parameters:
</p>
<ul>
<li>
use_apop
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
keyfile
(<a href="#parameter-string">string</a>)
— use the specified PEM-formatted key file in the SSL negotiation.
Note that no certificate or key validation is done.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— use the specified PEM-formatted certificate file in the SSL
negotiation. Note that no certificate or key validation is done.
</li>
</ul>
<h4 id="retriever-simpleimapssl">SimpleIMAPSSLRetriever</h4>
<p>
The SimpleIMAPSSLRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following optional parameters:
</p>
<ul>
<li>
mailboxes
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
for definition.
</li>
<li>
move_on_delete
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
for definition.
</li>
<li>
keyfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
for definition.
</li>
</ul>
<h4 id="retriever-multidroppop3">MultidropPOP3Retriever</h4>
<p>
The MultidropPOP3Retriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following required parameter:
</p>
<ul>
<li>
envelope_recipient
(<a href="#parameter-string">string</a>)
— the name and position of the header field which records the
envelope recipient address. This is set to a value of the form
<span class="file">
<span class="meta">field_name</span>
:
<span class="meta">field_position</span>
</span>.
The first (topmost) Delivered-To: header field would be specified as:
<pre class="example">
envelope_recipient = delivered-to:1
</pre>
</li>
</ul>
<p>
The MultidropPOP3Retriever also takes the following optional parameters:
</p>
<ul>
<li>
use_apop
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
timeout
(<a href="#parameter-integer">integer</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
</ul>
<h4 id="retriever-multidroppop3ssl">MultidropPOP3SSLRetriever</h4>
<p>
The MultidropPOP3SSLRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following required parameter:
</p>
<ul>
<li>
envelope_recipient
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-multidroppop3">MultidropPOP3Retriever</a>
for definition.
</li>
</ul>
<p>
The MultidropPOP3SSLRetriever class alo takes the following optional
parameters:
</p>
<ul>
<li>
use_apop
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
keyfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
for definition.
</li>
</ul>
<h4 id="retriever-multidropsdps">MultidropSDPSRetriever</h4>
<p>
The MultidropSDPSRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following optional parameters:
</p>
<ul>
<li>
timeout
(<a href="#parameter-integer">integer</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
</ul>
<h4 id="retriever-multidropimap">MultidropIMAPRetriever</h4>
<p>
The MultidropIMAPRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following required parameter:
</p>
<ul>
<li>
envelope_recipient
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-multidroppop3">MultidropPOP3Retriever</a>
for definition.
</li>
</ul>
<p>
The MultidropIMAPRetriever class also takes the following optional
parameters:
</p>
<ul>
<li>
timeout
(<a href="#parameter-integer">integer</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
mailboxes
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
for definition.
</li>
<li>
move_on_delete
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
for definition.
</li>
</ul>
<h4 id="retriever-multidropimapssl">MultidropIMAPSSLRetriever</h4>
<p>
The MultidropIMAPSSLRetriever class takes the
<a href="#retriever-parameters">common retriever parameters</a>
above, plus the following required parameter:
</p>
<ul>
<li>
envelope_recipient
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-multidroppop3">MultidropPOP3Retriever</a>
for definition.
</li>
</ul>
<p>
The MultidropIMAPSSLRetriever class also takes following optional
parameters:
</p>
<ul>
<li>
mailboxes
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
for definition.
</li>
<li>
move_on_delete
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</a>
for definition.
</li>
<li>
keyfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simplepop3ssl">SimplePOP3SSLRetriever</a>
for definition.
</li>
</ul>
<h3 id="retriever-examples">Retriever examples</h3>
<p>
A typical POP3 mail account (the basic kind of mailbox provided by most
internet service providers (ISPs)) would use a retriever configuration like
this:
</p>
<pre class="example">
[retriever]
type = SimplePOP3Retriever
server = popmail.isp.example.net
username = account_name
password = my_mail_password
</pre>
<p>
If your ISP provides POP3 access on a non-standard port number, you would
need to include the port parameter:
</p>
<pre class="example">
[retriever]
type = SimplePOP3Retriever
server = popmail.isp.example.net
port = 8110
username = account_name
password = my_mail_password
</pre>
<p>
If your ISP provides POP3-over-SSL and you wanted to use that, your
retriever configuration might look like this:
</p>
<pre class="example">
[retriever]
type = SimplePOP3SSLRetriever
server = popmail.isp.example.net
username = account_name
password = my_mail_password
</pre>
<p>
If you have an IMAP mail account and want to retrieve messages from several
mail folders under that account, and you want to move messages to a special
folder when deleting them, you would use a retriever configuration like
this:
</p>
<pre class="example">
[retriever]
type = SimpleIMAPRetriever
server = imapmail.isp.example.net
username = account_name
password = my_mail_password
mailboxes = ("INBOX", "lists.unix", "lists.getmail")
move_on_delete = mail.deleted
</pre>
<p>
If you are retrieving your company's mail from a domain POP3 mailbox for
delivery to multiple local users, you might use a retriever configuration
like this:
</p>
<pre class="example">
[retriever]
type = MultidropPOP3Retriever
server = imapmail.isp.example.net
username = account_name
password = company_maildrop_password
envelope_recipient = delivered-to:1
</pre>
<h3 id="conf-destination">Creating the <span class="file">[destination]</span> section</h3>
<p>
The
<span class="file">destination</span>
section of the rc file tells getmail what to do with retrieved messages.
Begin with the section header line as follows:
</p>
<pre class="example">
[destination]
</pre>
<p>
Then, include a
<span class="file">type</span>
<a href="#parameter-string">string parameter</a>
to tell getmail what type of mail destination this is. The possible values
are:
</p>
<ul>
<li>
<a href="#destination-maildir">Maildir</a>
— deliver all messages to a local qmail-style
<a href="http://cr.yp.to/proto/maildir.html">maildir</a>
</li>
<li>
<a href="#destination-mboxrd">Mboxrd</a>
— deliver all messages to a local mboxrd-format mbox file
with fcntl-type locking.
</li>
<li>
<a href="#destination-mdaexternal">MDA_external</a>
— use an external message delivery agent (MDA) to
deliver messages. Typical MDAs include
<a href="http://www.flounder.net/~mrsam/maildrop/maildrop.html">maildrop</a>,
<a href="http://www.procmail.org/">procmail</a>,
and others.
</li>
<li>
<a href="#destination-multidestination">MultiDestination</a>
— unconditionally deliver messages to multiple destinations
(maildirs, mbox files, external MDAs, or other destinations).
</li>
<li>
<a href="#destination-multisorter">MultiSorter</a>
— sort messages according to the envelope recipient
(requires a domain mailbox retriever) and deliver to a variety of
maildirs, mbox files, external MDAs, or other destinations based on
regular expressions matching the recipient address of each message.
Messages not matching any of the regular expressions are delivered to a
default "postmaster" destination.
</li>
<li>
<a href="#destination-multiguesser">MultiGuesser</a>
— sort messages according to addresses found in the message's
header fields and deliver to a variety of maildirs, mbox files, external
MDAs, or other destinations based on regular expressions matching those
addresses. Messages not matching any of the regular expressions are
delivered to a default "postmaster" destination.
</li>
<li>
<a href="#destination-mdaqmaillocal">MDA_qmaillocal</a>
— use
<a href="http://qmail.org/man/man8/qmail-local.html">qmail-local</a>
to deliver messages according to instructions in a
<a href="http://qmail.org/man/man9/dot-qmail.html">.qmail file</a>.
</li>
</ul>
<h4 id="destination-maildir">Maildir</h4>
<p>
The Maildir destination delivers to a qmail-style
<a href="http://cr.yp.to/proto/maildir.html">maildir</a>.
</p>
<p>
The Maildir destination takes one required parameter:
</p>
<ul>
<li>
path
(<a href="#parameter-string">string</a>)
— the path to the maildir, ending in slash
(<span class="file">/</span>).
This value will be expanded for leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
You might want to deliver messages to a maildir named
<span class="file">Maildir</span>
in your home directory; you could do this with a configuration like
this:
<pre class="example">
[destination]
type = Maildir
path = ~/Maildir/
</pre>
</li>
</ul>
<p>
The Maildir destination also takes one optional parameters:
</p>
<ul>
<li>
user
(<a href="#parameter-string">string</a>)
— on Unix-like systems, if supplied, getmail will change the
effective UID to that of the named user before delivering messages to
the maildir. Note that this typically requires root privileges.
getmail will not deliver to maildirs as root, so this
"optional" parameter is required in that situation.
</li>
</ul>
<h4 id="destination-mboxrd">Mboxrd</h4>
<p>
The Mboxrd destination delivers to an
<a href="http://qmail.org/man/man5/mbox.html">mboxrd-format mbox file</a>
with fcntl-type file locking. The file must already exist and appear to be
a valid mboxrd file before getmail will try to deliver to it — getmail
will
<strong>not</strong>
create the file if it does not exist.
</p>
<p class="warning">
You should ensure that all other programs accessing any the mbox file expect
mboxrd-format mbox files and fcntl-type file locking; failure to do so can
cause mbox corruption. Note that delivering to mbox files over NFS can be
unreliable and should be avoided; this is the case with any MDA.
</p>
<p>
The Mboxrd destination takes one required parameter:
</p>
<ul>
<li>
path
(<a href="#parameter-string">string</a>)
— the path to the mbox file. This value will be expanded for
leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
You might want to deliver messages to an mbox file named
<span class="file">inbox</span>
in your home directory; you could do this with a configuration like
this:
<pre class="example">
[destination]
type = Mboxrd
path = ~/inbox
</pre>
</li>
</ul>
<p>
The Mboxrd destination also takes one optional parameters:
</p>
<ul>
<li>
user
(<a href="#parameter-string">string</a>)
— on Unix-like systems, if supplied, getmail will change the
effective UID to that of the named user before delivering messages to
the mboxrd file. Note that this typically requires root privileges.
getmail will not deliver to mbox files as root, so this
"optional" parameter is required in that situation.
</li>
</ul>
<h4 id="destination-mdaexternal">MDA_external</h4>
<p>
MDA_external delivers messages by running an external program (known as a
message delivery agent, or MDA). Some typical MDAs include
<a href="http://www.flounder.net/~mrsam/maildrop/maildrop.html">maildrop</a>
and
<a href="http://www.procmail.org/">procmail</a>.
</p>
<p>
The MDA_external destination takes one required parameter:
</p>
<ul>
<li>
path
(<a href="#parameter-string">string</a>)
— the path to the command to run. This value will be expanded for
leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
</li>
</ul>
<p>
The MDA_external destination also takes several optional parameters:
</p>
<ul>
<li>
arguments
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— arguments to be supplied to the command. The following
substrings will be substituted with the equivalent values from the
message:
<ul>
<li>
<span class="sample">%(sender)</span>
— envelope return-path address
</li>
</ul>
If the message is retrieved with a multidrop retriever class, the
message recipient (and parts of it) are also available with the
following replacement substrings:
<ul>
<li>
<span class="sample">%(recipient)</span>
— envelope recipient address
</li>
<li>
<span class="sample">%(local)</span>
— local-part of the envelope recipient address
</li>
<li>
<span class="sample">%(domain)</span>
— domain-part of the envelope recipient address
</li>
</ul>
The default value of the
<span class="file">arguments</span>
parameter is
<span class="sample">()</span>,
so no arguments are supplied to the command.
</li>
<li>
unixfrom
(<a href="#parameter-boolean">boolean</a>)
— whether to include a Unix-style mbox
<span class="file">From_</span>
line at the beginning of the message supplied to the command. Defaults
to false. Some MDAs expect such a line to be present and will fail
to operate if it is missing.
</li>
<li>
user
(<a href="#parameter-string">string</a>)
— if supplied, getmail will change the effective UID to that of
the named user. Note that this typically requires root privileges.
</li>
<li>
group
(<a href="#parameter-string">string</a>)
— if supplied, getmail will change the effective GID to that of
the named group. Note that this typically requires root privileges.
</li>
<li>
allow_root_commands
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will run external commands even if it is
currently running with root privileges. The default is false, which
causes getmail to raise an exception if it is asked to run an external
command as root.
<span class="warning">
Note that setting this option has serious security implications.
Don't use it if you don't know what you're doing.
I strongly recommend against running external processes as root.
</span>
</li>
</ul>
<p>
If an external MDA writes anything to
<span class="file">stderr</span>,
getmail will consider the delivery to have encountered an error. getmail
will leave the message on the server and proceed to the next message.
You must configure any MDA you use not to emit messages to stderr except
on errors — please see the documentation for your MDA for details;
this should be the default mode of operation for any sane MDA.
</p>
<p>
A basic invocation of an external MDA might look like this:
</p>
<pre class="example">
[destination]
type = MDA_external
path = /path/to/mymda
arguments = ("--log-errors", )
</pre>
<p>
Something more complex might look like this:
</p>
<pre class="example">
[destination]
type = MDA_external
path = /path/to/mymda
# Switch to fred's UID and the mail group GID before delivering his mail
user = fred
group = mail
arguments = ("--strip-forbidden-attachments", "--recipient=%(recipient)")
</pre>
<h4 id="destination-multidestination">MultiDestination</h4>
<p>
MultiDestination doesn't do any message deliveries itself; instead,
it lets you specify a list of one or more other destinations which
it will pass each message to. You can use this to deliver each message
to several different destinations.
</p>
<p>
The MultiDestination destination takes one required parameter:
</p>
<ul>
<li>
<p>
destinations
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— the destinations which the messages will be passed to.
A destination is a string that refers to another configuration
file section by name (shortcuts for maildirs and mboxrd files are
also provided; see below), like this:
</p>
<pre class="example">
destinations = ('[other-destination-1]', '[other-destination-2]')
[other-destination-1]
type = Mboxrd
path = /var/spool/mail/alice
user = alice
[other-destination-2]
type = Maildir
path = /home/joe/Maildir/
user = joe
</pre>
<p>
Because Maildir and Mboxrd destinations are common, you can specify
them directly as a shortcut
<strong>
if they do not require a
<span class="file">user</span>
parameter.
</strong>
If the string (after expansion; see below) starts with a dot or
slash and ends with a slash, it specifies the path of a Maildir
destination, while if it starts with a dot or a slash and does not
end with a slash, it specifies the path of a Mboxrd destination.
</p>
<p>
For instance, you can deliver mail to two maildirs with the following:
</p>
<pre class="example">
destinations = ('~/Mail/inbox/', '~/Mail/archive/current/')
</pre>
<p>
Each destination string is first expanded for leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
</p>
</li>
</ul>
<p>
Some examples:
</p>
<ul>
<li>
To deliver to a maildir named
<span class="file">Maildir</span>
in the home directory of user
<span class="file">jeff</span>, when
<span class="file">getmail</span> is run as that user:
<pre class="example">
[destination]
type = MultiDestination
destinations = ("~jeff/Maildir/", )
</pre>
</li>
<li>
To deliver to an mboxrd file:
<pre class="example">
[destination]
type = MultiDestination
destinations = ("/var/spool/mail/alice", )
</pre>
</li>
<li>
To deliver with an external MDA:
<pre class="example">
[destination]
type = MultiDestination
destinations = ("[procmail-as-bob]", )
[procmail-as-bob]
type = MDA_external
path = /path/to/procmail
arguments = ('~bob/.procmailrc', '-f', '%(sender)')
user = bob
</pre>
</li>
</ul>
<p>
Of course, the whole point of MultiDestination is to allow you to specify
multiple destinations, like this:
</p>
<pre class="example">
[destination]
type = MultiDestination
destinations = (
"~jeff/Mail/inbox",
"[procmail-as-jeff]",
"/var/mail-archive/incoming"
)
[procmail-as-jeff]
type = MDA_external
path = /path/to/procmail
arguments = ('~jeff/.procmailrc', '-f', '%(sender)')
user = jeff
</pre>
<h4 id="destination-multisorter">MultiSorter</h4>
<p>
MultiSorter compares the envelope recipient address of messages against a
list of user-supplied regular expressions and delivers the message to the
destination (maildir, mboxrd file, or other) associated with any matching
patterns. A message can match multiple patterns and therefore be delivered
to multiple matching destinations. Any message which matches none of the
patterns is delivered to a default destination for the postmaster.
</p>
<p class="important">
Because MultiSorter requires the envelope recipient to operate, it must be
used with a domain mailbox retriever. If you instead want to do some basic
message sorting based on addresses found in the message header (using
getmail as a combination retriever and basic filtering MDA), see the
<a href="#destination-multiguesser">MultiGuesser</a>
destination class below.
</p>
<p>
The MultiSorter destination takes one required parameter:
</p>
<ul>
<li>
default
(<a href="#parameter-string">string</a>)
— the destination for messages which aren't matched by any of the
"locals" regular expressions. The destination can be a
maildir, mboxrd file, or other destination. See
<a href="#destination-multidestination">MultiDestination</a>
for an explanation of how the type of destination is interpreted from
this value.
</li>
</ul>
<p>
The MultiSorter destination also takes one optional parameter:
</p>
<ul>
<li>
locals
(<a href="#parameter-tuple2tuples">tuple of 2-tuples</a>)
— zero or more regular expression – destination pairs.
Messages will be delivered to each destination for which the envelope
recipient matches the given regular expression. The regular expression
and destination are supplied as two quoted strings in a tuple; locals is
then a tuple of such pairs of strings. Destinations are specified in
the same manner as with the "default" parameter, above.
</li>
</ul>
<p>
Note that if you don't understand regular expressions, you don't need to
worry about it. In general, an email address is a regular expression that
matches itself. The only significant times this isn't the case is when the
address contains odd punctuation characters like
<span class="file">^</span>,
<span class="file">$</span>,
or
<span class="file">[</span>.
Handy hints:
</p>
<ul>
<li>
the regular expression
<span class="file">.</span>
(dot) matches anything
</li>
<li>
matches can occur anywhere in the address. If you want to only match at
the beginning, start your expression with the
<span class="file">^</span>
character. If you only want to match the whole address, also end your
expression with a dollar sign
<span class="file">$</span>.
</li>
</ul>
<p>
Using regular expressions:
</p>
<ul>
<li>
The regular expression
<span class="file">joe@example.org</span>
matches the addresses
<span class="file">joe@example.org</span>,
<span class="file">joe@example.org.net</span>,
and <span class="file">heyjoe@example.org</span>.
</li>
<li>
The regular expression
<span class="file">^jeff@</span>
matches the addresses
<span class="file">jeff@example.org</span>
and
<span class="file">jeff@example.net</span>,
but not <span class="file">otherjeff@example.org</span>.
</li>
<li>
The regular expression
<span class="file">sam</span>
matches the addresses
<span class="file">sam@example.org</span>,
<span class="file">samantha@example.org</span>,
<span class="file">asam@example.org</span>,
and
<span class="file">chris@isam.example.net</span>.
</li>
</ul>
<p>
Some examples:
</p>
<ul>
<li>
<ul>
<li>
Deliver mail matching
<span class="file">jeff@example.net</span>
to
<span class="file">~jeff/Maildir/</span>
</li>
<li>
Deliver mail matching
<span class="file">alice@<span class="meta">anything</span></span>
to
<span class="file">~alice/inbox</span>
</li>
<li>
Deliver all other mail to
<span class="file">~bob/Maildir/</span>
</li>
</ul>
<pre class="example">
[destination]
type = MultiSorter
default = [bob-default]
locals = (
('jeff@example.net', '[jeff]'),
('alice@', '[alice]')
)
[jeff]
type = Maildir
path = ~jeff/Maildir/
user = jeff
[alice]
type = Mboxrd
path = ~alice/inbox
user = alice
[bob-default]
type = Maildir
path = ~bob/Maildir/
user = bob
</pre>
</li>
<li>
<ul>
<li>
Deliver mail for jeff, bob, and alice to maildirs in their home
directories
</li>
<li>Deliver copies of all messages to samantha's mail archive</li>
<li>
Deliver copies of all messages to a program that logs certain
information. This program should run as the user
<span class="filename">log</span>,
and command arguments should tell it to record the info to
<span class="filename">/var/log/mail/info</span>
</li>
</ul>
<pre class="example">
[destination]
type = MultiSorter
default = doesn't matter, this won't be used, as locals will always match
locals = (
('^jeff@'), '[jeff]'),
('^bob@'), '[bob]'),
('^alice@'), '[alice]'),
('.'), '[copies]'),
('.'), '[info]')
)
[alice]
type = Maildir
path = ~alice/Maildir/
user = alice
[bob]
type = Maildir
path = ~bob/Maildir/
user = bob
[jeff]
type = Maildir
path = ~jeff/Maildir/
user = jeff
[copies]
type = Maildir
path = ~samantha/Mail/archive/copies/
user = samantha
[info]
type = MDA_external
path = /path/to/infologger
arguments = ('--log=/var/log/mail/info', '--sender=%(sender)', '--recipient=%(recipient))
user = log
</pre>
</li>
</ul>
<h4 id="destination-multiguesser">MultiGuesser</h4>
<p>
MultiGuesser compares addresses found in the message header against a
list of user-supplied regular expressions and delivers the message to the
destination (maildir, mboxrd file, or other) associated with any matching
patterns. A message can match multiple patterns and therefore be delivered
to multiple matching destinations. Any message which matches none of the
patterns is delivered to a default destination for the postmaster.
In this fashion, you can do basic mail filtering and sorting with getmail
without using an external filtering message delivery agent (MDA) (such
as maildrop or procmail).
</p>
<p>
MultiGuesser is similar to
<a href="#destination-multisorter">MultiSorter</a>,
except that it does not operate on the envelope recipient address, and
therefore does not require a domain mailbox retriever. Because it is
"guessing" at the intended recipient of the message based on the
contents of the message header, it is fallible — for instance, the
address of a recipient of a mailing list message may not appear in the
header of the message at all. If your
<span class="file">locals</span>
regular expression patterns are only looking for that address, MultiGuesser
will then have to deliver it to the destination specified as the
<span class="file">default</span>
recipient.
</p>
<p>
This functionality is very similar to the guessing functionality of
getmail version 2, which was removed in version 3. MultiGuesser extracts
a list of addresses from the message header like this:
</p>
<ol>
<li>
it looks for addresses in any
<span class="file">Delivered-To:</span> header fields.
</li>
<li>
if no addresses have been found, it looks for addresses in any
<span class="file">Envelope-To:</span> header fields.
</li>
<li>
if no addresses have been found, it looks for addresses in any
<span class="file">X-Envelope-To:</span> header fields.
</li>
<li>
if no addresses have been found, it looks for addresses in any
<span class="file">Apparently-To:</span> header fields.
</li>
<li>
if no addresses have been found, it looks for addresses in any
<span class="file">Resent-to:</span>
or
<span class="file">Resent-cc:</span>
header fields (or
<span class="file">Resent-bcc:</span>,
which shouldn't be present).
</li>
<li>
if no addresses have been found, it looks for addresses in any
<span class="file">To:</span>
or
<span class="file">cc:</span>
header fields (or
<span class="file">bcc:</span>,
which shouldn't be present).
</li>
</ol>
<p>
The MultiGuesser destination takes one required parameter:
</p>
<ul>
<li>
default
(<a href="#parameter-string">string</a>)
— see
<a href="#destination-multisorter">MultiSorter</a>
for definition.
</li>
</ul>
<p>
The MultiGuesser destination also takes one optional parameter:
</p>
<ul>
<li>
locals
(<a href="#parameter-tuple2tuples">tuple of 2-tuples</a>)
— see
<a href="#destination-multisorter">MultiSorter</a>
for definition.
</li>
</ul>
<p>
Examples:
</p>
<p>
If you have a simple POP3 account (i.e. it's not a multidrop mailbox)
and you want to deliver your personal mail to your regular maildir,
but deliver mail from a couple of mailing lists (identified by the list
address appearing in the message header) to separate maildirs,
you could use a MultiGuesser configuration like this:
</p>
<pre class="example">
[destination]
type = MultiGuesser
default = ~/Maildir/
locals = (
("list-address-1@list-domain-1", "~/Mail/mailing-lists/list-1/"),
("list-address-2@list-domain-2", "~/Mail/mailing-lists/list-2/"),
)
</pre>
<p>
See <a href="#destination-multisorter">MultiSorter</a>
above for other examples of getmail rc usage; the only difference is the
<span class="file">type</span>
parameter specifying the
<span class="file">MultiGuesser</span>
destination.
</p>
<h4 id="destination-mdaqmaillocal">MDA_qmaillocal</h4>
<p>
MDA_qmaillocal delivers messages by running the
<span class="file">qmail-local</span>
program as an external MDA.
<span class="file">qmail-local</span>
uses
<span class="file">.qmail</span>
files to tell it what to do with messages. If you're not already familiar
with qmail, you don't need to use this destination class.
</p>
<p>
The MDA_qmaillocal destination takes several optional parameters:
</p>
<ul>
<li>
qmaillocal
(<a href="#parameter-string">string</a>)
— path to the
<span class="file">qmail-local</span>
program. The default value is
<span class="file">/var/qmail/bin/qmail-local</span>.
</li>
<li>
user
(<a href="#parameter-string">string</a>)
— supplied to
<span class="file">qmail-local</span>,
and also tells getmail to change the current effective UID to that of
the named user before running
<span class="file">qmail-local</span>.
Note that this typically requires root privileges. The default value is
the account name of the current effective UID.
</li>
<li>
group
(<a href="#parameter-string">string</a>)
— if supplied, getmail will change the effective GID to that of
the named group before running
<span class="file">qmail-local</span>.
Note that this typically requires root privileges.
</li>
<li>
homedir
(<a href="#parameter-string">string</a>)
— supplied to
<span class="file">qmail-local</span>.
The default value is the home directory of the account with the current
effective UID.
</li>
<li>
localdomain
(<a href="#parameter-string">string</a>)
— supplied to
<span class="file">qmail-local</span>
as its
<span class="file">domain</span>
argument. The default value is the fully-qualified domain name of the
local host.
</li>
<li>
defaultdelivery
(<a href="#parameter-string">string</a>)
— supplied to
<span class="file">qmail-local</span>
as its
<span class="file">defaultdelivery</span>
argument. The default value is
<span class="file">./Maildir/</span>.
</li>
<li>
conf-break
(<a href="#parameter-string">string</a>)
— supplied to
<span class="file">qmail-local</span>
as its
<span class="file">dash</span>
argument. The default value is
<span class="file">-</span>.
</li>
<li>
localpart_translate
(<a href="#parameter-tuplestrings">2-tuple of quoted strings</a>)
— if supplied, the recipient address of the message (which is used
to construct the
<span class="file">local</span>
argument (among others) to
<span class="file">qmail-local</span>)
will have any leading instance of the first string replaced with the
second string. This can be used to remap recipient addresses, trim
extraneous prefixes (such as the qmail virtualdomain
<span class="file">prepend</span>
value), or perform other tasks. The default value is
<span class="file">('', '')</span>
(i.e., no translation).
</li>
<li>
strip_delivered_to
(<a href="#parameter-boolean">boolean</a>)
— if set,
<span class="file">Delivered-To:</span>
header fields will be removed from the message before handing it to
<span class="file">qmail-local</span>.
This may be necessary to prevent qmail-local falsely detecting a looping
message if (for instance) the system retrieving messages otherwise
believes it has the same domain name as the retrieval server.
<span class="warning">
Inappropriate use of this option may cause message loops.
</span>
The default value is
<span class="file">False</span>.
</li>
<li>
allow_root_commands
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will run
<span class="file">qmail-local</span>
even if it is currently running with root privileges. The default is
false, which causes getmail to raise an exception if it is asked to run
an external command as root.
<span class="warning">
Note that setting this option has serious security implications.
Don't use it if you don't know what you're doing.
I strongly recommend against running external processes as root.
</span>
</li>
</ul>
<p>
A basic invocation of qmail-local might look like this:
</p>
<pre class="example">
[destination]
type = MDA_qmaillocal
user = joyce
</pre>
<p>
Something more complex might look like this:
</p>
<pre class="example">
[destination]
type = MDA_qmaillocal
user = joyce
# The mail domain isn't the normal FQDN of the server running getmail
localdomain = host.example.net
# Trim the server's virtualdomain prepend value from message recipient before
# sending it to qmail-local
localpart_translate = ('mailhostaccount-', '')
</pre>
<h3 id="conf-options">Creating the <span class="file">[options]</span> section</h3>
<p>
The optional
<span class="file">options</span>
section of the rc file can be used to alter getmail's default behaviour.
The parameters supported in this section are as follows:
</p>
<ul>
<li>
verbose
(<a href="#parameter-integer">integer</a>)
— controls getmail's verbosity. If set to 2, getmail prints
messages about each of its actions. If set to 1, it prints messages
about retrieving and deleting messages (only). If set to 0, getmail
will only print warnings and errors. Default: 1.
</li>
<li>
read_all
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail retrieves all available messages. If unset,
getmail only retrieves messages it has not seen before. Default: True.
</li>
<li>
delete
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will delete messages after retrieving and
successfully delivering them. If unset, getmail will leave messages on
the server after retrieving them. Default: False.
</li>
<li>
delete_after
(<a href="#parameter-integer">integer</a>)
— if set, getmail will delete messages this number of days after
first seeing them, if they have been retrieved and delivered. This, in
effect, leaves messages on the server for a configurable number of days
after retrieving them. Note that the delete parameter has higher
priority; if both are set, the messages will be deleted immediately.
Default: 0, which means not to enable this feature.
</li>
<li>
max_message_size
(<a href="#parameter-integer">integer</a>)
— if set, getmail will not retrieve messages larger than this
number of bytes. Default: 0, which means not to enable this feature.
</li>
<li>
max_messages_per_session
(<a href="#parameter-integer">integer</a>)
— if set, getmail will process a maximum of this number of
messages before closing the session with the server. This can be useful
if your network or the server is particuarly unreliable. Default: 0,
which means not to enable this feature.
</li>
<li>
delivered_to
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail adds a Delivered-To: header field to the
message. If unset, it will not do so. Default: True. Note that this
field will contain the envelope recipient of the message if the
retriever in use is a multidrop retriever; otherwise it will contain the
string "unknown".
</li>
<li>
received
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail adds a Received: header field to the message.
If unset, it will not do so. Default: True.
</li>
<li>
message_log
(<a href="#parameter-string">string</a>)
— if set, getmail will record a log of its actions to the named
file. The value will be expanded for leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
Default: '' (the empty string), which means not to enable this feature.
</li>
<li>
message_log_syslog
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will record a log of its actions using the
system logger.
<span class="warning">
Note that syslog is inherently unreliable and can lose log messages.
</span>
Default: False.
</li>
</ul>
<p>
Most users will want to either enable the
<span class="file">delete</span>
option (to delete mail after retrieving it), or disable the
<span class="file">read_all</span>
option (to only retrieve previously-unread mail).
</p>
<p>
The verbose, read_all, and delete parameters can be overridden at run time
with
<a href="#running">commandline options</a>.
</p>
<h4 id="options-example"><span class="file">[options]</span> example</h4>
<p>
To configure getmail to operate quietly, to retrieve only new mail,
to delete messages after retrieving them, and to log its actions to
a file, you could provide the following in your getmail rc file(s):
</p>
<pre class="example">
[options]
verbose = 0
read_all = false
delete = true
message_log = ~/.getmail/log
</pre>
<h3 id="conf-filters">Creating the <span class="file">[filter-<span class="meta">something</span>]</span> sections</h3>
<p>
The
filter-<span class="meta">something</span>
section(s) of the rc file (which are not required) tell getmail to process
messages in some way after retrieving them, but before delivering them to
your destinations. Filters can tell getmail to drop a message (i.e. not
deliver it at all), add information to the message header (i.e. for a spam-
classification system or similar), or modify message content (like an
antivirus system stripping suspected MIME parts from messages).
</p>
<p>
You can specify any number of filters; provide a separate rc file section
for each, naming each of them
filter-<span class="meta">something</span>.
They will be run in collated order, so it's likely simplest to name them
like this:
</p>
<ul>
<li class="file">[filter-1]</li>
<li class="file">[filter-2]</li>
<li class="file">[filter-3]</li>
</ul>
<p>
Begin with the section header line as follows:
</p>
<pre class="example">
[filter-<span class="meta">something</span>]
</pre>
<p>
Then, include a
<span class="file">type</span>
<a href="#parameter-string">string parameter</a>
to tell getmail what type of filter. The possible values are:
</p>
<ul>
<li>
<a href="#conf-filters-classifier">Filter_classifier</a>
— run the message through an external program, and insert the
output of the program into
<span class="file">X-getmail-filter-classifier:</span>
header fields in the message. Messages can be dropped by having the
filter return specific exit codes.
</li>
<li>
<a href="#conf-filters-external">Filter_external</a>
— supply the message to an external program, which can then modify
the message in any fashion. The program must print the modified message
to stdout. getmail reads the modified message from the program in this
fasion before proceeding to the next filter or destination. Messages
can be dropped by having the filter return specific exit codes.
</li>
<li>
<a href="#conf-filters-tmda">Filter_TMDA</a>
— run the message through the
<span class="file">tmda-filter</span>
program for use with the
<a href="http://www.tmda.net/">Tagged Message Delivery Agent (TMDA)</a>
package. If
<span class="file">tmda-filter</span>
returns 0, the message will be passed to the next filter (or
destination). If it returns 99, the message will be dropped,
and TMDA is responsible for sending a challenge message, queuing
the original, etc., as with normal TMDA operation in a
<span class="file">.qmail</span>,
<span class="file">.courier</span>,
or
<span class="file">.forward</span>
file.
</li>
</ul>
<p>
If a filter writes anything to
<span class="file">stderr</span>,
getmail will consider the delivery to have encountered an error. getmail
will leave the message on the server and proceed to the next message.
You must configure any filter you use not to emit messages to stderr except
on errors — please see the documentation for your filter program
for details; this should be the default mode of operation for any sane
filter.
</p>
<h4 id="conf-filters-classifier">Filter_classifier</h4>
<p>
Filter_classifier runs the message through an external program, placing the
output of that program into
<span class="file">X-getmail-filter-classifier:</span>
header fields. It can also cause messages to be dropped by exiting with
a return code listed in the exitcodes_drop parameter.
</p>
<p>
Filter_classifier has one required parameter:
</p>
<ul>
<li>
path
(<a href="#parameter-string">string</a>)
— the path to the command to run. This value will be expanded for
leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
</li>
</ul>
<p>
In addition, Filter_classifier takes the following optional parameters:
</p>
<ul>
<li>
arguments
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— arguments to be supplied to the command. The following
substrings will be substituted with the equivalent values from the
message:
<ul>
<li>
<span class="sample">%(sender)</span>
— envelope return-path address
</li>
</ul>
If the message is retrieved with a multidrop retriever class, the
message recipient (and parts of it) are also available with the
following replacement substrings:
<ul>
<li>
<span class="sample">%(recipient)</span>
— envelope recipient address
</li>
<li>
<span class="sample">%(local)</span>
— local-part of the envelope recipient address
</li>
<li>
<span class="sample">%(domain)</span>
— domain-part of the envelope recipient address
</li>
</ul>
The default value of the
<span class="file">arguments</span>
parameter is
<span class="sample">()</span>,
so no arguments are supplied to the command. </li>
<li>
unixfrom
(<a href="#parameter-boolean">boolean</a>)
— whether to include a Unix-style mbox
<span class="file">From_</span>
line at the beginning of the message supplied to the command. Default:
False.
</li>
<li>
user
(<a href="#parameter-string">string</a>)
— if supplied, getmail will change the effective UID to that of
the named user. Note that this typically requires root privileges.
</li>
<li>
group
(<a href="#parameter-string">string</a>)
— if supplied, getmail will change the effective GID to that of
the named group. Note that this typically requires root privileges.
</li>
<li>
allow_root_commands
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will run external commands even if it is
currently running with root privileges. The default is false, which
causes getmail to raise an exception if it is asked to run an external
command as root.
<span class="warning">
Note that setting this option has serious security implications.
Don't use it if you don't know what you're doing.
I strongly recommend against running external processes as root.
</span>
</li>
<li>
exitcodes_drop
(<a href="#parameter-tupleintegers">tuple of integers</a>)
— if the filter returns an exit code in this list, the message
will be dropped. The default is
<span class="sample">(99, 100)</span>.
</li>
<li>
exitcodes_keep
(<a href="#parameter-tupleintegers">tuple of integers</a>)
— if the filter returns an exit code other than those in
<span class="file">exitcodes_drop</span>
and
<span class="file">exitcodes_keep</span>,
getmail assumes the filter encountered an error. getmail will then not
proceed, so that the message is not lost. The default is
<span class="sample">(0, )</span>.
</li>
</ul>
<h4 id="conf-filters-external">Filter_external</h4>
<p>
Filter_external runs the message through an external program, and replaces
the message with the output of that program, allowing the filter to make
arbitrary changes to messages. It can also cause messages to be dropped by
exiting with a return code listed in the exitcodes_drop parameter.
</p>
<p>
Filter_external has one required parameter:
</p>
<ul>
<li>
path
(<a href="#parameter-string">string</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
</ul>
<p>
In addition, Filter_external takes the following optional parameters:
</p>
<ul>
<li>
arguments
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
unixfrom
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
user
(<a href="#parameter-string">string</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
group
(<a href="#parameter-string">string</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
allow_root_commands
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
exitcodes_drop
(<a href="#parameter-tupleintegers">tuple of integers</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
exitcodes_keep
(<a href="#parameter-tupleintegers">tuple of integers</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
</ul>
<h4 id="conf-filters-tmda">Filter_TMDA</h4>
<p>
Filter_external runs the message through the external program
<span class="file">tmda-filter</span>, allowing the use of the
<a href="http://www.tmda.net/">Tagged Message Delivery Agent (TMDA)</a>
package. As TMDA relies on the message envelope, this filter requires
the use of a multidrop retriever class to function. It sets the
three environment variables
<span class="file">SENDER</span>,
<span class="file">RECIPIENT</span>,
and
<span class="file">EXT</span>
prior to running
<span class="file">tmda-filter</span>.
</p>
<p class="warning">
I've tested this filter, and it Works For Me™, but I'm not a regular
TMDA user. I would appreciate any feedback about its use from TMDA users.
</p>
<p>
Filter_TMDA has no required parameters. It has the following optional
parameters:
</p>
<ul>
<li>
path
(<a href="#parameter-string">string</a>)
— the path to the
<span class="file">tmda-filter</span>
binary. Default:
<span class="file">/usr/local/bin/tmda-filter</span>.
This value will be expanded for leading
<span class="file">~</span>
or
<span class="file">~<span class="meta">USER</span></span>
and environment variables in the form
<span class="file">$<span class="meta">VARNAME</span></span>
or
<span class="file">${<span class="meta">VARNAME</span>}</span>.
</li>
<li>
user
(<a href="#parameter-string">string</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
group
(<a href="#parameter-string">string</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
allow_root_commands
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#conf-filters-classifier">Filter_classifier</a>
for definition.
</li>
<li>
conf-break
(<a href="#parameter-string">string</a>)
— this value will be used to split the local-part of the envelope
recipient address to determine the value of the
<span class="file">EXT</span>
environment variable. For example, if the envelope sender address is
<span class="file">sender-something@host.example.org</span>,
and the envelope recipient address is
<span class="file">user-ext-ext2@host.example.net</span>,
and
<span class="file">conf-break</span>
is set to
<span class="file">-</span>,
getmail will set the environment variables
<span class="file">SENDER</span>
to
"<span class="file">sender-something@host.example.org</span>",
<span class="file">RECIPIENT</span>
to
"<span class="file">user-ext-ext2@host.example.net</span>",
and
<span class="file">EXT</span>
to
"<span class="file">ext-ext2</span>".
Default: "-".
</li>
</ul>
<h4 id="filter-examples"><span class="file">[filter-<span class="meta">something</span>]</span> examples</h4>
<p>
You might filter spam messages in your MUA based on information added to the
message header by a spam-classification program. You could have that
information added to the message header with a filter configuration like
this:
</p>
<pre class="example">
[filter-3]
type = Filter_classifier
path = /path/to/my-classifier
arguments = ('--message-from-stdin', '--report-to-stdout')
user = nobody
</pre>
<p>
You might use a program to prevent users from accidentally destroying their
data by stripping suspected attachments from messages. You could have that
information added to the message header with a filter configuration like
this:
</p>
<pre class="example">
[filter-3]
type = Filter_external
path = /path/to/my-mime-filter
arguments = ('--message-from-stdin', '--remove-all-but-attachment-types=text/plain,text/rfc822')
user = nobody
</pre>
<p>
You might use TMDA to challenge messages from unknown senders. If the
default parameters are fine for your configuration, this is as simple as:
</p>
<pre class="example">
[filter-3]
type = Filter_TMDA
</pre>
<h3 id="examplerc">getmail rc file examples</h3>
<p>
Several examples of different getmail rc configuration are available
in the included file
<a href="getmailrc-examples">getmailrc-examples</a>.
</p>
<!-- ********************************************************************** -->
<h1 id="running">Running getmail</h1>
<p>
To use getmail, simply run the script
<span class="file">getmail</span>,
which is typically installed in
<span class="file">/usr/local/bin/</span>
by default. getmail will read the default getmail rc file
(<span class="file">getmailrc</span>)
from the default configuration/data directory
(<span class="file">~/.getmail/</span>)
and begin operating.
</p>
<p>
You can modify this behaviour by supplying commandline options to getmail.
</p>
<!-- ********************************************************************** -->
<h2 id="running-commandline-options">Commandline options</h2>
<p>
getmail understands the following options:
</p>
<ul>
<li>--version — show getmail's version number and exit</li>
<li>--help or -h — show a brief usage summary and exit</li>
<li>
--getmaildir=<span class="meta">DIR</span>
or
-g<span class="meta">DIR</span>
— use
<span class="meta">DIR</span>
for configuration and data files
</li>
<li>
--rcfile=<span class="meta">FILE</span>
or
-r<span class="meta">FILE</span>
— read getmail rc file
<span class="meta">FILE</span>
instead of the default. The file path is assumed to be relative to the
<span class="meta">getmaildir</span>
directory unless this value starts with a slash
(<span class="file">/</span>).
This option can be given multiple times to have getmail retrieve mail
from multiple accounts.
</li>
<li>
--dump — read rc files, dump configuration, and exit (debugging)
</li>
<li>--trace — print extended debugging information</li>
</ul>
<p>
In addition, the following commandline options can be used to override any
values specified in the
<span class="file">[options]</span>
section of the getmail rc files:
</p>
<ul>
<li>
--verbose or -v — operate more verbosely. Can be given multiple
times.
</li>
<li>--quiet or -q — print only warnings or errors while running</li>
<li>--delete or -d — delete messages after retrieving</li>
<li>--dont-delete or -l — do not delete messages after retrieving</li>
<li>--all or -a — retrieve all messages</li>
<li>--new or -n — retrieve only new (unseen) messages</li>
</ul>
<p>
For instance, if you want to retrieve mail from two different mail accounts,
create a getmail rc file for each of them (named, say,
<span class="file">getmailrc-account1</span>
and
<span class="file">getmailrc-account2</span>)
and put them in
<span class="file">~/.getmail/</span> .
Then run getmail as follows:
</p>
<pre class="example">
$ getmail --rcfile getmailrc-account1 --rcfile getmailrc-account2
</pre>
<p>
If those files were located in a directory other than the default, and you
wanted to use that directory for storing the data files as well, you could
run getmail as follows:
</p>
<pre class="example">
$ getmail --getmaildir /path/to/otherdir --rcfile getmailrc-account1 --rcfile getmailrc-account2
</pre>
<!-- ********************************************************************** -->
<h2 id="running-mda">Using getmail as an MDA</h2>
<p>
getmail includes helper scripts which allow you to use it to deliver mail
from other programs to maildirs or mboxrd files.
</p>
<h3 id="running-mda-maildir">Using the <span class="file">getmail_maildir</span> MDA</h3>
<p>
The
<span class="file">getmail_maildir</span>
script can be used as an MDA from other programs to deliver mail to
maildirs. It reads the mail message from stdin, and delivers it to a
maildir path provided as an argument on the commandline. This path
must (after expansion by the shell, if applicable) start with a dot
or slash and end with a slash.
</p>
<p>
<span class="file">getmail_maildir</span>
uses the contents of the
<span class="file">SENDER</span>
environment variable to construct a
<span class="file">Return-Path:</span>
header field and the contents of the
<span class="file">RECIPIENT</span>
environment variable to construct a
<span class="file">Delivered-To:</span>
header field at the top of the message.
</p>
<p>
<span class="file">getmail_maildir</span>
also accepts the options
<span class="file">--verbose</span>
or
<span class="file">-v</span>
which tell it to print a status message on success. The default is to
operate silently unless an error occurs.
</p>
<h4 id="running-mda-maildir-example">Example</h4>
<p>
You could deliver a message to a maildir named
<span class="file">Maildir</span>
located in your home directory by running the following command
with the message on stdin:
</p>
<pre class="example">
$ getmail_maildir $HOME/Maildir/
</pre>
<h3 id="running-mda-mbox">Using the <span class="file">getmail_mbox</span> MDA</h3>
<p>
The
<span class="file">getmail_mbox</span>
script can be used as an MDA from other programs to deliver mail to
mboxrd-format mbox files. It reads the mail message from stdin, and
delivers it to an mbox path provided as an argument on the commandline.
This path must (after expansion by the shell, if applicable) start with a
dot or slash and not end with a slash.
</p>
<p>
<span class="file">getmail_maildir</span>
uses the contents of the
<span class="file">SENDER</span>
environment variable to construct a
<span class="file">Return-Path:</span>
header field and mbox
<span class="file">From_</span>
line and the contents of the
<span class="file">RECIPIENT</span>
environment variable to construct a
<span class="file">Delivered-To:</span>
header field at the top of the message.
</p>
<p>
<span class="file">getmail_mbox</span>
also accepts the options
<span class="file">--verbose</span>
or
<span class="file">-v</span>
which tell it to print a status message on success. The default is to
operate silently unless an error occurs.
</p>
<h4 id="running-mda-mbox-example">Example</h4>
<p>
You could deliver a message to an mboxrd-format mbox file named
<span class="file">inbox</span>
located in a directory named
<span class="file">mail</span>
in your home directory by running the following command with the message on
stdin:
</p>
<pre class="example">
$ getmail_mbox $HOME/mail/inbox
</pre>
<!--#include virtual="/include/footer-xhtml11.html"-->
</div>
<!--#include virtual="/include/menu-top.html"-->
<!--#include virtual="/include/header.html"-->
</body>
</html>
|