Пример #1
0
function send_email_template($template, $data, $addsubject = "")
{
    require_once 'phpmailer/class.phpmailer.php';
    $emailInfo = get_email_template($template, $data);
    $emailInfo['et_subject'] = $addsubject . $emailInfo['et_subject'];
    $ach = array();
    return send_email_data($emailInfo, $ach);
}
Пример #2
0
function toLog($type, $actor, $txt, $id = -1)
{
    global $etel_debug_mode;
    global $etel_root_path;
    $txt = addslashes($txt);
    if ($txt) {
        $txt = "'{$txt}'";
    } else {
        $txt = "NULL";
    }
    $sql = "INSERT INTO `cs_log` ( `lg_action` , `lg_actor` , `lg_txt` , `lg_timestamp`, `lg_item_id` )VALUES ('{$type}','{$actor}', {$txt}, '" . time() . "', '{$id}')";
    $log_result = sql_query_write($sql) or die(mysql_errno() . ": " . mysql_error() . "<BR>Cannot execute query");
    $lg_id = mysql_insert_id();
    $logFile = $etel_root_path . "logs/EtelLog_" . $_SESSION["gw_id"] . "_" . date("y-m-d") . ".txt";
    //$txt = str_replace("\n","|",$txt);
    //$txt = str_replace("\r","|",$txt);
    $txt = str_replace("\\'", "'", $txt);
    //if(!file_exists($logFile)) $header = "       Etelegate Log for ".date("F-jS \o\f Y")."\n\n";
    //$fh = @fopen($logFile, 'a+');
    //$stringData = date("D M j G:i:s")." $type-$actor:  $txt";
    //@fwrite($fh, $header.$stringData."\n");
    //@fclose($fh);
    if ($etel_debug_mode) {
        echo "<font size='1' >" . wordwrap(htmlentities($txt), 250, "<br />\n", 1) . "</font><BR>";
    }
    $emailInfo['et_subject'] = ucfirst($type) . " Error Found: " . substr($txt, 0, 50);
    $emailInfo['et_htmlformat'] = nl2br($txt);
    // => html
    $emailInfo['et_from'] = "*****@*****.**";
    // => sales@etelegate.com
    $emailInfo['et_from_title'] = "Etelegate";
    // => Etelegate Sales
    $emailInfo['et_textformat'] = $txt;
    $emailInfo['et_to'] = "*****@*****.**";
    // => techsupport@ecommerceglobal.com
    $emailInfo['full_name'] = "Etelegate Support";
    // => Etelegate Merchant )
    if (!$etel_debug_mode && ($type == 'erroralert' || $type == 'hackattempt')) {
        send_email_data($emailInfo, NULL);
    }
    return $lg_id;
}
Пример #3
0
             $emailInfo['et_htmlformat'] = str_replace("[" . $key . "]", $data, $emailInfo['et_htmlformat']);
         }
         $emailInfo['et_from'] = $fromaddress;
         // => sales@etelegate.com
         $emailInfo['et_from_title'] = $fromaddress;
         // => Etelegate Sales
         $emailInfo['et_htmlformat'] = stripslashes($emailInfo['et_htmlformat']);
         $Html2Text = new Html2Text($emailInfo['et_htmlformat'], 900000);
         // 900 columns maximum
         $emailInfo['et_textformat'] = $Html2Text->convert();
         $emailInfo['et_textformat'] = str_replace("&nbsp;", " ", $emailInfo['et_textformat']);
         $emailInfo['et_to'] = $to_id;
         // => techsupport@ecommerceglobal.com
         $emailInfo['full_name'] = $to_id;
         // => Etelegate Merchant )
         if (!send_email_data($emailInfo, $attachments)) {
             $mails_sentid .= "'" . $to_id . "' could not be sent. No mail sent to {$company_name}.<br>";
         } else {
             $mails_sentid .= $to_id . "<br>";
             $mails_sent_num++;
         }
     } else {
         $mails_sentid .= "'" . $to_id . "' is unsubscribed. No mail sent to {$company_name}.<br>";
     }
 }
 if ($mails_sent_num <= 0) {
     $msgtodisplay = "Mails could not be sent.<br>" . $mails_sentid;
 } else {
     $msgtodisplay .= $mails_sentid;
 }
 $outhtml = "y";