/** * @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); }
/** * @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); }
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); } }
/** * @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); }
/** * @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()); }