public function testGetMailItems() { $client = $this->getClient(); $mailItems = $client->getMailItems(); $this->assertCount(0, $mailItems); $this->createTestMail(); $mailItems = $client->getMailItems(); $this->assertCount(1, $mailItems); $mailClient = new MailAPI(); $mailClient->setClient($client->getClient()); $mailItems = $client->getMailItems($client->getFolderId()); $this->assertCount(1, $mailItems); }
<?php require_once "vendor/autoload.php"; use jamesiarmes\PEWS\API\Type; use jamesiarmes\PEWS\Mail\MailAPI; $api = MailAPI::withUsernameAndPassword('server', 'username', 'password'); $message = new Type\MessageType(); $message->setBody('Some Text'); $message->setSubject('Test Subject'); $message->setToRecipients('*****@*****.**'); $return = $api->sendMail($message);
/** * @param string $folderName * @return MailAPI */ public function getMailbox($folderName = null) { $mailApi = new MailAPI(); $mailApi->setClient($this->getClient()); $mailApi->pickMailFolder($folderName); return $mailApi; }