You are here

public function MailhandlerPhpImapRetrieve::mailbox_string in Mailhandler 7.2

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

Constructs a mailbox string based on mailbox object.

2 calls to MailhandlerPhpImapRetrieve::mailbox_string()
MailhandlerPhpImapRetrieve::open_mailbox in modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
Establish IMAP stream connection to specified mailbox.
MailhandlerPhpImapRetrieve::test in modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
Test connection to a mailbox.

File

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

Class

MailhandlerPhpImapRetrieve
Retrieve messages using PHP IMAP library.

Code

public function mailbox_string($mailbox) {
  extract($mailbox->settings);
  switch ($type) {
    case 'imap':
      return '{' . $domain . ':' . $port . $extraimap . '}' . $folder;
    case 'pop3':
      return '{' . $domain . ':' . $port . '/pop3' . $extraimap . '}' . $folder;
    case 'local':
      $box = ltrim($folder, '/');
      if ($readonly) {

        // Copy mbox to avoid modifying original.
        $source = $box;
        $destination = 'temporary://';
        $replace = FILE_EXISTS_REPLACE;
        $path = file_unmanaged_copy($source, $destination, $replace);
        $box = drupal_realpath($path);
      }
      return $box;
  }
}