You are here

function MailhandlerPhpImapRetrieve::fetch_uid in Mailhandler 6.2

Same name and namespace in other branches
  1. 7.2 modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php \MailhandlerPhpImapRetrieve::fetch_uid()

Fetch UID for a message in a POP mailbox.

Taken from PHP.net.

1 call to MailhandlerPhpImapRetrieve::fetch_uid()
MailhandlerPhpImapRetrieve::retrieve_message in modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
Retrieve individual messages from an IMAP result.

File

modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php, line 397
Definition of MailhandlerPhpImapRetrieve class.

Class

MailhandlerPhpImapRetrieve
Retrieve messages using PHP IMAP library.

Code

function fetch_uid($mailbox, $msg_number) {
  extract($mailbox->settings);
  $retval = 0;
  $fp = fsockopen($domain, $port);
  if ($fp > 0) {
    $buf = fgets($fp, 1024);
    fwrite($fp, "USER {$name}\r\n");
    $buf = fgets($fp, 1024);
    fwrite($fp, "PASS {$pass}\r\n");
    $buf = fgets($fp, 1024);
    fwrite($fp, "UIDL {$msg_number}\r\n");
    $retval = fgets($fp, 1024);
    fwrite($fp, "QUIT\r\n");
    $buf = fgets($fp, 1024);
    fclose($fp);
  }
  return drupal_substr($retval, 6, 30);
}