コード例 #1
0
ファイル: File.php プロジェクト: reoring/sabel
 /**
  * @return string
  */
 public function toMailPart()
 {
     $eol = Sabel_Mail::getEol();
     $encoding = $this->encoding;
     $disposition = $this->disposition;
     $data = $this->encode($this->content, $encoding, $eol);
     $part = array();
     if ($this->followRFC2231) {
         $part[] = "Content-Type: " . $this->type;
         $part[] = "Content-Disposition: " . $this->disposition . ";";
         $part[] = $this->toRFC2231($this->name, $eol);
         $part[] = "Content-Transfer-Encoding: {$encoding}";
         $part[] = $eol . $data . $eol;
     } else {
         if (extension_loaded("mbstring")) {
             $name = mb_encode_mimeheader($this->name, $this->charset);
         } else {
             $name = "=?{$this->charset}?B?" . base64_encode($this->name) . "?=";
         }
         $part[] = "Content-Type: " . $this->type . "; name=\"{$name}\"";
         $part[] = "Content-Disposition: " . $this->disposition . "; filename=\"{$name}\"";
         $part[] = "Content-Transfer-Encoding: {$encoding}";
         $part[] = $eol . $data . $eol;
     }
     return implode($eol, $part);
 }
コード例 #2
0
ファイル: Plain.php プロジェクト: hamaco/phwittr-on-xoops
 /**
  * @return string
  */
 public function toMailPart()
 {
     $part = array();
     $eol = Sabel_Mail::getEol();
     $part[] = "Content-Disposition: " . $this->disposition;
     $part[] = "Content-Transfer-Encoding: " . $this->encoding;
     $part[] = "Content-Type: {$this->type}; charset=" . $this->charset . $eol;
     $part[] = $this->getEncodedContent() . $eol;
     return implode($eol, $part);
 }
コード例 #3
0
ファイル: PHP.php プロジェクト: reoring/sabel
 public function send(array $headers, $body, $options = array())
 {
     $recipients = $this->getRecipients($headers);
     $subject = $this->getSubject($headers);
     $headersText = implode(Sabel_Mail::getEol(), $this->createHeaderText($headers));
     if (isset($options["parameters"])) {
         return mail($recipients, $subject, $body, $headersText, $options["parameters"]);
     } else {
         return mail($recipients, $subject, $body, $headersText);
     }
 }
コード例 #4
0
ファイル: Html.php プロジェクト: hamaco/phwittr-on-xoops
 /**
  * @return string
  */
 public function toMailPart($boundary = null)
 {
     if ($this->hasImage() && $boundary === null) {
         $message = __METHOD__ . "() Because the inline image exists, boundary is necessary.";
         throw new Sabel_Mail_Exception($message);
     }
     $part = array();
     $eol = Sabel_Mail::getEol();
     $part[] = "Content-Disposition: " . $this->disposition;
     $part[] = "Content-Transfer-Encoding: " . $this->encoding;
     $part[] = "Content-Type: {$this->type}; charset=" . $this->charset . $eol;
     $part[] = $this->getEncodedContent() . $eol;
     if ($this->hasImage()) {
         foreach ($this->inlineImages as $image) {
             $enc = $image["encoding"];
             $part[] = "--{$boundary}";
             $part[] = "Content-Type: {$image["mimetype"]}";
             $part[] = "Content-Transfer-Encoding: {$enc}";
             $part[] = "Content-ID: <{$image["cid"]}>";
             $part[] = $eol . $this->encode($image["data"], $enc, $eol) . $eol;
         }
     }
     return implode($eol, $part);
 }
コード例 #5
0
ファイル: Abstract.php プロジェクト: hamaco/phwittr-on-xoops
 /**
  * @return string
  */
 public function getEncodedContent()
 {
     $content = $this->content;
     if (extension_loaded("mbstring")) {
         $content = mb_convert_encoding($content, $this->charset);
     }
     return $this->encode($content, $this->encoding, Sabel_Mail::getEol());
 }
コード例 #6
0
ファイル: Object.php プロジェクト: hamaco/phwittr-on-xoops
 protected function getSmtp()
 {
     $smtp = new Sabel_Mail($this->config["charset"]);
     $smtp->setSender(new Sabel_Mail_Sender_Smtp(array("host" => $this->config["host"], "port" => $this->config["port"])));
     return $smtp;
 }
コード例 #7
0
ファイル: Mail.php プロジェクト: hamaco/phwittr-on-xoops
 public static function setEol($eol)
 {
     self::$EOL = $eol;
 }