You are here

function mailhandler_open_mailbox in Mailhandler 7

Same name and namespace in other branches
  1. 6 mailhandler.retrieve.inc \mailhandler_open_mailbox()

Establish IMAP stream connection to specified mailbox.

Parameters

$mailbox: Array of mailbox configuration

Return value

IMAP stream

3 calls to mailhandler_open_mailbox()
mailhandler_retrieve in ./mailhandler.retrieve.inc
Connect to mailbox and run message retrieval
mailhandler_retrieve_message in ./mailhandler.retrieve.inc
Retrieve individual messages from an IMAP result
mailhandler_test_mailbox in ./mailhandler.admin.inc
Test connection to a mailbox, and output results as a message

File

./mailhandler.retrieve.inc, line 11

Code

function mailhandler_open_mailbox($mailbox) {
  if ($mailbox['domain']) {
    if ($mailbox['imap'] == 1) {
      $box = '{' . $mailbox['domain'] . ':' . $mailbox['port'] . $mailbox['extraimap'] . '}' . $mailbox['folder'];
    }
    else {
      $box = '{' . $mailbox['domain'] . ':' . $mailbox['port'] . '/pop3' . $mailbox['extraimap'] . '}' . $mailbox['folder'];
    }
    $result = imap_open($box, $mailbox['name'], $mailbox['pass']);
    $err = 'domain';
  }
  else {
    $box = $mailbox['folder'];
    $result = imap_open($box, '', '');
  }
  return $result;
}