1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!--
docs/COPYING 2a + DRY: https://github.com/getmail6/getmail6
Please refer to the git history regarding who changed what and when in this file.
-->
<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</title>
<meta name="author" content="Charles Cazabon and others" />
<meta name="description" content="Official documentation for getmail version 6, an extensible mail-retrieval program with support for POP3, IMAP, SDPS, SSL, domain mailboxes, message filtering, and other features." />
<meta name="keywords" content="getmail, getmail 6, getmail6, POP3, IMAP, SSL, domain mailbox, multidrop, fetchmail replacement, message filtering, maildir, mboxrd, MDA" />
<link rel="Contents Up Index" title="getmail6" 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 6,
a port of getmail version 5 to python 3.
</p>
<p class="about">
getmail6 is Copyright © 1998-2025 by Charles Cazabon and others:<br>
<charlesc-getmail @ pyropus.ca><br>
<roland.puntaier @ gmail.com>
</p>
<p class="about">
getmail and getmail6 are licensed under the
<a href="COPYING">GNU General Public License version 2</a> (only).
</p>
<h1 id="toc">Table of Contents</h1>
<ul>
<li><a href="documentation.html">getmail documentation (version 6)</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#requirements">Requirements</a></li>
<li><a href="documentation.html#obtaining">Obtaining getmail</a></li>
<li><a href="documentation.html#installing">Installing getmail</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="configuration.html">getmail configuration (version 6)</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-ssl-client">SSL Client Parameters</a></li>
<li><a href="configuration.html#retriever-ssl-extra">SSL Certificate Validation and Server 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-brokenpop3ssl">BrokenUIDLPOP3SSLRetriever</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-mdalmtp">MDA_lmtp</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>
<li><a href="configuration.html#running-fetch">Using getmail_fetch to retrieve mail from scripts</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="troubleshooting.html">getmail troubleshooting (version 6)</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) (version 6)</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-about6">What is getmail6 and how does it relate to 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. getmail complies
with <a href="https://specifications.freedesktop.org/basedir-spec/latest/index.html">the
XDG basedir specification</a>: <span class="file">$XDG_CONFIG_HOME/getmail/</span>
defaulting to <span class="file">~/.config/getmail/</span>.
For backward compatibility reasons, getmail also
checks <span class="file">$HOME/.getmail/</span>. If you want
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-brokenpop3ssl">BrokenUIDLPOP3SSLRetriever</a>
— same as BrokenUIDLPOP3Retriever, 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.
If you enable <a href="#use_netrc">use_netrc</a>, the netrc file
can supply a username for each retriever.
</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
using Kerberos authentication -- see below -- getmail gets the password
credential for the POP/IMAP server in one of the following ways:
<ol>
<li>from the <span class="file">password</span> configuration item in the getmailrc file</li>
<li>by running an arbitrary command specified with the password_command parameter (see below)</li>
<li>from Python keyring if available</li>
<li>if <a href="#use_netrc">use_netrc</a> option is True, from a .netrc file
<li>if not found via any of the above methods, getmail will prompt for the password when run</li>
</ol>
To store your POP/IMAP account password into the Python keyring, ensure
the password is not provided in the getmailrc file, and run getmail with
the special option <span class="file">--store-password-in-keyring</span>;
getmail will run, prompt you for the password, store it in the Python
keyring, and exit without retrieving mail. If this option is not
recognized, your Python installation does not have Python keyring.
</li>
<li id="password_command">
password_command
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— retrieve the account password by running an arbitrary external
program. The program must write the password and nothing else to stdout,
and must exit with a status of 0 on success. Note that the password parameter
(above) overrides this parameter; specify one or the other, not both.
This parameter is specified as the program to run as the first string in the
tuple, and all remaining strings are arguments passed to that program.
<pre class="example">
password_command = ("/path/to/password-retriever", "-p", "myaccount@example.org")
</pre>
</li>
</ul>
<p>
All POP3 retriever types also take the following optional parameters:
</p>
<ul>
<li>
use_xoauth2
(<a href="#parameter-boolean">boolean</a>)
— whether to use XOAUTH2 for login with the POP3 server.
If not set, normal password-based authentication is used. This currently
supports Gmail and Microsoft Office 365; if anyone extends this to support
other POP3 providers, please let me know so I can include such support
in getmail. <strong>Note that using XOAUTH2 is no more secure than a
regular getmail configuration with a mode 0600 getmailrc file</strong>.
You will need to set <a href="#password_command">password_command</a>
as well to tell getmail to invoke the getmail-gmail-xoauth-tokens
helper program; that script requires a positional argument to tell it
json file where to read the initial tokens from and where it writes the access
and refresh tokens to, and the file requires manual initial setup.
Keep write access to the json file.
This functionality was contributed by Stefan Krah,
who has additional information about using it here:
<a href="http://www.bytereef.org/howto/oauth2/getmail.html">http://www.bytereef.org/howto/oauth2/getmail.html</a>.
See docs/getmailrc-examples.
</li>
</ul>
<p>
All IMAP retriever types also take the following optional parameters:
</p>
<ul>
<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>
Note that the format for hierarchical folder names is determined by the
IMAP server, not by getmail. Consult your server's documentation or
postmaster if you're unsure what form your server uses.
If your mailbox names contain non-ASCII characters, ensure that your
getmailrc file is stored with UTF-8 encoding so that getmail can
correctly determine the unicode character names that need to be quoted
in IMAP's modified UTF-7 encoding; if you do not do this, the mailbox
names will not match what the server expects them to be, or will cause
UnicodeErrors when attempting to load your getmailrc file.
As a special case, in getmail version 4.29.0 and later, the unquoted
base (non-tuple) value
<span class="file">ALL</span> (case-sensitive) means to retrieve mail
from all selectable IMAP mailboxes in the account. To retrieve messages
from all mailboxes, you would use:
<pre class="example">
mailboxes = ALL
</pre>
</li>
<li>
use_peek
(<a href="#parameter-boolean">boolean</a>)
— whether to use PEEK to retrieve the message; the default is
True. IMAP servers typically mark a message as seen if PEEK is not used
to retrieve the message content. Versions of getmail prior to 4.26.0
did not use PEEK to retrieve messages.
</li>
<li>
move_on_delete
(<a href="#parameter-string">string</a>)
— if set, messages are moved to the named IMAP mail folder before
being deleted from their original location. The specified mail folder
must exist; getmail will not create it. Note that if you configure
getmail not to delete retrieved messages (the default behaviour), they
will not be moved at all.
</li>
<li>
<a name="uid_cache">cache_uid</a>
(<a href="#parameter-boolean">string</a>)
—
With this option the highest imap UID is used as the starting position when fetching the uid list.
An UID is not removed any more in the oldmail-file, if it has disappeared on the server.
If imap_search is non-default, this option is not applied.
<ul>
<li>
If the string is <pre class="example">true</pre>
the highest UID is taken from the oldmail-file.
</li>
<li>
Else the string is interpreted as file name for the given retriever.
In the file the highest UID for each mailbox is stored
before the email is delivered to its destination.
If something goes wrong with the delivery of an email,
you would have to remove the uid_cache file manually
to have that email fetched from the server again.
oldmail-files are updated only after the delivery.
</li>
</ul>
</li>
<li>
record_mailbox
(<a href="#parameter-boolean">boolean</a>)
— whether to add a X-getmail-retrieved-from-mailbox: header field
to retrieved messages, containing the name of the selected mailbox that
the message was retrieved from. This is on by default, but can be disabled.
</li>
<li>
use_kerberos
(<a href="#parameter-boolean">boolean</a>)
— whether to use Kerberos authentication with the IMAP server.
If not set, normal password-based authentication is used. Note that when
you use Kerberos authentication, it is up to you to ensure you have a
valid Kerberos ticket (perhaps by running a ticket-renewing agent such
as <a href="http://www.eyrie.org/~eagle/software/kstart/">kstart</a> or similar).
This feature requires that a recent version of pykerberos with GSS
support is installed; check your OS distribution or see
<a href="http://honk.sigxcpu.org/projects/pykerberos/">http://honk.sigxcpu.org/projects/pykerberos/"</a>
for details.
</li>
<li>
use_xoauth2
(<a href="#parameter-boolean">boolean</a>)
— whether to use XOAUTH2 for login with the IMAP server.
If not set, normal password-based authentication is used. This currently
supports Gmail and Microsoft Office 365; if anyone extends this to support
other IMAP providers, please let me know so I can include such support
in getmail. <strong>Note that using XOAUTH2 is no more secure than a
regular getmail configuration with a mode 0600 getmailrc file</strong>.
You will need to set <a href="#password_command">password_command</a>
as well to tell getmail to invoke the getmail-gmail-xoauth-tokens
helper program; that script requires a positional argument to tell it
json file where to read the initial tokens from and where it writes the access
and refresh tokens to, and the file requires manual initial setup.
Keep write access to the json file.
This functionality was contributed by Stefan Krah,
who has additional information about using it here:
<a href="http://www.bytereef.org/howto/oauth2/getmail.html">http://www.bytereef.org/howto/oauth2/getmail.html</a>.
See docs/getmailrc-examples.
</li>
<li>
imap_search, imap_on_delete
(<a href="#parameter-string">string</a>)
— imap_search is the second parameter of Python's
<a href="https://docs.python.org/3/library/imaplib.html#imaplib.IMAP4.search">IMAP search</a>.
Set <pre class="example">imap_search = UNSEEN</pre> to skip read messages.
The value is case-insensitive. It may be in parentheses.
As an example <pre class="example">
imap_search = Unseen
imap_on_delete = \Seen</pre>
fetches only new messages and sets the message flag to <span class="file">SEEN</span> on "delete"
(only <span class="file">\Delete</span> in it will actually delete the email on the server).
Setting the flag will also override the global <span class="file">delete = true</span>
(which is also made sure via <span class="file">-d</span> in the command line).
<span class="file">\Seen</span> avoids further retrieval without deleting the message on the server.
The default is <pre class="example">
imap_search = ALL
imap_on_delete = (\Deleted \Seen)</pre>
For more on IMAP SEARCH see <href="https://datatracker.ietf.org/doc/html/rfc3501#page-49">rfc3501</a>.
<p>
The command line parameter
<pre class="file">--searchset/-s</pre>
</p><p>
(search and set) overrides imap_search to select emails to retrieve and imap_on_delete to set flags on the server
A starting
<span class="file">,</span>
becomes IMAP flag char
<span class="file">\</span>.
<span class="file">-s</span> implies <span class="file">-d</span>, ie is like <span class="file">-ds</span>.
<span class="file">-ds,</span>
alone is
<span class="file">\SEEN</span>.
<span class="file">-ds,</span> means "mark as read".
Without <span class="file">,</span> it is a search string to select mail to retrieve.
</p>
</li>
<li>
imap_id_extension (<a href="#parameter-string">boolean</a>).
If set, getmail sends <span class="file">getmail 6.0.0</span> as client ID to the server.
The default is <span class="file">False</span>.
</li>
</ul>
<h4 id="retriever-ssl-client">SSL Client Parameters</h4>
<p>
All SSL-enabled retriever types also take the following options, to allow
specifying the use of a particular client key and client certificate
in establishing a connection to the server.
</p>
<ul>
<li>
keyfile
(<a href="#parameter-string">string</a>)
— use the specified PEM-formatted key file in the SSL negotiation.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— use the specified PEM-formatted certificate file in the SSL
negotiation.
</li>
</ul>
<h4 id="retriever-ssl-extra">SSL Certificate Validation and Server Parameters</h4>
<p>
All SSL-enabled POP and IMAP retriever types also take the following options,
allowing you to require validation of the server's SSL certificate, or to check the
server's certificate fingerprint against a known good value, or to control
the specific SSL cipher used during the connection.
</p>
<p>
<strong>Note: using these features, including server certificate validation,
requires using Python 2.7 or higher with getmail.</strong>
If you use an earlier version of Python, these features will not work, and
no server certificate validation will be performed.
Also note that these features are not currently implemented for SPDS
retrievers; I would be interested in hearing from SPDS users who desire
these features.
</p>
<ul>
<li>
ca_certs
(<a href="#parameter-string">string</a>)
— advanced option to perform validation of the server's SSL
certificate. Specify the path to a PEM-formatted list of 1 or more
valid and trusted root certification authority (CA) certificates.
<strong>Note: this option is only available with Python 2.7 or higher.</strong>
<br />
To find out which root CA is used to sign the chain of certificates for
a given server, you can run
<pre class="example">
openssl s_client -showcerts -connect HOST:PORT < /dev/null 2>/dev/null \
| grep '^[[:space:]]*i:' | tail -n 1
</pre>
If the server's certificate cannot be validated based upon the supplied
trusted root certificates, getmail will abort the connection.
<br />
Root certificates are not supplied with getmail; your OS probably installs a set
by default for use by the system, or you may wish to use a specific set of
trusted root certificates provided by your employer or a trusted third
party. Common locations for OS-supplied SSL root certification authority
certificates include:
<ul>
<li>Linux (Debian, Ubuntu, Arch, SuSE): <pre class="file">/etc/ssl/certs/</pre></li>
<li>Linux (RedHat, Fedora, CentOS): <pre class="file">/etc/pki/tls/certs/</pre></li>
<li>FreeBSD: <pre class="file">/usr/local/share/certs/</pre></li>
<li>OpenBSD: <pre class="file">/etc/ssl/</pre></li>
<li>OSX: <pre class="file">/System/Library/OpenSSL/certs/</pre></li>
<li>Windows: ask Microsoft</li>
</ul>
</li>
<li>
ssl_ciphers
(<a href="#parameter-string">string</a>)
— advanced option to control which SSL cipher algorithms will be
allowed to proceed. See the
<a href="http://www.openssl.org/docs/apps/ciphers.html">Open SSL documentation</a>
for details.
If the specified setting results in no possible ciphers available,
getmail will abort the connection.
E.g. on error <span class="file">DH_KEY_TOO_SMALL</span>, one could downgrade the security level via
<pre class="file">ssl_ciphers = DEFAULT@SECLEVEL=1</pre>
<strong>Note: this option is only available with Python 2.7 or higher.</strong>
</li>
<li>
ssl_version
(<a href="#parameter-string">string</a>)
— advanced option to control which SSL version getmail tries to
use to connect to the server; the default is "sslv23". Another
useful value is probably "sslv3". The possible values are:
<ul>
<li>sslv23</li>
<li>sslv3</li>
<li>tlsv1</li>
<li>tlsv1_1</li>
<li>tlsv1_2</li>
</ul>
<p>Note that this option exists only to help in connecting
certain legacy, out-of-date, broken servers; most users should
not specify this option at all. Using this option without
knowing what you are doing can reduce the effectiveness of
your encrypted connection.
<p><strong>Note: this option is only available with Python 2.7 or higher.</strong>
<p>Note: see the <a href="faq.html#faq-notabug-gmail-tls-sni">FAQ for details
on how to work around Gmail connection problems with OpenSSL v.1.1.1 and later</a>.
</li>
<li>
ssl_fingerprints
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— advanced option to notice when the server's SSL certificate
changes. Supply a list of one or more SHA256 certificate fingerprints,
and getmail will confirm whether the server's certificate fingerprint is
in the list of allowed fingerprints; if it is not, getmail will abort
the connection. Getmail will log the fingerprint of the server's certificate
if you supply the <span class="file">--fingerprint</span> commandline option.
<strong>Note: this option is only available with Python 2.7 or higher.</strong>
</li>
<li>
ssl_cert_hostname
(<a href="#parameter-string">string</a>)
— advanced option to specify an alternate hostname which is expected
in the server's SSL certificate hostname field. Specify this if the name
used to connect to the server is known not to match the hostname in the
server's certificate; otherwise, getmail will error out with a hostname
mismatch.
</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. Note that APOP adds much less
security than might be supposed; weaknesses in its hashing algorithm
mean that an attacker can recover the first three characters of the
password after snooping on only a few hundred authentications between
a client and server — see
<a href="http://www.securityfocus.com/archive/1/464477/30/0/threaded">http://www.securityfocus.com/archive/1/464477/30/0/threaded</a>
for details. 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>
<li>
delete_dup_msgids
(<a href="#parameter-boolean">boolean</a>)
— if set to True, and the POP3 server identifies multiple messages
as having the same "unique" identifier, all but the first will
be deleted without retrieving them.
</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>
</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>
delete_dup_msgids
(<a href="#parameter-boolean">boolean</a>)
— see
<a href="#retriever-simplepop3">SimplePOP3Retriever</a>
for definition.
</li>
<li>
ca_certs
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_ciphers
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_version
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_fingerprints
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
</ul>
<h4 id="retriever-brokenpop3ssl">BrokenUIDLPOP3SSLRetriever</h4>
<p class="note">
The BrokenUIDLPOP3SSLRetriever 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>)
— see
<a href="#retriever-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
ca_certs
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_ciphers
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_version
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_fingerprints
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</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-parameters">common retriever parameters</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-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
ca_certs
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_ciphers
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_version
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_fingerprints
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
imap_search
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</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 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>
keyfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
ca_certs
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_ciphers
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_version
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_fingerprints
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</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-parameters">common retriever parameters</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>
imap_search
(<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-parameters">common retriever parameters</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-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
certfile
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-ssl-client">SSL Client Parameters</a>
for definition.
</li>
<li>
ca_certs
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_ciphers
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_version
(<a href="#parameter-string">string</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
ssl_fingerprints
(<a href="#parameter-tuplestrings">tuple of quoted strings</a>)
— see <a href="#retriever-ssl-extra">SSL Certificate Validation and Server Parameters</a>
for definition
</li>
<li>
imap_search
(<a href="#parameter-string">string</a>)
— see
<a href="#retriever-simpleimap">SimpleIMAPRetriever</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-mdalmtp">MDA_lmtp</a>
— deliver messages to an external MDA via the LMTP protocol.
</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 getmail's best <strong>guess</strong>
at what the envelope recipient of the message might have been, 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>.
The maildir must already exist, and must contain all of the
subdirectories required by the maildir format.
getmail will
<strong>not</strong>
create the maildir if it does not exist.
If you're not familiar with the maildir format, the requirements
in a nutshell are: it must be a directory containing three
writable subdirectories
<span class="file">cur</span>,
<span class="file">new</span>,
and
<span class="file">tmp</span>,
and they must all reside on the same filesystem.
</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 two 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>
<li>
filemode
(<a href="#parameter-string">string</a>)
— if supplied, getmail will cause the delivered message files in
the maildir to have at most these permissions (given in standard Unix
octal notation). Note that the current umask is masked out of the
given value at file creation time. The default value, which should be
appropriate for most users, is "0600".
</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 either fcntl-type (lockf) or flock-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. If you want to create a new mboxrd
file for getmail to use, simply create a completely empty (0-byte) file.
</p>
<p class="warning">
You must ensure that all other programs accessing any the mbox file expect
mboxrd-format mbox files and the same type of file locking that you
configure getmail to use; failure to do so can cause mbox corruption.
If you do not know what type of file locking your system expects, ask
your system administrator.
If you are the system administrator and don't know what type of file locking
your system expects, do not use Mboxrd files; use Maildirs instead.
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 two 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>
<li>
locktype
(<a href="#parameter-string">string</a>)
— which type of file locking to use; may be
"<span class="file">lockf</span>"
(for fcntl locking) or
"<span class="file">flock</span>".
The default in getmail 4.7.0 and later is
<span class="file">lockf</span>.
</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) and feeding it the message on its standard
input. 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>
<li>
<span class="sample">%(mailbox)</span>
— the IMAP mailbox name the message was retrieved from;
for POP, this will be empty
</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>
<li>
ignore_stderr
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will not consider it an error if the program
writes to stderr. The default is false, which causes getmail to
consider the delivery failed and leave the message on the server,
proceeding to the next message.
This prevents loss of mail if the MDA writes to stderr but fails to
exit nonzero when it encounters an error.
<span class="warning">
Note that setting this option has serious implications; some MDAs
can fail to deliver a message but still exit 0, which can cause
loss of mail if this option is set. Only change this setting if
you are confident your MDA always exits nonzero on error.
</span>
</li>
<li>
pipe_stdout
(<a href="#parameter-boolean">boolean</a>)
— if set, stdout generated by the external MDA will be piped
to stdout of getmail. The default is true, which is the default
with fetchmail. Settings it to false will retain the former
behavior of getmail and suppress any data written to stdout.
</li>
</ul>
<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-mdalmtp">MDA_lmtp</h4>
<p>
MDA_lmtp delivers messages via LMTP by connecting to a Unix domain or TCP
socket. It currently does not support any authentication.
</p>
<p>
The MDA_lmtp destination takes one required parameter:
</p>
<ul>
<li>
host
(<a href="#parameter-string">string</a>)
— the host to connect to. Either a DNS-resolvable hostname, an IP
address or absolute path to a Unix domain socket.
</li>
</ul>
<p>
The MDA_lmtp destination also takes several optional parameters:
</p>
<ul>
<li>
port
(<a href="#parameter-integer">integer</a>)
— the remote port to connect to. Ignored if
<span class="sample">host</span>
is a Unix domain socket.
</li>
<li>
fallback
(<a href="#parameter-string">string</a>)
— an alternative recipient address to deliver to in case delivery
to the intended recipient fails permanently (i.e. with a 5xx status
code).
</li>
<li>
override
(<a href="#parameter-string">string</a>)
— deliver mail to an alternative recipient address instead of the
one given by the envelope or mail headers. Behaviour of the fallback
parameter still applies in case delivery fails.
</li>
</ul>
<p>
A configuration connecting to a Dovecot LMTP server might look like this:
</p>
<pre class="example">
[destination]
type = MDA_lmtp
host = /run/dovecot/lmtp
</pre>
<p>
Another example delivering to a remote host on a non-standard port:
</p>
<pre class="example">
[destination]
type = MDA_lmtp
host = mail.example.com
port = 3333
</pre>
<p>
An example where each mail is delivered to user <em>alice</em>, but if this
fails (i.e. their user quota has been reached) it is delivered to <em>bob</em>:
</p>
<pre class="example">
[destination]
type = MDA_lmtp
host = mail.example.com
override = alice
fallback = bob
</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 getmail's best guess as to the envelope
recipient of the message, 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>
Important note: if your regular expression contains backslashes (by
themselves, or as part of an escaped character or symbol like
<span class="file">\n</span>
or
<span class="file">\W</span>
), you need to tell the parser that this expression must be parsed
"raw" by prepending the string with an "r":
</p>
<pre class="example">
locals = (
(r'jeff\?\?\?@.*', '[jeff]'),
('alice@', '[alice]')
)
locals = (
('jeff@.*', '[jeff]'),
(r'alice\D+@', '[alice]')
)
</pre>
<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>,
<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 tries to guess what the envelope recipient address of the
message might have been, by comparing 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), if and only if the message recipient is the criteria
you want to filter on.
</p>
<p>
If you want to filter based on arbitrary message criteria, like "What address
is in the To: header field?" or "Who is the message from?", then
use the filtering MDA of your choice, called from a getmail
<a href="#destination-mdaexternal">MDA_external</a> destination.
</p>
<p>
MultiGuesser is similar to
<a href="#destination-multisorter">MultiSorter</a>,
except that it does not operate on the true 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>
<a name="use_netrc">use_netrc</a>
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will read a <span class="file">.netrc</span>
or <span class="file">.authinfo</span> file to set the
<span class="file">username</span> and/or
<span class="file">password</span> parameter for matching
retrievers.
A retriever matches if its <span class="file">server</span> parameter
matches a <span class="file">machine</span> entry in the netrc file.
The location of the .netrc file to read can be set with
the <a href="#netrc_file">netrc_file</a> option. Default: False.
</li>
<li>
<a name="netrc_file">netrc_file</a>
(<a href="#parameter-boolean">string</a>)
— sets the file that <a href="#use_netrc">use_netrc</a> reads.
Has no effect unless <a href="#use_netrc">use_netrc</a> is True.
Default: unset, which means <a href="#use_netrc">use_netrc</a> will
read the default netrc file for your system,
typically <span class="file">~/.netrc</span>, unless
<span class="file">NETRC</span> or <span class="file">CURLOPT_NETRC_FILE</span>
is defined.
</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>
to_oldmail_on_each_mail
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will update the oldmail file on each mail.
This is slower, but avoids re-downloading mails,
if something went wrong, like the server dying.
<span class="file">--to-oldmail-on-each-mail</span> in the command line.
Default: False.
</li>
<li>
only_oldmail_file
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will not retrieve mails but only update the oldmail file with mails currently on the server.
These mails will not be retrieved as long as the oldmail file exists.
<span class="file">--only-oldmail-file</span> in the command line.
Default: False.
</li>
<li>
skip_imap_fetch_size
(<a href="#parameter-boolean">boolean</a>)
— will skip fetching RFC822.SIZE.
This speeds up mail checks, particularly with a davmail proxies.
<pre>skip_imap_fetch_size</pre>
is only valid for IMAP and not valid with any of
<pre>max_message_size</pre>,
<pre>max_bytes_per_session</pre>,
<pre>delete_bigger_than</pre>.
</li>
<li>
mark_read
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will mark messages as read after retrieving.
It sets, the IMAP <span class="file">(\Seen)</span> flag on the server.
The command parameter <span class="file">-m/--mark-read</span> can be used to override the option.
<span class="file">-m/--mark-read</span> is related to <span class="file">--searchset/-s</span>,
a synonym to <span class="file">-ds,</span> = <span class="file">-ds,Seen</span>.
Default: False.
</li>
<li>
delete_bigger_than
(<a href="#parameter-integer">integer</a>)
— if set, getmail will delete messages larger than this number of
bytes after retrieving them, even if the
<span class="file">delete</span>
and <span class="file">delete_after</span>
options are disabled. The purpose of this feature is to allow deleting
only large messages, to help keep a mailbox under quota.
Has no effect if <span class="file">delete</span> is set, as that will
unconditionally remove messages. If
<span class="file">delete_after</span> is also set, the message will be
deleted immediately after retrieval if it is over this size, and
otherwise will be deleted according to the setting of
<span class="file">delete_after</span>.
Default: 0, which means not to enable this feature.
</li>
<li>
max_bytes_per_session
(<a href="#parameter-integer">integer</a>)
— if set, getmail will retrieve messages totalling up to this
number of bytes before closing the session with the server. This can
be useful if you do not want large messages causing large bursts of
network traffic. Default: 0, which means not to enable this feature.
Note that message sizes reported by the server are used, and therefore
may vary slightly from the actual size on disk after message retrieval.
</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 particularly 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>
<li>
message_log_verbose
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will log to the message log file (or syslog)
information about messages not retrieved and the reason for not
retrieving them, as well as starting and ending information lines.
By default, it will log only about messages actually retrieved, and
about error conditions.
<span class="warning">
Note that this has no effect if neither message_log nor
message_log_syslog is in use.
</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, delete, and mark_read 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
fashion 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>
By default, 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.
Optionally, if you know your filter can emit warnings on stderr under
non-error conditions, you can set the
<span class="file">ignore_stderr</span> option.
</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>
ignore_stderr
(<a href="#parameter-boolean">boolean</a>)
— if set, getmail will not consider it an error if the filter
writes to stderr. The default is false, which causes getmail to
consider the delivery failed and leave the message on the server,
proceeding to the next message.
This prevents loss of mail if the filter writes to stderr but fails to
exit nonzero when it encounters an error.
<span class="warning">
Note that setting this option has serious implications; some
poorly-written programs commonly used as mail filters can
can mangle or drop mail but still exit 0, their only clue to failure
being warnings emitted on stderr. Only change this setting if
you are confident your filter always exits nonzero on error.
</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>
ignore_header_shrinkage
(<a href="#parameter-boolean">boolean</a>)
— by default, getmail will warn if a filtered message's header
contains fewer fields than the source message had, to warn you if your
filter is unexpectedly deleting information from messages it handles.
If you know your filter can legitimately produce a message with a
shorter header (such as if it encapsulates the original message),
set this option to disable the warning. <b>Do not simply set this
if you see the warning; you must understand whether your filter is
operating correctly or not before you use this</b>.
</li>
<li>
ignore_stderr
(<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>
ignore_stderr
(<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">~/.config/getmail/</span> or <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.
This option can also be omitted. Then all files in
<span class="meta">getmaildir</span>
are used, apart from
<span class="file">oldmail-*, *.json, .*</span>
</li>
<li>
--only-account=<span class="meta">email@address</span>
or
-o<span class="meta">email@address</span>
choses the rc file based on the username/email.
</li>
<li>
--searchset=,<span class="meta">flag</span> or
--searchset=<span class="meta">search string</span>
or -s,<span class="meta">flag</span>.
No flag -s, is -s,Seen.
See imap_search and imap_on_delete.
</li>
<li>
-m/--mark-read is like <span class="file">-ds,</span>.
It overrides
<span class="file">mark_read</span>
in
<span class="file">[options]</span>
</li>
<li>
--dump — read rc files, dump configuration, and exit (debugging)
</li>
<li>--trace — print extended debugging information</li>
</ul>
<p>
If you are using a single getmailrc file with an IMAP server that understands
the IDLE extension from <a href="http://www.rfc-editor.org/rfc/rfc2177.txt">RFC 2177</a>,
you can use the --idle=<span class="meta">MAILBOX</span> option to specify
that getmail should wait on the server to notify getmail of new mail in the
specified mailbox after getmail is finished retrieving mail.
</p>
<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 directory
<span class="file">~/.config/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>
<!-- ********************************************************************** -->
<h2 id="running-fetch">Using getmail_fetch to retrieve mail from scripts</h2>
<p>
getmail includes the <span class="file">getmail_fetch</span>
helper script, which allows you to retrieve mail from a POP3 server without
the use of a configuration file. It is primarily intended for use in
automated or scripted environments, but can be used to retrieve mail normally.
</p>
<p>
See the <span class="file">getmail_fetch</span> manual page for details
on the use of <span class="file">getmail_fetch</span>.
</p>
</div>
</body>
</html>
|