コード例 #1
0
ファイル: Transport.php プロジェクト: Nycto/Round-Eights
 /**
  * Method for sending a piece of mail using this transport.
  *
  * @param \r8\Mail $mail The mail to send
  * @return \r8\Mail\Transport Returns a self reference
  */
 public function send(\r8\Mail $mail)
 {
     if (!$mail->fromExists()) {
         throw new \r8\Exception\Variable('From Address', '"From" Address must be set to send an email');
     }
     if (!$mail->hasTos()) {
         throw new \r8\Exception\Variable('To Address', '"To" Address must be set to send an email');
     }
     $this->internalSend($mail);
     return $this;
 }
コード例 #2
0
ファイル: Formatter.php プロジェクト: Nycto/Round-Eights
 /**
  * Returns the body string for an HTML
  *
  * @param \r8\Mail $mail The piece of mail whose body will be returned
  * @return String A formatted body email string
  */
 public function getBody(\r8\Mail $mail)
 {
     // If both the text and HTML are set...
     if ($mail->htmlExists() && $mail->textExists()) {
         $mime = new \r8\Transform\MIME\Auto();
         $mime->setEOL(self::EOL);
         $mime->setLineLength(self::LINE_LENGTH);
         $boundary = $mail->getBoundary();
         return "--" . $boundary . self::EOL . $mime->setHeader("Content-Type")->to('text/plain; charset="ISO-8859-1"') . self::EOL . $mime->setHeader("Content-Transfer-Encoding")->to('7bit') . self::EOL . self::EOL . $this->prepareContent($mail->getText()) . self::EOL . self::EOL . "--" . $boundary . self::EOL . $mime->setHeader("Content-Type")->to('text/html; charset="ISO-8859-1"') . self::EOL . $mime->setHeader("Content-Transfer-Encoding")->to('7bit') . self::EOL . self::EOL . $this->prepareContent($mail->getHTML()) . self::EOL . self::EOL . "--" . $boundary . "--" . self::EOL;
     } else {
         if ($mail->htmlExists()) {
             return $this->prepareContent($mail->getHTML());
         } else {
             return $this->prepareContent($mail->getText());
         }
     }
 }