| | |
| | | Function containing "_C_" in name require connection handler to be |
| | | passed as one of the parameters. To obtain connection handler, use |
| | | iil_Connect() |
| | | VERSION: |
| | | IlohaMail-0.9-20050415 |
| | | CHANGES: |
| | | File altered by Thomas Bruederli <roundcube@gmail.com> |
| | | to fit enhanced equirements by the RoundCube Webmail: |
| | | - Added list of server capabilites and check these before invoking commands |
| | | - Added junk flag to iilBasicHeader |
| | | - Enhanced error reporting on fsockopen() |
| | | - Additional parameter for SORT command |
| | | - Removed Call-time pass-by-reference because deprecated |
| | | - Parse charset from content-type in iil_C_FetchHeaders() |
| | | - Enhanced heaer sorting |
| | | - Pass message as reference in iil_C_Append (to save memory) |
| | | - Added BCC and REFERENCE to the list of headers to fetch in iil_C_FetchHeaders() |
| | | - Leave messageID unchanged in iil_C_FetchHeaders() |
| | | - Avoid stripslahes in iil_Connect() |
| | | - Removed some debuggers (echo ...) |
| | | |
| | | ********************************************************/ |
| | | |
| | | |
| | | // changed path to work within roundcube webmail |
| | | include_once("lib/icl_commons.inc"); |
| | |
| | | $iil_errornum = 0; |
| | | |
| | | //strip slashes |
| | | $user = stripslashes($user); |
| | | $password = stripslashes($password); |
| | | // $user = stripslashes($user); |
| | | // $password = stripslashes($password); |
| | | |
| | | //set auth method |
| | | $auth_method = "plain"; |
| | |
| | | |
| | | $fp = $conn->fp; |
| | | $command = 's SORT ('.$field.') US-ASCII ALL '."$add\r\n"; |
| | | //$command = 's SORT ('.$field.') US-ASCII ALL UNDELETED'."\r\n"; |
| | | $line = $data = ''; |
| | | |
| | | if (!fputs($fp, $command)) return false; |
| | |
| | | |
| | | /* FETCH date,from,subject headers */ |
| | | $key="fh".($c++); |
| | | $request=$key." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID)])\r\n"; |
| | | |
| | | // echo "// $request\n\n"; |
| | | $request=$key." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCE)])\r\n"; |
| | | |
| | | if (!fputs($fp, $request)) return false; |
| | | do{ |
| | |
| | | $result[$id]->subject = str_replace("\n", "", $headers["subject"]); |
| | | $result[$id]->replyto = str_replace("\n", " ", $headers["reply-to"]); |
| | | $result[$id]->cc = str_replace("\n", " ", $headers["cc"]); |
| | | $result[$id]->bcc = str_replace("\n", " ", $headers["bcc"]); |
| | | $result[$id]->encoding = str_replace("\n", " ", $headers["content-transfer-encoding"]); |
| | | $result[$id]->ctype = str_replace("\n", " ", $headers["content-type"]); |
| | | $result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']); |
| | | $result[$id]->reference = $headers["reference"]; |
| | | |
| | | list($result[$id]->ctype, $ctype_add) = explode(";", $headers["content-type"]); |
| | | |
| | |
| | | $result[$id]->charset = $regs[1]; |
| | | |
| | | $messageID = $headers["message-id"]; |
| | | if ($messageID) $messageID = substr(substr($messageID, 1), 0, strlen($messageID)-2); |
| | | else $messageID = "mid:".$id; |
| | | if (!$messageID) "mid:".$id; |
| | | $result[$id]->messageID = $messageID; |
| | | } |
| | | else { |
| | |
| | | if (!$len) return false; |
| | | |
| | | $request="A APPEND \"".$folder."\" (\\Seen) {".$len."}\r\n"; |
| | | // echo $request.'<br>'; |
| | | if (fputs($fp, $request)){ |
| | | $line=iil_ReadLine($fp, 100); |
| | | // echo $line.'<br>'; |
| | | |
| | | $line=iil_ReadLine($fp, 100); |
| | | $sent = fwrite($fp, $message."\r\n"); |
| | | flush(); |
| | | do{ |
| | | $line=iil_ReadLine($fp, 1000); |
| | | //echo $line.'<br>'; |
| | | }while($line[0]!="A"); |
| | | |
| | | $result = (iil_ParseResult($line)==0); |
| | |
| | | //read response |
| | | do{ |
| | | $line=iil_ReadLine($fp, 1000); |
| | | //echo $line.'<br>'; |
| | | }while($line[0]!="A"); |
| | | |
| | | $result = (iil_ParseResult($line)==0); |