function mailhandler_mailbox_stream_retrieve in Mailhandler 6
Return a message matching the requested conditions.
Parameters
$stream stream openned using mailhandler_mailbox_stream_open().:
$msgno message number to retrieve.:
$conditions associative array of conditions to retrieve a message. : When using IMAP connections, the retrieving process can be improved by checking the message header first. Conditions are based on IMAP header information, E.g. to retrieve only unread emails you can specify the 'Unseen' => 'U' condition.
Return value
boolean result of closing operation
Related topics
File
- ./
mailhandler.module, line 587 - Mailhandler module code.
Code
function mailhandler_mailbox_stream_retrieve($stream, $msgno = 0, $conditions = array()) {
// Add default conditions, get unread messages.
$conditions += array(
'Unseen' => 'U',
);
// Get Message header information. In case of POP driver, the function will
// return the whole message, so we should make no additional calls and return
// the result.
$result = imap_headerinfo($stream, $msgno);
die('@todo: Incomplete function');
// Record debug information about stream closing operation.
mailhandler_watchdog_record('Retrieving message %Msgno : %result.', array(
'%result' => !imap_last_error(),
'%Msgno' => $conditions['Msgno'],
), WATCHDOG_DEBUG);
return $result;
}