Exemple #1
0
 /**
  * @dataProvider getAttachmentFixture
  */
 public function testGetAttachments()
 {
     $this->mailbox->addMessage($this->getFixture('attachment_encoded_filename'));
     $message = $this->mailbox->getMessage(1);
     $this->assertCount(1, $message->getAttachments());
     $attachment = $message->getAttachments()[0];
     $this->assertEquals('Prostřeno_2014_poslední volné termíny.xls', $attachment->getFilename());
 }
Exemple #2
0
 /**
  * Move message to another mailbox
  *
  * @param Mailbox $mailbox
  *
  * @throws MessageMoveException
  * @return Message
  */
 public function move(Mailbox $mailbox)
 {
     if (!imap_mail_move($this->stream, $this->messageNumber, $mailbox->getName(), \CP_UID)) {
         throw new MessageMoveException($this->messageNumber, $mailbox->getName());
     }
     return $this;
 }
Exemple #3
0
 public function testSearchNoResults()
 {
     $search = new SearchExpression();
     $search->addCondition(new To('*****@*****.**'));
     $this->assertCount(0, $this->mailbox->getMessages($search));
 }
Exemple #4
0
 protected function createTestMessage(Mailbox $mailbox, $subject = 'Don\'t panic!', $contents = 'Don\'t forget your towel', $from = '*****@*****.**', $to = '*****@*****.**')
 {
     $message = "From: {$from}\r\n" . "To: {$to}\r\n" . "Subject: {$subject}\r\n" . "\r\n" . "{$contents}";
     $mailbox->addMessage($message);
 }
Exemple #5
0
 public function deleteMailbox(Mailbox $mailbox)
 {
     if (false === imap_deletemailbox($this->resource, $this->server . $mailbox->getName())) {
         throw new Exception('Mailbox ' . $mailbox->getName() . ' could not be deleted');
     }
     $this->mailboxes = $this->mailboxNames = null;
 }