/** * Кодирует текст * * @param string $text */ public function encode($text) { return MIME::encode_qp($text, $this->length); }
/** * Формирует один фаил с заголовками и параметрами * * @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); }