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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.27 $ -->
<reference id="ref.imap">
<title>IMAP,POP3,NNTP関数</title>
<titleabbrev>IMAP</titleabbrev>
<partintro>
<simpara>
これらの関数を動作させるには、<option
role="configure">--with-imap</option>を付けて PHP をコンパイルする
必要があります。この際に、C クライアントライブラリが必要となります。
最新版を <ulink url="&url.imap;">&url.imap;</ulink>から取得し、
コンパイルして下さい。
その後、<filename>c-client/c-client.a</filename>を<filename>
/usr/local/lib/libc-client.a</filename>またはリンクパスが通った
他のディレクトリにコピーし、<filename>c-client/rfc822.h</filename>,
<filename>mail.h</filename>,<filename>linkage.h</filename>を
<filename>/usr/local/include</filename>またはインクルードパスが通った
他のディレクトリにコピーして下さい。
</simpara>
<simpara>
IMAP関数がサポートするのは、その名前から連想されるようにIMAPプロト
コルに限定されているわけではないということに注意して下さい。実際の
処理を行うCクライアントライブラリは、<acronym>NNTP</acronym>、
<acronym>POP3</acronym>、ローカルなメールボックスへのアクセスもサ
ポートしています。
</simpara>
<para>
この文書では、提供される関数に関する全ての話題の詳細について立ち入
ることはできません。より詳細な情報については、Cクライアントライブ
ラリのソースに付属するドキュメント
(<filename>docs/internal.txt</filename>)および以下のRFCドキュメン
トで提供されています。
<itemizedlist>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc2821.html">RFC2821</ulink> :
Simple Mail Transfer Protocol (SMTP)
</simpara>
</listitem>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc2822.html">RFC2822</ulink> :
Standard for ARPA internet text messages
</simpara>
</listitem>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc2060.html">RFC2060</ulink> :
Internet Message Access Protocol (IMAP) Version 4rev1
</simpara>
</listitem>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc1939.html">RFC1939</ulink> :
Post Office Protocol Version 3 (POP3)
</simpara>
</listitem>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc977.html">RFC977</ulink> :
Network News Transfer Protocol (NNTP)
</simpara>
</listitem>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc2076.html">RFC2076</ulink> :
Common Internet Message Headers
</simpara>
</listitem>
<listitem>
<simpara>
<ulink url="&url.rfc;rfc2045.html">RFC2045</ulink> ,
<ulink url="&url.rfc;rfc2046.html">RFC2046</ulink> ,
<ulink url="&url.rfc;rfc2047.html">RFC2047</ulink> ,
<ulink url="&url.rfc;rfc2048.html">RFC2048</ulink> &
<ulink url="&url.rfc;rfc2049.html">RFC2049</ulink> :
Multipurpose Internet Mail Extensions (MIME)
</simpara>
</listitem>
</itemizedlist>
詳しい概観については、David Woodによる本
<ulink url="&url.email.book;">Programming Internet Email</ulink>
や Dianna Mullet と Kevin Mullet による<ulink
url="&url.imap.book;">Managing IMAP</ulink>でも得ることができます。
</para>
</partintro>
<refentry id="function.imap-8bit">
<refnamediv>
<refname>imap_8bit</refname>
<refpurpose>
8bit 文字列を quoted-printable 文字列に変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_8bit</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
(<ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, section 6.7
に基づき)8bit 文字列をquoted-printable文字列に変換します。
</para>
<para>
quoted-printable文字列を返します。
</para>
<para>
<function>imap_qprint</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-alerts">
<refnamediv>
<refname>imap_alerts</refname>
<refpurpose>
ページリクエストの間または最後にスタックがリセットされて以来発生した
全てのIMAP警告メッセージを返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_alerts</methodname>
<void/>
</methodsynopsis>
<para>
この関数は、直近に <function>imap_alerts</function> をコールして
以来、またはページ処理を開始して以来生成された 全 IMAP 警告メッセー
ジの配列を得ます。<function>imap_alerts</function> がコールされた
場合、カレントのスタックは、処理後にクリアされます。IMAP 規約では、
これらのメッセージをユーザに渡すことが規定されています。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-append">
<refnamediv>
<refname>imap_append</refname>
<refpurpose>
指定されたメールボックスに文字列メッセージを追加する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_append</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
<methodparam><type>string</type><parameter>message</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
<para>
<function>imap_append</function> は、文字列メッセージを指定した
メールボックス<parameter>mbox</parameter> に追加します。
オプションの <parameter>flags</parameter> が指定された場合、
<parameter>flags</parameter> もそのメールボックスに書きこまれます。
</para>
<para>
Cyrus IMAP サーバーと通信する際には、改行コードとして "\n" の替わ
りに"\r\n" と使用する必要があります。さもなくば、操作は失敗します。
</para>
<para>
<example>
<title><function>imap_append</function>の例</title>
<programlisting role="php">
<![CDATA[
$stream = imap_open("{your.imap.host}INBOX.Drafts","username", "password");
$check = imap_check($stream);
print "Msg Count before append: ". $check->Nmsgs."\n";
imap_append($stream,"{your.imap.host}INBOX.Drafts"
,"From: me@my.host\r\n"
."To: you@your.host\r\n"
."Subject: test\r\n"
."\r\n"
."this is a test message, please ignore\r\n"
);
$check = imap_check($stream);
print "Msg Count after append : ". $check->Nmsgs."\n";
imap_close($stream);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-base64">
<refnamediv>
<refname>imap_base64</refname>
<refpurpose>BASE64 でエンコードされたテキストのデコード</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_base64</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
<function>imap_base64</function> 関数は、BASE64 でエンコードされ
たテキストをデコードします。(<ulink
url="&url.rfc;rfc2045.html">RFC2045</ulink>, Section 6.8を参照下
さい。)デコードされたメッセージは文字列として返されます。
</para>
<para>
<function>imap_binary</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-binary">
<refnamediv>
<refname>imap_binary</refname>
<refpurpose>8ビット文字列をbase64文字列に変換する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_binary</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
(<ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>,Section 6.8に
基づき)8ビット文字列をbase64文字列に変換します。
</para>
<para>
base64 文字列を返します。
</para>
<para>
<function>imap_base64</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-body">
<refnamediv>
<refname>imap_body</refname>
<refpurpose>メッセージ本文を読む</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_body</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
<function>imap_body</function>は、現在のメールボックスにある
<parameter>msg_number</parameter> 番目のメッセージの本文を返します。
オプションの <parameter>flags</parameter> はビットマスクであり、
以下の要素の組み合わせとなってます。
<itemizedlist>
<listitem>
<simpara>
FT_UID - <parameter>msgno</parameter>はUIDです
</simpara>
</listitem>
<listitem>
<simpara>
FT_PEEK - 既に設定されていない場合、\Seen フラグを設定しない
</simpara>
</listitem>
<listitem>
<simpara>
FT_INTERNAL - 内部フォーマットで文字列を返す。CRLF には適用されない。
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<function>imap_body</function> は、メッセージボディーと全く同じコ
ピーのみを返します。マルチパートMIMEエンコードされたメッセージの
一部を展開するには、その構造を解析するために
<function>imap_fetch_structure</function>を使用し、単一のボディー
要素のコピーを展開する際には、
<function>imap_fetchbody</function>を使用する必要があります。
</para>
</refsect1>
</refentry>
<refentry id='function.imap-bodystruct'>
<refnamediv>
<refname>imap_bodystruct</refname>
<refpurpose>
指定したメッセージの指定したbodyセクションの構造を読み込む
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_bodystruct</methodname>
<methodparam><type>int</type><parameter>stream_id</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_no</parameter></methodparam>
<methodparam><type>int</type><parameter>section</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id="function.imap-check">
<refnamediv>
<refname>imap_check</refname>
<refpurpose>現在のメールボックスをチェックする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_check</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
</methodsynopsis>
<para>
現在のメールボックスに関する情報を返します。失敗した場合は、&false;
を返します。
</para>
<para>
<function>imap_check()</function> 関数は、サーバ上の現在のメールボックス
のステータスをチェックし、その情報を以下のプロパティを有するオブジェクト
として返します。
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
Date - メールボックスの内容の最終変更日
</simpara>
</listitem>
<listitem>
<simpara>
Driver - メールボックスにアクセスする際に使用するプロトコル: POP3, IMAP, NNTP
</simpara>
</listitem>
<listitem>
<simpara>
Mailbox - メールボックスの名前
</simpara>
</listitem>
<listitem>
<simpara>
Nmsgs - メールボックス内のメッセージの数
</simpara>
</listitem>
<listitem>
<simpara>
Recent - メールボックス内の新規メッセージの数
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-clearflag-full">
<refnamediv>
<refname>imap_clearflag_full</refname>
<refpurpose>メッセージのフラグをクリアする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_clearflag_full</methodname>
<methodparam><type>int</type><parameter>stream</parameter></methodparam>
<methodparam><type>string</type><parameter>sequence</parameter></methodparam>
<methodparam><type>string</type><parameter>flag</parameter></methodparam>
<methodparam><type>string</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定したシーケンスのメッセージのフラグからに指定したフラグ
を削除します。設定可能なフラグは、(RFC2060で定義された) "\\Seen",
"\\Answered", "\\Flagged", "\\Deleted", "\\Draft", "\\Recent" です。
</para>
<para>
オプションはビットマスクであり、以下の組み合わせとなります。
<informalexample>
<literallayout>
ST_UID シーケンス引数はシーケンス番号の代わりに UID を含みます
</literallayout>
</informalexample>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-close">
<refnamediv>
<refname>imap_close</refname>
<refpurpose>IMAP ストリームをクローズする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_close</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
IMAP ストリームをクローズします。
オプション<parameter>flag</parameter>にCL_EXPUNGEを指定した場合、
メールボックスを閉じる前に暗黙のうちに
削除マークがついた全てのメッセージが削除されます。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-createmailbox">
<refnamediv>
<refname>imap_createmailbox</refname>
<refpurpose>新しいメールボックスを作る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_createmailbox</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
</methodsynopsis>
<para>
<function>imap_createmailbox</function>は<parameter>mbox</parameter>
で指定された新しいメールボックスを作成します。この名前に国際化文
字を含む場合には、<function>imap_utf7_encode</function>でエンコー
ドする必要があります。
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
<para>
<parameter>mbox</parameter>の名前のフォーマット形式に関しては
<function>imap_renamemailbox</function>,
<function>imap_deletemailbox</function>,
<function>imap_open</function>も参照下さい。
</para>
<para>
<example>
<title><function>imap_createmailbox</function> の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
or die("can't connect: ".imap_last_error());
$name1 = "phpnewbox";
$name2 = imap_utf7_encode("phpnewböx");
$newname = $name1;
echo "Newname will be '$name1'<br>\n";
# we will now create a new mailbox "phptestbox" in your inbox folder,
# check its status after creation and finaly remove it to restore
# your inbox to its initial state
if(@imap_createmailbox($mbox,imap_utf7_encode("{your.imap.host}INBOX.$newname"))) {
$status = @imap_status($mbox,"{your.imap.host}INBOX.$newname",SA_ALL);
if($status) {
print("your new mailbox '$name1' has the following status:<br>\n");
print("Messages: ". $status->messages )."<br>\n";
print("Recent: ". $status->recent )."<br>\n";
print("Unseen: ". $status->unseen )."<br>\n";
print("UIDnext: ". $status->uidnext )."<br>\n";
print("UIDvalidity:". $status->uidvalidity)."<br>\n";
if(imap_renamemailbox($mbox,"{your.imap.host}INBOX.$newname","{your.imap.host}INBOX.$name2")) {
echo "renamed new mailbox from '$name1' to '$name2'<br>\n";
$newname=$name2;
} else {
print "imap_renamemailbox on new mailbox failed: ".imap_last_error()."<br>\n";
}
} else {
print "imap_status on new mailbox failed: ".imap_last_error()."<br>\n";
}
if(@imap_deletemailbox($mbox,"{your.imap.host}INBOX.$newname")) {
print "new mailbox removed to restore initial state<br>\n";
} else {
print "imap_deletemailbox on new mailbox failed: ".implode("<br>\n",imap_errors())."<br>\n";
}
} else {
print "could not create new mailbox: ".implode("<br>\n",imap_errors())."<br>\n";
}
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-delete">
<refnamediv>
<refname>imap_delete</refname>
<refpurpose>
現在のメールボックスから削除するメッセージに印を付ける
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_delete</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
&true;を返します。
</para>
<para>
<function>imap_delete</function> 関数は、
<parameter>msg_number</parameter>が指す削除する予定のメッセージを
マークします。オブションのパラメータ<parameter>flags</parameter>
で指定可能なオプションは<parameter>FT_UID</parameter>のみです。
このオプションは、引数<parameter>msg_number</parameter>を
<parameter>UID</parameter>として処理することを関数に指定します。
削除マークを付けられたメッセージは、
<function>imap_expunge</function>がコールされるか
<function>imap_close</function>にCL_EXPUNGEを付けてコールされるか
のどちらかが行われるまでメールボックスに残ったままになります。
</para>
<para>
<example>
<title><function>imap_delete</function>の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open ("{your.imap.host}INBOX", "username", "password")
or die ("can't connect: " . imap_last_error());
$check = imap_mailboxmsginfo ($mbox);
print "Messages before delete: " . $check->Nmsgs . "<br>\n" ;
imap_delete ($mbox, 1);
$check = imap_mailboxmsginfo ($mbox);
print "Messages after delete: " . $check->Nmsgs . "<br>\n" ;
imap_expunge ($mbox);
$check = imap_mailboxmsginfo ($mbox);
print "Messages after expunge: " . $check->Nmsgs . "<br>\n" ;
imap_close ($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-deletemailbox">
<refnamediv>
<refname>imap_deletemailbox</refname>
<refpurpose>メールボックスを削除する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_deletemailbox</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
</methodsynopsis>
<para>
<function>imap_deletemailbox</function> は指定されたメールボック
スを削除します。(<parameter>mbox</parameter>名の形式については
<function>imap_open</function>を参照下さい)
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
<para>
<function>imap_createmailbox</function>、
<function>imap_renamemailbox</function>、
<parameter>mbox</parameter>のフォーマットについては
<function>imap_open</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-errors">
<refnamediv>
<refname>imap_errors</refname>
<refpurpose>
ページのリクエストの間かエラースタックがリセットされて以来
生じた全てのIMAPエラーを返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_errors</methodname>
<void/>
</methodsynopsis>
<para>
この関数は、最後に <function>imap_errors</function> コールを
行ってからまたはそのページの処理を開始してから
発生した全ての IMAP エラーメッセージの配列を返します。
<function>imap_errors</function> がコールされた場合、エラースタックは
処理後にクリアされます。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-expunge">
<refnamediv>
<refname>imap_expunge</refname>
<refpurpose>
削除用にマークされたすべてのメッセージを削除する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_expunge</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
</methodsynopsis>
<para>
<function>imap_expunge</function> は、
<function>imap_delete</function>,<function>imap_mail_move</function>,
<function>imap_setflag_full</function>で削除用マークを設定された
すべてのメッセージを削除します。
</para>
<para>
&true;を返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-fetch-overview">
<refnamediv>
<refname>imap_fetch_overview</refname>
<refpurpose>
指定したメッセージのヘッダ情報の概要を読む
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_fetch_overview</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>sequence</parameter></methodparam>
</methodsynopsis>
<para>
この関数はメールヘッダを取得し、その内容の概要を返します。
オブジェクトの配列を返します。
各ヘッダを次のように記述するオブジェクトの配列を返します。
<itemizedlist>
<listitem>
<simpara>
subject - メッセージの題名(subject)
</simpara>
</listitem>
<listitem>
<simpara>
from - 送信者
</simpara>
</listitem>
<listitem>
<simpara>
date - 送信日
</simpara>
</listitem>
<listitem>
<simpara>
message_id - メッセージID
</simpara>
</listitem>
<listitem>
<simpara>
references - このメッセージIDへのリファレンス
</simpara>
</listitem>
<listitem>
<simpara>
size - サイズ(バイト数)
</simpara>
</listitem>
<listitem>
<simpara>
uid - メールボックスにおけるこのメッセージのUID
</simpara>
</listitem>
<listitem>
<simpara>
msgno - メールボックスにおけるこのメッセージのメッセージ番号
</simpara>
</listitem>
<listitem>
<simpara>
recent - このメッセージのrecentフラグの有無
</simpara>
</listitem>
<listitem>
<simpara>
flagged - このメッセージのフラグの有無
</simpara>
</listitem>
<listitem>
<simpara>
answered - このメッセージの返信済フラグの有無
</simpara>
</listitem>
<listitem>
<simpara>
deleted - このメッセージの削除フラグの有無
</simpara>
</listitem>
<listitem>
<simpara>
seen - このメッセージの既読フラグの有無
</simpara>
</listitem>
<listitem>
<simpara>
draft - このメッセージのドラフトフラグの有無
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>imap_fetch_overview</function> の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host:143}","username","password")
or die("can't connect: ".imap_last_error());
$overview = imap_fetch_overview($mbox,"2,4:6",0);
if(is_array($overview)) {
reset($overview);
while( list($key,$val) = each($overview)) {
print $val->msgno
. " - " . $val->date
. " - " . $val->subject
. "\n";
}
}
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-fetchbody">
<refnamediv>
<refname>imap_fetchbody</refname>
<refpurpose>メッセージ本文中の特定のセクションを取り出す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_fetchbody</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
<methodparam><type>string</type><parameter>part_number</parameter></methodparam>
<methodparam><type>flags</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定されたメッセージ本文中の特定のセクションをテキスト
文字列として取り出し、そのテキスト文字列を返します。セクション指定
はピリオドで区切られた整数文字列で行い、この整数は IMAP4 仕様における
本文パートのリストへのインデックスとなります。本文パートはこの関
数ではデコードされません。
</para>
<para>
<function>imap_fetchbody </function> の オプション
<parameter>flags</parameter>
はビットマスクであり、以下の組合わせとなります。
<itemizedlist>
<listitem>
<simpara>
FT_UID - <parameter>msg_number</parameter>は UID である
</simpara>
</listitem>
<listitem>
<simpara>
FT_PEEK - 既に設定されていない場合、\Seen フラグを設定しない
</simpara>
</listitem>
<listitem>
<simpara>
FT_INTERNAL - 内部フォーマットで文字列を返す。CRLF には適用されない。
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<function>imap_fetchstructure</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-fetchheader">
<refnamediv>
<refname>imap_fetchheader</refname>
<refpurpose>メッセージのヘッダを返す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_fetchheader</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msgno</parameter></methodparam>
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定したメッセージのヘッダーを完全でフィルターリング
されていない<ulink url="&url.rfc;rfc2822.html">RFC2822</ulink>フォー
マットのテキスト文字列として取得し、テキスト文字列を返します。
</para>
<para>
オプションは次のようになります。
<informalexample>
<literallayout>
FT_UID msgno 引数は UID である
FT_INTERNAL 返される文字列を "internal" フォーマットとする。
ただし、CRLF 改行は例外とする。
FT_PREFETCHTEXT RFC822.TEXT は同時に事前に取得する必要があります。
これは、メッセージテキスト全体を取得したい場合にIMAP
接続において別の RTT を回避します。
(例えば、"ローカルファイルに保存する"操作)
</literallayout>
</informalexample>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-fetchstructure">
<refnamediv>
<refname>imap_fetchstructure</refname>
<refpurpose>
特定のメッセージの構造を読み込む
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_fetchstructure</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定したメッセージに関するすべての構造化された情報を
取り出します。オプションのパラメータ <parameter>flags</parameter>
に指定可能なのは<parameter>FT_UID</parameter>のみで、これは、引数
<parameter>msg_number</parameter> を<parameter>UID</parameter> と
して処理することを関数に指定するためのものです。返されるオブジェ
クトは、MIMEの添付の各要素に類似のオブジェクトとしてエンベロープ、
内部の日付、サイズ、フラグ、本体を含んでいます。返されるオブジェ
クトの構造は次のようになります。
</para>
<para>
<table>
<title>
<function>imap_fetchstructure</function>で返されるオブジェクト
</title>
<tgroup cols="2">
<tbody>
<row>
<entry>type</entry>
<entry>最初のbody部の型</entry>
</row>
<row>
<entry>encoding</entry>
<entry>body部を転送する際のエンコード法</entry>
</row>
<row>
<entry>ifsubtype</entry>
<entry>subtype文字列がある場合に&true;</entry>
</row>
<row>
<entry>subtype</entry>
<entry><acronym>MIME</acronym> の subtype</entry>
</row>
<row>
<entry>ifdescription</entry>
<entry>description文字列がある場合に&true;</entry>
</row>
<row>
<entry>description</entry>
<entry>内容を記述する文字列</entry>
</row>
<row>
<entry>ifid</entry>
<entry>identification 文字列がある場合に&true;</entry>
</row>
<row>
<entry>id</entry>
<entry>identification 文字列</entry>
</row>
<row>
<entry>lines</entry>
<entry>行数</entry>
</row>
<row>
<entry>bytes</entry>
<entry>バイト数</entry>
</row>
<row>
<entry>ifdisposition</entry>
<entry>disposition 文字列がある場合に&true;</entry>
</row>
<row>
<entry>disposition</entry>
<entry>disposition 文字列</entry>
</row>
<row>
<entry>ifdparameters</entry>
<entry>dparameters 配列が存在する場合に &true;</entry>
</row>
<row>
<entry>dparameters</entry>
<entry>特性パラメータ配列</entry>
</row>
<row>
<entry>ifparameters</entry>
<entry>配列parametersが存在する場合に&true;</entry>
</row>
<row>
<entry>parameters</entry>
<entry><acronym>MIME</acronym> パラメータ配列</entry>
</row>
<row>
<entry>parts</entry>
<entry>各メッセージパートを記述するオブジェクトの配列</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<orderedlist>
<listitem>
<para>
dparametersはオブジェクトの配列です。
各オブジェクトはプロパティ"attribute"および"value"を有しています。
</para>
</listitem>
<listitem>
<para>
parameterはオブジェクトの配列です。
各オブジェクトはプロパティ"attribute"および"value"を有しています。
</para>
</listitem>
<listitem>
<para>
partsはオブジェクトの配列であり、その構造はトップレベルオブジェクト
と同じです。ただし、'parts'オブジェクトを更に追加できないという制限
があります。
</para>
</listitem>
</orderedlist>
</note>
<para>
<table>
<title>最初のボディーの型</title>
<tgroup cols="2">
<tbody>
<row><entry>0</entry><entry>text</entry></row>
<row><entry>1</entry><entry>multipart</entry></row>
<row><entry>2</entry><entry>message</entry></row>
<row><entry>3</entry><entry>application</entry></row>
<row><entry>4</entry><entry>audio</entry></row>
<row><entry>5</entry><entry>image</entry></row>
<row><entry>6</entry><entry>video</entry></row>
<row><entry>7</entry><entry>other</entry></row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>通信時のエンコーディング</title>
<tgroup cols="2">
<tbody>
<row><entry>0</entry><entry>7BIT</entry></row>
<row><entry>1</entry><entry>8BIT</entry></row>
<row><entry>2</entry><entry>BINARY</entry></row>
<row><entry>3</entry><entry>BASE64</entry></row>
<row><entry>4</entry><entry>QUOTED-PRINTABLE</entry></row>
<row><entry>5</entry><entry>OTHER</entry></row>
</tbody>
</tgroup>
</table>
</para>
<para>
<function>imap_fetchbody</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-get-quota">
<refnamediv>
<refname>imap_get_quota</refname>
<refpurpose>
クオータレベルの設定、メールボックス毎の使用状況を取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_get_quota</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>quota_root</parameter></methodparam>
</methodsynopsis>
<para>
指定したメールボックスのlimitとusageをキーとした整数値を配列とし
て返します。limitの値は、このメールボックスで最大使用可能な大きさ
を表します。usageの値は、このメールボックスの現在の使用状況を示し
ます。失敗した場合に &false; を返します。
</para>
<para>
この関数は、現在、c-client2000 を使用しているユーザのみ使用可能で
す。
</para>
<para>
<parameter>imap_stream</parameter> は、
<function>imap_status</function>から返された値とする必要がありま
す。クオータ関数を使用するには、このストリームをメール管理者とし
てオープンする必要があります。<parameter>quota_root</parameter>
は、通常、user.name という形式にする必要があります。ただし、name
は情報を取得したいメールボックスの名前です。
</para>
<para>
<example>
<title><function>imap_get_quota</function>の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN)
|| die("接続できません: ".imap_last_error());
$quota_value = imap_get_quota($mbox, "user.kalowsky");
if(is_array($quota_value)) {
print "Usage level is: " . $quota_value['usage'];
print "Limit level is: " . $quota_value['limit'];
}
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
<para>
<function>imap_open</function>,
<function>imap_set_quota</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-getmailboxes">
<refnamediv>
<refname>imap_getmailboxes</refname>
<refpurpose>
メールボックスのリストを読み込み、各ボックスに関する詳細な情報を返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_getmailboxes</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>ref</parameter></methodparam>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
</methodsynopsis>
<para>
メールボックス情報を有するオブジェクトの配列を返します。各オブジェクトは、
メールボックスの完全な名前である <parameter>name</parameter>、
このメールボックスの階層の区切りを示す属性<parameter>delimiter</parameter>、
<parameter>attributes</parameter>を有しています。
<parameter>attributes</parameter> はビットマスクであり、次のものについて
調べることができます。
<itemizedlist>
<listitem>
<simpara>
LATT_NOINFERIORS - このメールボックスは "子" を有しません
(このボックスの中にメールボックスはありません。)
</simpara>
</listitem>
<listitem>
<simpara>
LATT_NOSELECT - 単なるコンテナであり、メールボックスではありません。
これをオープンすることはできません。
</simpara>
</listitem>
<listitem>
<simpara>
LATT_MARKED - このメールボックスには印が付けられています。
UW-IMAPD でのみ使用されます。
</simpara>
</listitem>
<listitem>
<simpara>
LATT_UNMARKED - このメールボックスはマークされていません。
UW-IMAPD でのみ必要です。
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
通常、<parameter>ref</parameter> は、{imap_server:imap_port} 形式の
IMAP サーバーとする必要があります。
また、<parameter>pattern</parameter> により検索を開始するメールボックスの
階層を指定します。
全てのメールボックスを検索したい場合には、<parameter>pattern</parameter>
に'*'を指定して下さい。
</para>
<para>
<parameter>pattern</parameter> の中で使用できる特別な文字として
'*' および '%' があります。'*' は、全てのメールボックスを意味しま
す。<parameter>pattern</parameter> に '*' を指定した場合、メール
ボックス階層全体のリストが得られます。'%' は現在のレベルのみを意
味します。'%' を <parameter>pattern</parameter>に指定した場合、トッ
プレベルのメールボックスのみが返されます。UW_IMAPD を使用した場
合、'~/mail/%' は ~/mail ディレクトリの全てのメールボックスを返し
ますが、そのディレクトリのサブフォルダーにあるメールボックスは返
しません。
</para>
<para>
<example>
<title><function>imap_getmailboxes</function> の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
|| die("can't connect: ".imap_last_error());
$list = imap_getmailboxes($mbox,"{your.imap.host}","*");
if(is_array($list)) {
reset($list);
while (list($key, $val) = each($list))
{
print "($key) ";
print imap_utf7_decode($val->name).",";
print "'".$val->delimiter."',";
print $val->attributes."<br>\n";
}
} else
print "imap_getmailboxes failed: ".imap_last_error()."\n";
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
<para>
<function>imap_getsubscribed</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-getsubscribed">
<refnamediv>
<refname>imap_getsubscribed</refname>
<refpurpose>購読中の全メールボックスの一覧</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_getsubscribed</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>ref</parameter></methodparam>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、ユーザーが購読しているメールボックスのみを返すことを除き、
<function>imap_getmailboxes</function> と同じ動作をします。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-header">
<refnamediv>
<refname>imap_header</refname>
<refpurpose>メッセージのヘッダを読む</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_header</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>fromlength</optional></replaceable>
</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>subjectlength</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>defaulthost</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、<function>imap_headerinfo</function>へのエイリアスで
あり、全く同様に動作します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-headerinfo">
<refnamediv>
<refname>imap_headerinfo</refname>
<refpurpose>メッセージヘッダを読み込む</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_headerinfo</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>fromlength</optional></replaceable>
</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>subjectlength</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>defaulthost</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、様々なヘッダー要素を有するオブジェクトを返します。
</para>
<para>
<informalexample>
<literallayout>
remail,date,Date,subject,Subject,in_reply_to,message_id,newsgroups,
followup_to,references
message flags:
Unseen - 'U' if unseen, ' ' if seen
Answered - 'A' if answered, ' ' if unanswered
Deleted - 'D' if deleted, ' ' if not deleted
Draft - 'X' if draft, ' ' if not draft
Flagged - 'F' if flagged, ' ' if not flagged
toaddress (to: 行?、最大 1024 文字)
to[] (TO 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
fromaddress (from: 行全体、最大 1024 文字)
from[] (From 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
ccaddress (cc: 行全体、最大 1024 文字)
cc[] (Cc 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
bccaddress (bcc: 行全体、最大 1024 文字)(full bcc line, up to 1024 characters)
bcc[] (Bcc 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
reply_toaddress (reply_to: 行全体、最大 1024 文字)
reply_to[] (Reply_to 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
senderaddress (sender: 行全体、最大 1024 文字)
sender[] (sender 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
return_path (return-path: 行全体、最大 1024 文字)
return_path[] (return_path 行から、以下の要素を含むオブジェクト配列を返します)
personal
adl
mailbox
host
udate ( UNIX 時間で表した mail メッセージの日付)
fetchfrom (<parameter>fromlength</parameter> 文字に適合するようフォーマットされた from 行)
fetchsubject (<parameter>subjectlength</parameter> 文字に適合するようフォーマットされた subject 行)
</literallayout>
</informalexample>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-headers">
<refnamediv>
<refname>imap_headers</refname>
<refpurpose>
メールボックス内の、すべてのメッセージのヘッダを返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_headers</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
</methodsynopsis>
<para>
ヘッダ情報でフォーマットされた文字列の配列を返します。1 つの
メールメッセージ毎に 1 つの要素が格納されます。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-last-error">
<refnamediv>
<refname>imap_last_error</refname>
<refpurpose>
ページリクエスト時に生じた直近の IMAP エラーを返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_last_error</methodname>
<void/>
</methodsynopsis>
<para>
この関数は、カレントページに生じた直近のIMAPエラーメッセージの
全文を返します。エラースタックは変更されません。
<function>imap_last_error</function> を続けてコールした際、
コール間に新規エラーが生じていない場合は、同じエラーが返されます。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-listmailbox">
<refnamediv>
<refname>imap_listmailbox</refname>
<refpurpose>メールボックスのリストを読む</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_listmailbox</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>ref</parameter></methodparam>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
</methodsynopsis>
<para>
メールボックス名を保持する配列を返します。
<parameter>ref</parameter>および<parameter>pattern</parameter>
の説明については、<function>imap_getmailboxes</function>を参照下さい。
</para>
<para>
<example>
<title><function>imap_listmailbox</function> の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
or die("can't connect: ".imap_last_error());
$list = imap_listmailbox($mbox,"{your.imap.host}","*");
if(is_array($list)) {
reset($list);
while (list($key, $val) = each($list))
print imap_utf7_decode($val)."<br>\n";
} else
print "imap_listmailbox failed: ".imap_last_error()."\n";
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-listsubscribed">
<refnamediv>
<refname>imap_listsubscribed</refname>
<refpurpose>購読中のすべてのメールボックス一覧</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_listsubscribed</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>ref</parameter></methodparam>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
</methodsynopsis>
<para>
購読中のすべてのメールボックスの配列を返します。
この関数はほぼ<function>imap_listmailbox</function>と同じですが、
自分がログインしているユーザーが購読中のメールボックスのみを
返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-mail">
<refnamediv>
<refname>imap_mail</refname>
<refpurpose>
e-mailメッセージを送信する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_mail</methodname>
<methodparam><type>string</type><parameter>to</parameter></methodparam>
<methodparam><type>string</type><parameter>subject</parameter></methodparam>
<methodparam><type>string</type><parameter>message</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>additional_headers</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>cc</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>bcc</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>rpath</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、CcおよびBcc受信者の正確な処理を行ってemailを送信する
ことが可能です。パラメータto、cc、bccは全て文字列で全てrfc822アド
レスリストとしてパースされます。bccで指定した受信者はmailを受信し
ますが、ヘッダからは除外されます。リターンパスを指定するために
rpathパラメータを使用して下さい。この関数は、複数のユーザ用のメー
ルクライアントPHP使用する際に有用です。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-mail-compose">
<refnamediv>
<refname>imap_mail_compose</refname>
<refpurpose>
指定したエンベロープおよびボディーセクションに基づきMIMEメッセー
ジを作成
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_mail_compose</methodname>
<methodparam><type>array</type><parameter>envelope</parameter></methodparam>
<methodparam><type>array</type><parameter>body</parameter></methodparam>
</methodsynopsis>
<para>
</para>
<para>
<example>
<title><function>imap_mail_compose</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$envelope["from"]="musone@afterfive.com";
$envelope["to"]="musone@darkstar";
$envelope["cc"]="musone@edgeglobal.com";
$part1["type"]=TYPEMULTIPART;
$part1["subtype"]="mixed";
$filename="/tmp/imap.c.gz";
$fp=fopen($filename,"r");
$contents=fread($fp,filesize($filename));
fclose($fp);
$part2["type"]=TYPEAPPLICATION;
$part2["encoding"]=ENCBINARY;
$part2["subtype"]="octet-stream";
$part2["description"]=basename($filename);
$part2["contents.data"]=$contents;
$part3["type"]=TYPETEXT;
$part3["subtype"]="plain";
$part3["description"]="description3";
$part3["contents.data"]="contents.data3\n\n\n\t";
$body[1]=$part1;
$body[2]=$part2;
$body[3]=$part3;
echo nl2br(imap_mail_compose($envelope,$body));
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-mail-copy">
<refnamediv>
<refname>imap_mail_copy</refname>
<refpurpose>指定されたメッセージをメールボックスにコピーする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_mail_copy</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>msglist</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
<para>
<parameter>msglist</parameter> で指定されたメッセージを、指定した
メールボックスにコピーします。<parameter>msglist</parameter> は、
(<ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>に記述されたよ
うに)ただのメッセージ番号ではなく、範囲を示します。
</para>
<para>
flags はビットマスクであり、以下の組み合わせです。
<itemizedlist>
<listitem>
<simpara>
CP_UID - UIDS を含む処理の数
</simpara>
</listitem>
<listitem>
<simpara>
CP_MOVE - コピー後にメールボックスからメッセージを削除
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-mail-move">
<refnamediv>
<refname>imap_mail_move</refname>
<refpurpose>
指定されたメッセージをメールボックスに移動する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_mail_move</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>msglist</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
<parameter>msglist</parameter> で指定されたメッセージを、指定された
メールボックスに移動します。<parameter>msglist</parameter> は
単なるメッセージ番号でなく、
(<ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>で解説された)
メッセージの範囲を指定します。
</para>
<para>
flagsはビットマスクであり、指定できるオプションは1つだけです。
<itemizedlist>
<listitem>
<simpara>
CP_UID - シーケンス番号にUIDを含む
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-mailboxmsginfo">
<refnamediv>
<refname>imap_mailboxmsginfo</refname>
<refpurpose>現在のメールボックスに関する情報を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_mailboxmsginfo</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
</methodsynopsis>
<para>
現在のメールボックスに関する情報を返します。
失敗した場合に&false;を返します。
</para>
<para>
<function>imap_mailboxmsginfo</function> 関数は、サーバーにおける
現在のメールボックスのステータスを調べます。この関数は
<function>imap_status</function>に似ていますが、メールボックスの
中の全てのメッセージのサイズを合計します。このため、実行時間は幾
分余計にかかります。この関数は、以下のプロパティを有するオブジェ
クトを返します。
</para>
<para>
<table>
<title>mailboxのプロパティ</title>
<tgroup cols="2">
<tbody>
<row>
<entry>Date </entry>
<entry>最終変更日</entry>
</row>
<row>
<entry>Driver </entry>
<entry>ドライバ</entry>
</row>
<row>
<entry>Mailbox</entry>
<entry>メールボックスの名前</entry>
</row>
<row>
<entry>Nmsgs </entry>
<entry>メッセージ数</entry>
</row>
<row>
<entry>Recent </entry>
<entry>最近のメッセージの数</entry>
</row>
<row>
<entry>Unread </entry>
<entry>未読のメッセージの数</entry>
</row>
<row>
<entry>Size </entry>
<entry>メールボックスのサイズ</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<example>
<title><function>imap_mailboxmsginfo</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$mbox = imap_open("{your.imap.host}INBOX","username", "password")
or die("can't connect: ".imap_last_error());
$check = imap_mailboxmsginfo($mbox);
if($check) {
print "Date: " . $check->Date ."<br>\n" ;
print "Driver: " . $check->Driver ."<br>\n" ;
print "Mailbox: " . $check->Mailbox ."<br>\n" ;
print "Messages: ". $check->Nmsgs ."<br>\n" ;
print "Recent: " . $check->Recent ."<br>\n" ;
print "Unread: " . $check->Unread ."<br>\n" ;
print "Deleted: " . $check->Deleted ."<br>\n" ;
print "Size: " . $check->Size ."<br>\n" ;
} else {
print "imap_check() failed: ".imap_last_error(). "<br>\n";
}
imap_close($mbox);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-mime-header-decode">
<refnamediv>
<refname>imap_mime_header_decode</refname>
<refpurpose>MIMEヘッダーエレメントをデコードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_mime_header_decode</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
関数<function>imap_mime_header_decode</function>は、非ASCIIテキス
トのMIMEメッセージヘッダエクステンションをデコードします。
(<ulink url="&url.rfc;rfc2047.html">RFC2047</ulink>を参照下さい)
デコードされた要素は、オブジェクトの配列で返されます。
ただし、各オブジェクトは二つのプロパティ"charset"と"text"を有しています。
要素がエンコードされていない場合、言い替えるとプレーンなUS-ASCIIの場合、
この要素の"charset"プロパティは"default"に設定されます。
</para>
<para>
<example>
<title><function>imap_mime_header_decode</function>の例</title>
<programlisting role="php">
<![CDATA[
$text="=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>";
$elements=imap_mime_header_decode($text);
for($i=0;$i<count($elements);$i++) {
echo "Charset: {$elements[$i]->charset}\n";
echo "Text: {$elements[$i]->text}\n\n";
}
]]>
</programlisting>
</example>
</para>
<para>
上の例には二つの要素があります。最初の要素はISO-8859-1、
2番目の要素はプレーンなUS-ASCIIで事前にエンコードされています。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-msgno">
<refnamediv>
<refname>imap_msgno</refname>
<refpurpose>指定したUIDのメッセージ番号を返す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_msgno</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>uid</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定したUIDnメッセージ番号を返します。
これは、<function>imap_uid</function> の逆の動作となります。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-num-msg">
<refnamediv>
<refname>imap_num_msg</refname>
<refpurpose>
現在のメールボックスのメッセージ数を取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_num_msg</methodname>
<methodparam><type>int</type><parameter>stream_id</parameter></methodparam>
</methodsynopsis>
<para>
現在のメールボックスにあるメッセージ数を返します。
</para>
<para>
<function>imap_num_recent</function> および
<function>imap_status</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-num-recent">
<refnamediv>
<refname>imap_num_recent</refname>
<refpurpose>現在のメールボックスにある新規メッセージの数の取得</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_num_recent</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
</methodsynopsis>
<para>
現在のメールボックスにある新しいメッセージの数を返します。
</para>
<para>
<function>imap_num_msg</function> および
<function>imap_status</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-open">
<refnamediv>
<refname>imap_open</refname>
<refpurpose>
メールボックスへのIMAPストリームをオープンする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_open</methodname>
<methodparam><type>string</type><parameter>mailbox</parameter></methodparam>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
成功するとIMAPストリームを返し、失敗すると&false;を返します。この関
数は、POP3やNNTPサーバーへのストリームをオープンする際にも使用可
能です。しかし、いくつかの関数および機能はIMAPサーバーでは利用で
きません。
</para>
<para>
メールボックス名(mailbox)は、サーバー名の部分と使用するサーバーに
おけるメールボックスへのパスから構成されます。特別な名前INBOXは、
カレントのユーザの個人メールボックスを意味します。サーバー部は'{'
および'}'で括られ、サーバー名またはIPアドレス、オプションの':'か
ら始まるポート指定子、('/'で始まる)オプションのプロトコル指定子か
ら構成されます。サーバー部は、全てのmailboxパラメータで必須です。
ASCII空間で出力可能な文字以外の外国文字を含むメールボックス名は
<function>imap_utf7_encode</function>でエンコードする必要がありま
す。
</para>
<para>
オプションは、ビットマスクであり、以下の組み合わせとなります。
<itemizedlist>
<listitem>
<simpara>
OP_READONLY - メールボックスを読みこみのみ可でオープン
</simpara>
</listitem>
<listitem>
<simpara>
OP_ANONYMOUS - news に関して.newsrcの使用・更新をしない(NNTPのみ)
</simpara>
</listitem>
<listitem>
<simpara>
OP_HALFOPEN - IMAPおよびNNTP名について、接続をオープンするがメールボックスをオープンしない
</simpara>
</listitem>
<listitem>
<simpara>
CL_EXPUNGE - メールボックスを閉じた際に、自動的にメールボックスを削除する
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
ローカルマシンのポート143で実行しているIMAPサーバーに接続
する際には、以下のようにします。
<informalexample>
<programlisting role="php">
<![CDATA[
$mbox = imap_open ("{localhost:143}INBOX", "user_id", "password");
]]>
</programlisting>
</informalexample>
ローカルマシンのポート110で実行しているPOP3サーバーに接続する際には、
以下のようにします。
<informalexample>
<programlisting>
<![CDATA[
$mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password");
]]>
</programlisting>
</informalexample>
SSL IMAPまたはPOP3サーバに接続するには、/sslをプロトコル指定子の
後に追加します。
<informalexample>
<programlisting role="php">
<![CDATA[
$mbox = imap_open ("{localhost:993/imap/ssl}INBOX", "user_id", "password");
]]>
</programlisting>
</informalexample>
自分でサインした証明書でSSL IMAPまたはPOP3サーバに接続するには、
プロトコル指定の後に /ssl/novalidate-cert を追加します。
<informalexample>
<programlisting role="php">
<![CDATA[
$mbox = imap_open ("{localhost:995/pop3/ssl/novalidate-cert}", "user_id", "password");
]]>
</programlisting>
</informalexample>
ローカルマシンのポート119で実行しているNNTPサーバーに接続する際には、
以下のようにします。
<informalexample>
<programlisting>
<![CDATA[
$nntp = imap_open ("{localhost:119/nntp}comp.test", "", "");
]]>
</programlisting>
</informalexample>
リモートサーバーに接続するには、"localhost" を接続したいサーバーの
名前または IP アドレスに代えてください。
</para>
<para>
<example>
<title><function>imap_open</function>の例</title>
<programlisting>
<![CDATA[
$mbox = imap_open ("{your.imap.host:143}", "username", "password");
echo "<p><h1>Mailboxes</h1>\n";
$folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*");
if ($folders == false) {
echo "Call failed<br>\n";
} else {
while (list ($key, $val) = each ($folders)) {
echo $val."<br>\n";
}
}
echo "<p><h1>Headers in INBOX</h1>\n";
$headers = imap_headers ($mbox);
if ($headers == false) {
echo "Call failed<br>\n";
} else {
while (list ($key,$val) = each ($headers)) {
echo $val."<br>\n";
}
}
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-ping">
<refnamediv>
<refname>imap_ping</refname>
<refpurpose>IMAP ストリームの有効性チェック</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_ping</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
</methodsynopsis>
<para>
ストリームがまだ有効であれば&true;を、そうでなければ&false;を返します。
</para>
<para>
<function>imap_ping</function> 関数は、ストリームに ping を行い、
まだ有効であるかどうかをチェックします。これにより新しいメールの到着
を知る場合もあります。これは、有効時間のタイムアウトが設定
してあるサーバに対して "接続を持続させる" ことに加え、定期的な
"新着メールのチェック" としてもよい方法です。
(PHPスクリプトはこれほどの長時間実行されることはほとんどないので、
この関数が実際に役に立つかどうかは定かではありません。)
</para>
</refsect1>
</refentry>
<refentry id='function.imap-popen'>
<refnamediv>
<refname>imap_popen</refname>
<refpurpose>
mailboxへの持続的なIMAPストリームをオープンする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_popen</methodname>
<methodparam><type>string</type><parameter>mailbox</parameter></methodparam>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id="function.imap-qprint">
<refnamediv>
<refname>imap_qprint</refname>
<refpurpose>quoted-printable 文字列を 8 ビット文字列に変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_qprint</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
(<ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, section 6.7
に基づき)quoted-printable 文字列を 8 ビット文字列に変換します。
</para>
<para>
8ビット(バイナリ)文字列を返します。
</para>
<para>
<function>imap_8bit</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-renamemailbox">
<refnamediv>
<refname>imap_renamemailbox</refname>
<refpurpose>メールボックスの名前を変更する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_renamemailbox</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>old_mbox</parameter></methodparam>
<methodparam><type>string</type><parameter>new_mbox</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、古いメールボックスを新しいメールボックスにリネーム
します。 (<parameter>mbox</parameter>名のフォーマットについては
<function>imap_open</function>を参照下さい)
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
<para>
<parameter>mbox</parameter>のフォーマットについては、
<function>imap_createmailbox</function>,
<function>imap_deletemailbox</function>,
<function>imap_open</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-reopen">
<refnamediv>
<refname>imap_reopen</refname>
<refpurpose>
新規メールボックスへのIMAP ストリームを再度オープンする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_reopen</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mailbox</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>flags</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、IMAPまたはNNTPサーバー上の新しいメールボックスに対して
指定されたストリームを再オープンします。
</para>
<para>
オプションは、ビットマスクであり、以下の組み合わせとなります。
<itemizedlist>
<listitem>
<simpara>
OP_READONLY - メールボックスを読みこみのみ可でオープン
</simpara>
</listitem>
<listitem>
<simpara>
OP_ANONYMOUS - news に関して .newsrc の使用・更新をしない (NNTPのみ)
</simpara>
</listitem>
<listitem>
<simpara>
OP_HALFOPEN - IMAP および NNTP 名について、接続をオープンするが
メールボックスをオープンしない
</simpara>
</listitem>
<listitem>
<simpara>
CL_EXPUNGE - メールボックスを閉じた際に、自動的にメールボック
スを削除する (<function>imap_delete</function>および
<function>imap_expunge</function>も参照下さい )
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
成功時に&true;、エラー時に&false;を返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-rfc822-parse-adrlist">
<refnamediv>
<refname>imap_rfc822_parse_adrlist</refname>
<refpurpose>アドレス文字列を解釈します</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_rfc822_parse_adrlist</methodname>
<methodparam><type>string</type><parameter>address</parameter></methodparam>
<methodparam><type>string</type><parameter>default_host</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、<ulink url="&url.rfc;rfc2822.html">RFC2822</ulink>
の定義に基づきアドレス文字列を解釈し、各アドレス毎にオブジェクトの
配列を返します。4 つのオブジェクトは、以下のようになります。
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
mailbox - メールボックス名 (ユーザ名)
</simpara>
</listitem>
<listitem>
<simpara>
host - ホスト名
</simpara>
</listitem>
<listitem>
<simpara>
personal - 個人名
</simpara>
</listitem>
<listitem>
<simpara>
adl - ドメインソースルートからのパス
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>imap_rfc822_parse_adrlist</function>の例</title>
<programlisting role="php">
<![CDATA[
$address_string = "Hartmut Holzgraefe <hartmut@cvs.php.net>, postmaster@somedomain.net, root";
$address_array = imap_rfc822_parse_adrlist($address_string,"somedomain.net");
if(! is_array($address_array)) die("somethings wrong\n");
reset($address_array);
while(list($key,$val)=each($address_array)){
print "mailbox : ".$val->mailbox."<br>\n";
print "host : ".$val->host."<br>\n";
print "personal: ".$val->personal."<br>\n";
print "adl : ".$val->adl."<p>\n";
}
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-rfc822-parse-headers">
<refnamediv>
<refname>imap_rfc822_parse_headers</refname>
<refpurpose>文字列からメールヘッダを解釈する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_rfc822_parse_headers</methodname>
<methodparam><type>string</type><parameter>headers</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>defaulthost</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
この関数は複数のヘッダ要素を有するオブジェクトを返します。
この関数は<function>imap_header</function>に似ていますが、
フラグおよび他の要素はIMAPサーバーから取得されるところが異なります。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-rfc822-write-address">
<refnamediv>
<refname>imap_rfc822_write_address</refname>
<refpurpose>
指定したメールボックス、ホスト、個人情報を適当にフォーマットされ
た電子メールアドレスにして返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_rfc822_write_address</methodname>
<methodparam><type>string</type><parameter>mailbox</parameter></methodparam>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
<methodparam><type>string</type><parameter>personal</parameter></methodparam>
</methodsynopsis>
<para>
指定したメールボックス、ホスト、個人情報を
<ulink url="&url.rfc;rfc822.html">RFC822</ulink>の定義に基づき
適当にフォーマットされた電子メールアドレスにして返します。
</para>
<para>
<example>
<title><function>imap_rfc822_write_address</function>の例</title>
<programlisting role="php">
<![CDATA[
print imap_rfc822_write_address("hartmut","cvs.php.net","Hartmut Holzgraefe")."\n";
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-scanmailbox">
<refnamediv>
<refname>imap_scanmailbox</refname>
<refpurpose>
メールボックスのリストを読み、メールボックスのテキストにおいて
文字列を検索する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_scanmailbox</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>ref</parameter></methodparam>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam><type>string</type><parameter>content</parameter></methodparam>
</methodsynopsis>
<para>
メールボックスのテキストに<parameter>content</parameter>があるメー
ルボックスの名前を有する配列を返します。この関数は
<function>imap_listmailbox</function>に似ていますが、メールボック
スのデータ中に文字列<parameter>content</parameter>が存在するかど
うかの確認も行います。<parameter>ref</parameter>および
<parameter>pattern</parameter>の説明については
<function>imap_getmailboxes</function>を参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-search">
<refnamediv>
<refname>imap_search</refname>
<refpurpose>
指定した検索条件にマッチするメッセージを配列として返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_search</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>criteria</parameter></methodparam>
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定した imap ストリームの現在オープンしているメール
ボックスにおいて検索を行います。<parameter>criteria</parameter>
は、空白で区切られた文字列で、以下のキーワードが使用可能です。複
数語のキーワード(例 FROM "joe smith")は全て引用符で括る必要があり
ます。
<itemizedlist>
<listitem>
<simpara>
ALL - 他の検索条件にマッチする全メッセージを返す
</simpara>
</listitem>
<listitem>
<simpara>
ANSWERED - \\ANSWERED フラグが設定されているメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
BCC "string" - Bcc: フィールドに "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
BEFORE "date" - "date" より前の Date: を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
BODY "string" - メッセージ本体に "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
CC "string" - Cc: フィールドに "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
DELETED - 削除されたメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
FLAGGED - \\FLAGGED フラグが設定されっDるメッセージにマッチ
(重要または緊急を表すものとして使用されることがあります)
</simpara>
</listitem>
<listitem>
<simpara>
FROM "string" - From: フィールドに "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
KEYWORD "string" - キーワードとして "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
NEW - 新規メッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
OLD - 古いメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
ON "date" - Date: が "date" であるメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
RECENT - \\RECENT フラグが設定されているメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
SEEN - (\\SEEN フラグが設定されている)既読のメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
SINCE "date" - Date: が "date" 以降であるメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
SUBJECT "string" - Subject: に "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
TEXT "string" - テキスト "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
TO "string" - To: に "string" を有するメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
UNANSWERED - 未回答のメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
UNDELETED - 削除されていないメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
UNFLAGGED - フラグが設定されていないメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
UNKEYWORD "string" - キーワード "string" を有さないメッセージにマッチ
</simpara>
</listitem>
<listitem>
<simpara>
UNSEEN - 未読のメッセージにマッチ
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
例えば、Mom から送られた全ての未回答のメッセージにマッチするには、
"UNANSWERED FROM mom"を使用する必要があります。
検索は、大文字小文字が区別されずに行われます。
検索条件のリストは、UWクライアントのCソースコードからのものであり、
不完全または不正確である可能性があります。
(RFC2060, section 6.4.4も参照下さい)
</para>
<para>
SE_UID が有効なフラグとして設定されている場合、
メッセージ番号の変わりに UID を有する配列が返されます。
</para>
</refsect1>
</refentry>
<refentry id='function.imap-setacl'>
<refnamediv>
<refname>imap_setacl</refname>
<refpurpose>
指定したメールボックスのACLを設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_setacl</methodname>
<methodparam><type>int</type><parameter>stream_id</parameter></methodparam>
<methodparam><type>string</type><parameter>mailbox</parameter></methodparam>
<methodparam><type>string</type><parameter>id</parameter></methodparam>
<methodparam><type>string</type><parameter>rights</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id="function.imap-set-quota">
<refnamediv>
<refname>imap_set_quota</refname>
<refpurpose>指定したメールボックスにクオータを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_set_quota</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>quota_root</parameter></methodparam>
<methodparam><type>int</type><parameter>quota_limit</parameter></methodparam>
</methodsynopsis>
<para>
メールボックス単位でクオータ上限(最大容量)を設定します。この関数
は、メール管理者のアカウントでオープンされている
<parameter>imap_stream</parameter> を必要とします。他のユーザでオー
プンされている場合は、この関数は動作しません。
</para>
<para>
この関数は、c-client2000ライブラリのユーザのみ使用可能です。
</para>
<para>
<parameter>imap_stream</parameter> は、
<function>imap_open</function>コール時に返されたストリームポイン
タです。このストリームはメール管理者としてオープンする必要があり
ます。そうでない場合は、この関数は動作しません。
<parameter>quota_root</parameter> は、クオータを設定するメールボッ
クスです。これは、メールボックスのIMAP標準フォーマット
'user.name' に基づき指定する必要があります。
<parameter>quota_limit</parameter> は、
<parameter>quota_root</parameter> の最大サイズ(KB単位)です。
</para>
<para>
成功時に&true;、エラー時に&false;を返します。
</para>
<para>
<example>
<title><function>imap_set_quota</function>の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open ("{your.imap.host:143}", "mailadmin", "password");
if(!imap_set_quota($mbox, "user.kalowsky", 3000)) {
print "Error in setting quota\n";
return;
}
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
<para>
<function>imap_open</function>,
<function>imap_set_quota</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-setflag-full">
<refnamediv>
<refname>imap_setflag_full</refname>
<refpurpose>メッセージにフラグをセットする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_setflag_full</methodname>
<methodparam><type>int</type><parameter>stream</parameter></methodparam>
<methodparam><type>string</type><parameter>sequence</parameter></methodparam>
<methodparam><type>string</type><parameter>flag</parameter></methodparam>
<methodparam><type>string</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定したシーケンスのメッセージのフラグに指定したフラグを
セットし、保存します。
</para>
<para>
設定可能なフラグは、(RFC2060で定義された) "\\Seen", "\\Answered",
"\\Flagged", "\\Deleted", "\\Draft", "\\Recent" です。
</para>
<para>
オプションはビットマスクであり、以下の組み合わせとなります。
<informalexample>
<literallayout>
ST_UID シーケンス引数はシーケンス番号の代わりに UID を
含みます
</literallayout>
</informalexample>
</para>
<para>
<example>
<title><function>imap_setflag_full</function> の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host:143}","username","password")
or die("can't connect: ".imap_last_error());
$status = imap_setflag_full($mbox,"2,5","\\Seen \\Flagged");
print gettype($status)."\n";
print $status."\n";
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-sort">
<refnamediv>
<refname>imap_sort</refname>
<refpurpose></refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>imap_sort</methodname>
<methodparam><type>int</type><parameter>stream</parameter></methodparam>
<methodparam><type>int</type><parameter>criteria</parameter></methodparam>
<methodparam><type>int</type><parameter>reverse</parameter></methodparam>
<methodparam><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
指定したパラメータによりソートされたメッセージ番号の配列を
返します。
</para>
<para>
逆順にソートする場合は、reverse を 1 にします。
</para>
<para>
criteria は、次のどれかとします。(一つのみ)
<informalexample>
<literallayout>
SORTDATE メッセージの日付
SORTARRIVAL 到着日付
SORTFROM 最初の From アドレスのメールボックス
SORTSUBJECT メッセージ Subject
SORTTO 最初の To アドレスのメールボックス
SORTCC 最初の cc アドレスのメールボックス
SORTSIZE メッセージのサイズ
</literallayout>
</informalexample>
</para>
<para>
フラグはビットマスクであり、次の組み合わせとjります。
<informalexample>
<literallayout>
SE_UID シーケンス番号の変わりに UID を返す
SE_NOPREFETCH 検索したメッセージを事前取得しない
</literallayout>
</informalexample>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-status">
<refnamediv>
<refname>imap_status</refname>
<refpurpose>
現在のメールボックス以外のメールボックスのステータス情報を返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>imap_status</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mailbox</parameter></methodparam>
<methodparam><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、ステータス情報を有するオブジェクトを返します。
有効なフラグは次のようになります。
<itemizedlist>
<listitem>
<simpara>
SA_MESSAGES - status->messages にメールボックスのメッセージ数を設定する
</simpara>
</listitem>
<listitem>
<simpara>
SA_RECENT - status->recent にメールボックスの最近のメッセージ数を設定する
</simpara>
</listitem>
<listitem>
<simpara>
SA_UNSEEN - status->unseen にメールボックスの未読の(新規)メッセージ数を
設定する
</simpara>
</listitem>
<listitem>
<simpara>
SA_UIDNEXT - status->uidnext にメールボックスの次のUIDを設定する
</simpara>
</listitem>
<listitem>
<simpara>
SA_UIDVALIDITY - メールボックスのUIDがもはや有効ではない場合に変化する
定数を status->uidvalidity に設定する
</simpara>
</listitem>
<listitem>
<simpara>
SA_ALL - 上記のものを全f設定する
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
status->flags にも上記の各定数に対するビットマスクが
設定されます。
</para>
<para>
<example>
<title><function>imap_status</function> の例</title>
<programlisting role="php">
<![CDATA[
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
or die("can't connect: ".imap_last_error());
$status = imap_status($mbox,"{your.imap.host}INBOX",SA_ALL);
if($status) {
print("Messages: ". $status->messages )."<br>\n";
print("Recent: ". $status->recent )."<br>\n";
print("Unseen: ". $status->unseen )."<br>\n";
print("UIDnext: ". $status->uidnext )."<br>\n";
print("UIDvalidity:". $status->uidvalidity)."<br>\n";
} else
print "imap_status failed: ".imap_last_error()."\n";
imap_close($mbox);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.imap-subscribe">
<refnamediv>
<refname>imap_subscribe</refname>
<refpurpose>メールボックスの購読</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_subscribe</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
</methodsynopsis>
<para>
新規メールボックスを購読します。
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-uid">
<refnamediv>
<refname>imap_uid</refname>
<refpurpose>
指定したメッセージシーケンス番号の UID を返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_uid</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msgno</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、指定したメッセージシーケンス番号の UID を返します。
メッセージ番号はメールボックスの内容を変更する度に変わる可能性が
ありますが、UIDはユニークなIDであり時間が経過しても変わりません。
この関数は、<function>imap_msgno</function> の逆関数です。
</para>
<note>
<para>
この関数は、POP3メールボックスではサポートされません。
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.imap-undelete">
<refnamediv>
<refname>imap_undelete</refname>
<refpurpose>削除マークがついているメッセージのマークをはずす</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_undelete</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>msg_number</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、<function>imap_delete</function>または
<function>imap_mail_move</function>によりセットされた指定されたメッ
セージの削除フラグをはずします。
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-unsubscribe">
<refnamediv>
<refname>imap_unsubscribe</refname>
<refpurpose>メールボックスの購読をやめる</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_unsubscribe</methodname>
<methodparam><type>int</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>mbox</parameter></methodparam>
</methodsynopsis>
<para>
指定されたメールボックスの購読を中止します。
</para>
<para>
成功すると&true;、失敗すると&false;を返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-utf7-decode">
<refnamediv>
<refname>imap_utf7_decode</refname>
<refpurpose>
修正版UTF-7 エンコードされた文字列をデコードする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_utf7_decode</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
修正版UTF-7の<parameter>text</parameter>を8ビットデータにデコード
します。
</para>
<para>
デコードされた8ビットデータを返します。入力文字列が有効な修正版
UTF-7文字列でない場合は&false;を返します。修正UTF-7エンコーディング
は、<ulink url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section
5.1.3 で定義されています。
(元のUTF-7は<ulink url="&url.rfc;rfc1642.html">RFC1642</ulink>で
定義されています)
</para>
</refsect1>
</refentry>
<refentry id="function.imap-utf7-encode">
<refnamediv>
<refname>imap_utf7_encode</refname>
<refpurpose>
8ビットデータを修正版UTF-7テキストにに変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_utf7_encode</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
8ビットデータの<parameter>data</parameter>を修正版UTF-7テキスト
に変換します。修正版UTF-7エンコードは
<ulink url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section 5.1.3
で定義されています。(オリジナルのUTF-7は<ulink
url="&url.rfc;rfc1642.html">RFC1642</ulink>で定義されています)
</para>
<para>
修正版UTF-7のテキストを返します。
</para>
</refsect1>
</refentry>
<refentry id="function.imap-utf8">
<refnamediv>
<refname>imap_utf8</refname>
<refpurpose>
テキストをUTF8に変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>imap_utf8</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
指定した<parameter>text</parameter>を
(<ulink url="&url.rfc;rfc2044.html">RFC2044</ulink>で定義された)
UTF8に変換します。
</para>
</refsect1>
</refentry>
<refentry id='function.imap-thread'>
<refnamediv>
<refname>imap_thread</refname>
<refpurpose>
REFERENCESツリーによりスレッド化して返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>imap_thread</methodname>
<methodparam><type>int</type><parameter>stream_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
|