Inbox cannot be created.
Before calling this method, a connection to the IMAP server must be
established and a user must be authenticated successfully.
public createMailbox ( string $mailbox ) : boolean | ||
$mailbox | string | |
return | boolean |
public function testImapMessageSourceEmptySet() { $transport = new ezcMailImapTransport("mta1.ez.no"); $transport->authenticate("*****@*****.**", "ezcomponents"); $transport->createMailbox("Guybrush"); $transport->selectMailbox("Guybrush"); $parser = new ezcMailParser(); $set = new ezcMailStorageSet($transport->fetchAll(), $this->tempDir); $mail = $parser->parseMail($set); $this->assertEquals(array(), $mail); $transport->selectMailbox("Inbox"); $transport->deleteMailbox("Guybrush"); }
public function testUidDelete() { $imap = new ezcMailImapTransport(self::$server, self::$port, array('uidReferencing' => true)); $imap->authenticate(self::$user, self::$password); $imap->createMailbox("Guybrush"); $imap->selectMailbox('inbox'); $imap->copyMessages(self::$ids[0], "Guybrush"); $imap->selectMailbox("Guybrush"); $imap->delete(1); $imap->selectMailbox('inbox'); $imap->deleteMailbox("Guybrush"); }
require_once 'tutorial_autoload.php'; // Create a new IMAP transport object by specifying the server name $imap = new ezcMailImapTransport("imap.example.com"); // Authenticate to the IMAP server $imap->authenticate("user", "password"); // Select the Inbox mailbox $imap->selectMailbox('Inbox'); // List the capabilities of the IMAP server $capabilities = $imap->capability(); // List existing mailboxes $mailboxes = $imap->listMailboxes("", "*"); // Fetch the hierarchy delimiter character (usually "/") $delimiter = $imap->getHierarchyDelimiter(); // Create a new mailbox $imap->createMailbox("Reports 2006"); // Delete a mailbox $imap->deleteMailbox("Reports 2005"); // Rename a mailbox $imap->renameMailbox("Reports 2006", "Reports"); // Copy messages from the selected mailbox (here: Inbox) to another mailbox $imap->copyMessages("1,2,4", "Reports"); // Set a flag to messages // See the function description for a list of supported flags $imap->setFlag("1,2,4", "DELETED"); // Clears a flag from messages // See the function description for a list of supported flags $imap->clearFlag("1,2,4", "SEEN"); // Append a message to a mailbox. $mail must contain the mail as text // Use this with a "Sent" or "Drafts" mailbox $imap->append("Sent", $mail);
public function testTagInHeadersAndBody() { $imap = new ezcMailImapTransport(self::$server, self::$port); $imap->authenticate(self::$user, self::$password); $imap->createMailbox("Guybrush"); $mail = new ezcMail(); $mail->from = new ezcMailAddress('*****@*****.**', 'From'); $mail->addTo(new ezcMailAddress('*****@*****.**', 'To')); $mail->subject = "A0000 A0001 A0002 A0003 A0004 A0005 A0006 A0007"; $mail->body = new ezcMailText("A0000\nA0001\nA0002\nA0003\nA0004\nA0005\nA0006\nA0007"); $data = $mail->generate(); $imap->append("Guybrush", $data); $imap->append("Guybrush", $data, array('Answered')); $imap->selectMailbox("Guybrush"); $set = $imap->fetchAll(); $parser = new ezcMailParser(); $mail = $parser->parseMail($set); $mail = $mail[0]; $imap->selectMailbox("Inbox"); $imap->deleteMailbox("Guybrush"); $this->assertEquals('A0000 A0001 A0002 A0003 A0004 A0005 A0006 A0007', $mail->subject); }