Example #1
0
 public function testFormatAddress()
 {
     $this->assertSame("<*****@*****.**>", \r8\Mail\Formatter::formatAddress("*****@*****.**"));
     $this->assertSame('"Lug MightyChunk" <*****@*****.**>', \r8\Mail\Formatter::formatAddress("*****@*****.**", "Lug MightyChunk"));
     $this->assertSame('<*****@*****.**>', \r8\Mail\Formatter::formatAddress("*****@*****.**", chr(5)));
     $this->assertSame('"Lug \\"MightyChunk\\"" <*****@*****.**>', \r8\Mail\Formatter::formatAddress("*****@*****.**", 'Lug "MightyChunk"'));
 }
Example #2
0
 /**
  * Internal function that actually sends a piece of mail using this transport.
  *
  * This method is called indirectly via the send method. Use that method
  * if you want to send a piece of mail
  *
  * @param \r8\Mail $mail The mail to send
  * @return Null
  */
 protected function internalSend(\r8\Mail $mail)
 {
     $result = $this->rawMail($this->formatter->getToString($mail), $mail->getSubject(), $this->formatter->getBody($mail), $this->formatter->getHeaderString($mail));
     if (!$result) {
         $err = new \r8\Exception\Interaction("An error occured while sending mail");
         $phpError = error_get_last();
         if (is_array($phpError)) {
             $err->addData('Error', $phpError['message']);
         }
         $err->addData('To', $this->formatter->getToString($mail));
         $err->addData('Subject', $mail->getSubject());
         if ($mail->messageIDExists()) {
             $err->addData('MessageID', $mail->getMessageID());
         }
         throw $err;
     }
 }