Ejemplo n.º 1
0
    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);
        }
        $mail->text_plain_id = $textP->_id;
    }
    //text html
    if ($mail->_text_html) {
        $textH = new CContentHTML();
Ejemplo n.º 2
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) {
             $unread++;
         }
         //read on server + pref + not sent => archived !
         if ($mail_unseen->date_read && $archivedOnReception && !$mail_unseen->sent) {