public function __construct($content = '', $filename = null, $content_type = 'application/octet-stream', $encoding = 'base64') { parent::__construct($content, $content_type, $encoding); $options = array(); if ($filename !== null) $options['name'] = $filename; $this->set_content_type($content_type, $options); $this->set_content_disposition($filename); }
public function add_embedded_image($content, $content_id, $filename = null, $content_type = 'application/octet-stream', $encoding = 'base64') { $content = new SMimePart($content, $content_type, $encoding); if ($filename !== null) $content->set_content_type($content_type, array('name' => $filename)); $content->set_header('Content-ID', '<'.$content_id.'>'); if ($this->is_multipart() && $this->content->get_subtype() == SMimeMultipart::RELATED) $this->content->add_part($content); else $this->set_content(new SMimeMultipart(SMimeMultipart::RELATED, array($this->content, $content))); }