Esempio n. 1
0
}
// Webmails
if (isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != "") {
    $mailid = $_REQUEST["mailid"];
    $mailbox = $_REQUEST["mailbox"];
    require_once 'include/utils/UserInfoUtil.php';
    require_once "modules/Webmails/Webmails.php";
    require_once "modules/Webmails/MailParse.php";
    require_once 'modules/Webmails/MailBox.php';
    $mailInfo = getMailServerInfo($current_user);
    $temprow = $adb->fetch_array($mailInfo);
    $MailBox = new MailBox($mailbox);
    $mbox = $MailBox->mbox;
    $webmail = new Webmails($mbox, $mailid);
    $array_tab = array();
    $webmail->loadMail($array_tab);
    $hdr = @imap_headerinfo($mbox, $mailid);
    $smarty->assign('WEBMAIL', "true");
    $smarty->assign('mailid', $mailid);
    $smarty->assign('mailbox', $mailbox);
    $temp_id = $MailBox->boxinfo['mail_id'];
    $smarty->assign('from_add', $temp_id);
    $webmail->subject = utf8_decode(utf8_encode(imap_utf8($webmail->subject)));
    if ($_REQUEST["reply"] == "all") {
        $smarty->assign('TO_MAIL', $webmail->from . ",");
        //added to remove the emailid of webmail client from cc list....to fix the issue #3818
        $cc_address = '';
        $use_to_header = htmlentities($webmail->to_header, ENT_QUOTES, $default_charset);
        $use_cc_address = htmlentities($hdr->ccaddress, ENT_QUOTES, $default_charset);
        $cc_array = explode(',', $use_to_header . ',' . $use_cc_address);
        for ($i = 0; $i < count($cc_array); $i++) {
Esempio n. 2
0
 function insertIntoAttachment($id, $module)
 {
     global $log, $adb;
     $log->debug("Entering into insertIntoAttachment({$id},{$module}) method.");
     $file_saved = false;
     //Added to send generated Invoice PDF with mail
     $pdfAttached = $_REQUEST['pdf_attachment'];
     //created Invoice pdf is attached with the mail
     if (isset($_REQUEST['pdf_attachment']) && $_REQUEST['pdf_attachment'] != '') {
         $file_saved = pdfAttach($this, $module, $pdfAttached, $id);
     }
     //This is to added to store the existing attachment id of the contact where we should delete this when we give new image
     foreach ($_FILES as $fileindex => $files) {
         if ($files['name'] != '' && $files['size'] > 0) {
             $files['original_name'] = vtlib_purify($_REQUEST[$fileindex . '_hidden']);
             $file_saved = $this->uploadAndSaveFile($id, $module, $files);
         }
     }
     if ($module == 'Emails' && isset($_REQUEST['att_id_list']) && $_REQUEST['att_id_list'] != '') {
         $att_lists = explode(";", $_REQUEST['att_id_list'], -1);
         $id_cnt = count($att_lists);
         if ($id_cnt != 0) {
             for ($i = 0; $i < $id_cnt; $i++) {
                 $sql_rel = 'insert into vtiger_seattachmentsrel values(?,?)';
                 $adb->pquery($sql_rel, array($id, $att_lists[$i]));
             }
         }
     }
     if ($_REQUEST['att_module'] == 'Webmails') {
         require_once "modules/Webmails/Webmails.php";
         require_once "modules/Webmails/MailParse.php";
         require_once 'modules/Webmails/MailBox.php';
         //$mailInfo = getMailServerInfo($current_user);
         //$temprow = $adb->fetch_array($mailInfo);
         $MailBox = new MailBox($_REQUEST["mailbox"]);
         $mbox = $MailBox->mbox;
         $webmail = new Webmails($mbox, $_REQUEST['mailid']);
         $array_tab = array();
         $webmail->loadMail($array_tab);
         if (isset($webmail->att_details)) {
             foreach ($webmail->att_details as $fileindex => $files) {
                 if ($files['name'] != '' && $files['size'] > 0) {
                     //print_r($files);
                     $file_saved = $this->saveForwardAttachments($id, $module, $files);
                 }
             }
         }
     }
     $log->debug("Exiting from insertIntoAttachment({$id},{$module}) method.");
 }
Esempio n. 3
0
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
include 'config.php';
require_once 'include/utils/UserInfoUtil.php';
require_once 'include/utils/utils.php';
require_once 'modules/Webmails/Webmails.php';
require_once 'modules/Webmails/MailBox.php';
global $MailBox, $mod_strings, $theme;
$theme_path = "themes/" . $theme . "/style.css";
$MailBox = new MailBox($_REQUEST["mailbox"]);
$mailid = vtlib_purify($_REQUEST["mailid"]);
$num = vtlib_purify($_REQUEST["num"]);
$email = new Webmails($MailBox->mbox, $mailid);
$attach_tab = array();
$email->loadMail($attach_tab);
echo "<html><head><title>" . $mod_strings['LBL_ATTACHMENTS'] . "</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $email->charsets . "\">\n";
echo "<script src='modules/Webmails/Webmails.js' type='text/javascript'></script>";
echo "<link REL='SHORTCUT ICON' HREF='include/images/vtigercrm_icon.ico'>";
echo "<style type='text/css'>@import url('{$theme_path}');</style>";
echo "</head><body>";
echo "<table class='small' width='100%' cellspacing='1' cellpadding='0' border='0' style='font-size:18px'>";
echo "<tr><td><table border=0 cellspacing=0 cellpadding=0 width=100% class='mailClientWriteEmailHeader'><tr><td >" . $mod_strings['LBL_ATTACHMENTS'] . "</td></tr></table></td></tr>";
if (count($email->attname) <= 0) {
    echo "<tr align='center'><td nowrap>" . $mod_strings['LBL_NO_ATTACHMENTS'] . "</td></tr>";
} else {
    for ($i = 0; $i < count($email->attname); $i++) {
        $attachment_links .= "&nbsp;&nbsp;&nbsp;&nbsp;" . $email->anchor_arr[$i] . $email->attname[$i] . "</a></br>";
    }
    echo "<tr><td><table class='small' width='100%' cellspacing='1' cellpadding='0' border='0' style='font-size:13px'><tr><td width='90%'>" . $mod_strings['LBL_THERE_ARE'] . " " . count($email->attname) . " " . $mod_strings['LBL_ATTACHMENTS_TO_CHOOSE'] . ":</td></tr><br>";