$file->fillFields();
        $file->putContent($file_pop);
        if ($str = $file->store()) {
            CAppUI::stepAjax($str, UI_MSG_ERROR);
        } else {
            $attachment->file_id = $file->_id;
            $attachment->store();
        }
    }
}
//text link
if ($text_html || $text_plain) {
    $content_type = "text/plain";
    if ($text_html) {
        $text = new CContentHTML();
        $text->load($text_html);
        $content_type = "text/html";
    } else {
        $text = new CContentAny();
        $text->load($text_plain);
    }
    $file = new CFile();
    $file->setObject($object);
    $file->author_id = CAppUI::$user->_id;
    $file->file_name = "sans_titre";
    $file->file_category_id = $category_id;
    if ($mail->subject) {
        $file->file_name = $mail->subject;
    }
    if ($rename_text) {
        $file->file_name = $rename_text;