Lines Matching refs:mailbox
60 * Create a test mailbox and populate with msgs
63 * @param int message_count number of test msgs to be written to new mailbox
67 * @return resource IMAP stream to new mailbox
77 // open a stream to default mailbox
84 echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
87 echo "New mailbox created\n";
89 // reopen stream to new mailbox
91 throw new Exception("Can't re-open '$new_mailbox' mailbox: " . imap_last_error());
98 * Create mailbox and fill with generic emails
108 $mailbox = IMAP_DEFAULT_MAILBOX . '.' . IMAP_MAILBOX_PHPT_PREFIX . $mailbox_suffix;
110 $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
112 // check mailbox does not already exist
115 if ($value->name == $mailbox) {
116 throw new Exception("Mailbox '$mailbox' already exists");
121 if (imap_createmailbox($imap_stream, $mailbox) === false) {
122 throw new Exception("Can't create a temporary mailbox: " . imap_last_error());
127 populate_mailbox($imap_stream, $mailbox, $message_count, $simpleMessages);
130 return $mailbox;
150 * Populate a mailbox with generic emails
153 * @param string $mailbox
157 function populate_mailbox($imap_stream, string $mailbox, int $message_count, bool $simpleMessages =…
196 imap_append($imap_stream, $mailbox, $msg);
201 * Get the mailbox name from a mailbox description, i.e strip off server details.
203 * @param string mailbox complete mailbox name
204 * @return string mailbox name
209 throw new Exception("Unrecognized mailbox name '$mailboxName'");