Exemple #1
0
 /**
  * Add or replace the plain text part of the mail
  *
  * @param $text
  *
  * @return Email
  */
 public function setText($text)
 {
     return $this->addPart(Part::create($text, 'text/plain'), true);
 }
 public function testShouldSetMultipartAlternativeIfEmailIsMultipart()
 {
     $email = new Email();
     $email->addPart(Email\Part::create('BODY PART', 'text/plain'))->addPart(Email\Part::create('PART 2', 'text/html'));
     $this->mailer->send(Argument::that(function ($argument) {
         if (!$argument instanceof \Swift_Message) {
             return false;
         }
         $this->assertCount(2, $argument->getChildren());
         $this->assertEquals('multipart/alternative', $argument->getContentType());
         return true;
     }))->willReturn(1);
     $this->handler->notify($email);
 }
Exemple #3
0
 /**
  * @expectedException \Fazland\Notifire\Exception\PartContentTypeMismatchException
  */
 public function testAddPartShouldThrowIfTwoPartsWithSameContentTypeHasAdded()
 {
     Email::create()->addPart(Email\Part::create('BlaBla', 'text/html'))->addPart(Email\Part::create('Foo bar', 'text/html'));
 }