static function with_images_cb($m) { $src = '.' . $m[2]; if (IO_FS::exists($src)) { self::$multipart = 'related'; $id = md5($src); self::$attaches[$id] = Mail_Message::Part()->file($src)->content_id("<{$id}>")->content_disposition('inline'); return $m[1] . "=\"cid:{$id}\""; } else { return $m[0]; } }
protected function attaches_cb($m) { $src = '.' . $m[2]; $this->multipart = 'related'; $id = md5($src); $this->attaches[$id] = Mail_Message::Part()->file($src)->content_id("<{$id}>")->content_disposition('inline'); return $m[1] . "=\"cid:{$id}\""; }
/** * Добавляет к письму attach фаил * * @param $file * @param string $name * * @return Mail_Message_Message */ public function file_part($file, $name = '') { return $this->part(Mail_Message::Part()->file($file, $name)); }
/** * Формирует один фаил с заголовками и параметрами * * @param $container * @param int $index */ protected function head($container, $index) { $values = array(); $headers = Mail_Message::Head(); foreach ($container as $k => $v) { if (array_search($k, Mail_List::option('headers'), true) !== false) { $headers->field($k, $v); } else { $values[] = sprintf("-%s: %s", $k, MIME::encode_qp($v, null)); } } $path = sprintf('%s/%s.%06d', Mail_List::option('root') . '/recipients', $this->id, $index); IO_FS::rm($path); $f = IO_FS::File($path); $f->open('w')->write($headers->encode() . (count($values) ? implode("\n", $values) . "\n" : ''))->close(); $f->chmod(0664); }