imap.php 950 B

123456789101112131415161718192021222324252627282930313233
  1. <?
  2. /**
  3. ** imap.php
  4. **
  5. ** Functions for the IMAP connection
  6. **
  7. **/
  8. /** Read from the connection until we get either an OK or BAD message. **/
  9. function imapReadData($connection) {
  10. $read = fgets($connection, 1024);
  11. $counter = 0;
  12. while ((substr($read, strpos($read, " ") + 1, 2) != "OK") && (substr($read, strpos($read, " ") + 1, 3) != "BAD")) {
  13. $data[$counter] = $read;
  14. $read = fgets($connection, 1024);
  15. $counter++;
  16. }
  17. return $data;
  18. }
  19. /** Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX **/
  20. function findMailboxName($mailbox) {
  21. // start at -2 so that we skip the initial quote at the end of the mailbox name
  22. $i = -2;
  23. $char = substr($mailbox, $i, 1);
  24. while ($char != "\"") {
  25. $i--;
  26. $temp .= $char;
  27. $char = substr($mailbox, $i, 1);
  28. }
  29. return strrev($temp);
  30. }
  31. ?>