Esempio n. 1
0
 public function send(Mail $mail)
 {
     $to = $mail->getTo();
     $subject = $mail->getSubject();
     $result = mail($to, $subject, $mail->getContent(), $mail->getNonMatchingHeaderLines(array('To', 'Subject')));
     if (!$result) {
         throw new Exception('Unable to send mail');
     }
 }
Esempio n. 2
0
 public function testGetHeaderValue()
 {
     $mail = new Mail($this->date);
     $mail->setFrom('*****@*****.**', 'Foo Bar');
     $mail->addTo('*****@*****.**', 'John Doe');
     $mail->addCc('*****@*****.**');
     $mail->addCc('*****@*****.**', 'Raphael Rougeron');
     $mail->setSubject('Stop these useless meetings...');
     $this->assertEquals('John Doe <*****@*****.**>', $mail->getTo());
     $this->assertEquals('Foo Bar <*****@*****.**>', $mail->getFrom());
     $this->assertEquals('jane.doe@fake.net, Raphael Rougeron <*****@*****.**>', $mail->getCc());
     $this->assertEquals('', $mail->getBcc());
     $this->assertEquals('Stop these useless meetings...', $mail->getSubject());
 }