I used the imap4flag plugin to run the Dovecot:
The flag was shown correctly in Thunderbird But I search for
This is a missing feature, see PHP Bug # 53043:
An example code using the IMAP protocol directly:
& lt ;? Php class imaset (private $ _socket; private function _gets () {$ result = array}; while (substr ($ str = fgets ($ this-> _socket), 0, 1) == '*') { $ Result [] = substr ($ str, 0, -2);} $ result [] = substr ($ str, 0, -2); return result;} private function _ sand ($ cmd, $ uid = ' . ') {$ Quid = "$ uid $ cmd \ r \ n"; $ count = fwrite ($ this-> _socket, $ query); if ($ count == strlen ($ query)) {return $ This-> _gets ();} Other (new exception throwing ("One day a certificate for Lars de la Northeast de la command" $ CMD ");}} Personal function _connect ($ server, $ port, $ Tls) {if ($ tls) {$ server = 'tls: //' $ s $ Fd = fsockopen ($ server, $ port, $ errno); if (! $ Errno) {return $ FD;} other (throwing new exceptions (use for 'impossible D' 'IOAP')}} Private function _ login ($ login, $ password) {$ result = $ this- & gt; _send ("LOGIN $ login $ password"); $ result = array_pop ($ result); if ($ result! = "OK Log in. ") {New Exception ('Log In Impossible')}} Public Function __construct ($ option, $ mailbox = '') {$ this- & gt; _socket = $ this- & gt; _connect ($ option ['server'], $ option ['port'] is true); $ This- & gt; _login ($ option ['login'], $ option ['password']); If (! Is_null ($ Mailbox)) {$ this- & gt; Select_mailbox ($ mailbox); }} Public function __destruct () {fclose ($ this-> _socket); } Public function select_mailbox ($ mailbox) {$ result = $ this- & gt; _seend ("SELECT $ mailbox"); $ Result = array_pop ($ result); If ($ results! = ". OK [read-write] done".) {New exception ('Impossess de Sacture La Mailbox'); }} Public function get_flags ($ uid) {$ result = $ this- & gt; _seend ("FETCH $ uid (flag)"); Preg_match_all ("# \\ * \\ d + FETCH \\ (Flags \\ (*. *) \\) \\) #", $ result [0], and $ matches); If (isset ($ matches [1] [0])) {return blast ('', $ matches [1] [0]); } Other {return arrays}; }}} Usage:
& lt ;? Php $ imap = new IMAPSet (array ('server' = & gt; 'localhost', 'port' = & gt; 143, 'login' = & gt; 'login', 'password' = & gt; ), 'INBOX'); Var_dump ($ imap- & gt; mill_flag (0));
Comments
Post a Comment