Esempio n. 1
0
     }
   }*/
 array_splice($unseen, $limitMail);
 if (count($unseen) > 0) {
     $unread = 0;
     //unseen mail
     $loop = 0;
     //loop of foreach
     $created = 0;
     foreach ($unseen as $_mail) {
         $pop->cleanTemp();
         $mail_unseen = new CUserMail();
         $mail_unseen->account_id = $_source->_id;
         $mail_unseen->account_class = $_source->_class;
         //mail non existant
         $header = $pop->header($_mail);
         $content = $pop->getFullBody($_mail, false, false, true);
         $hash = $mail_unseen->makeHash($header, $content);
         if (!$mail_unseen->loadMatchingFromHash($hash)) {
             $mail_unseen->setHeaderFromSource($header);
             $mail_unseen->setContentFromSource($pop->getFullBody($_mail, false, false, true));
             //text plain
             $mail_unseen->getPlainText($_source->object_id);
             //text html
             $mail_unseen->getHtmlText($_source->object_id);
             //sent ?
             if (strpos($mail_unseen->from, $_source->user) !== false) {
                 $mail_unseen->sent = 1;
             }
             //unread increment
             if (!$mail_unseen->date_read) {
Esempio n. 2
0
$mail_id = CValue::get("mail_id");
$log_pop = new CSourcePOP();
$log_pop->name = "user-pop-" . $user->_id;
$log_pop->loadMatchingObject();
if (!$log_pop) {
    CAppUI::stepAjax("Source POP indisponible", UI_MSG_ERROR);
}
if (!$mail_id) {
    CAppUI::stepAjax("CSourcePOP-error-mail_id", UI_MSG_ERROR);
}
//pop init
$pop = new CPop($log_pop);
$pop->open();
//mail
$mail = new CUserMail();
$head = $pop->header($mail_id);
$content = $pop->getFullBody($_mail, false, false, true);
$hash = $mail_unseen->makeHash($head, $content);
$mail->loadMatchingFromHash($hash);
if ($mail->_id && !$mail->text_plain_id) {
    $mail->setHeaderFromSource($head);
    $mail->setContentFromSource($pop->getFullBody($_mail, false, false, true));
    $mail->date_read = CMbDT::dateTime();
    $mail->user_id = $user->_id;
    //text plain
    if ($mail->_text_plain) {
        $textP = new CContentAny();
        $textP->content = $mail->_text_plain;
        if ($msg = $textP->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        }
Esempio n. 3
0
 */
CCanDo::checkAdmin();
$mail_id = CValue::get("id");
//usermail
$mail = new CUserMail();
$mail->load($mail_id);
$mail->loadAttachments();
//client POP
$clientPOP = new CSourcePOP();
$clientPOP->load($mail->account_id);
$pop = new CPop($clientPOP);
if (!$pop->open()) {
    return;
}
//overview
$overview = $pop->header($mail->uid);
$msgno = $overview->msgno;
$infos = $pop->infos($msgno);
//structure
$structure = $pop->structure($mail->uid);
//content
$content = $pop->getFullBody($mail->uid);
//attachments
$attachments = array();
$_attachments = $pop->getListAttachments($mail->uid);
foreach ($_attachments as $_attach) {
    $attachments[] = $_attach->getPlainFields();
}
$pop->close();
$smarty = new CSmartyDP();
$smarty->assign("mail", $mail);