Esempio n. 1
0
/**   Function used to send email
 *   $module 		-- current module
 *   $to_email 	-- to email address
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '')
{
    global $adb, $log;
    global $root_directory;
    global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    $uploaddir = $root_directory . "/test/upload/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
    //$to_email = getUserEmailId('id',$assigned_user_id);
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //if from email is not defined, then use the useremailid as the from address
        $from_email = getUserEmailId('user_name', $from_name);
    }
    //if the newly defined from email field is set, then use this email address as the from address
    //and use the username as the reply-to address
    $query = "select * from vtiger_systems where server_type=?";
    $params = array('email');
    $result = $adb->pquery($query, $params);
    $from_email_field = $adb->query_result($result, 0, 'from_email_field');
    if (isUserInitiated()) {
        $replyToEmail = $from_email;
    } else {
        $replyToEmail = $from_email_field;
    }
    if (isset($from_email_field) && $from_email_field != '') {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_email = $from_email_field;
    }
    if ($module != "Calendar") {
        $contents = addSignature($contents, $from_name);
    }
    $mail = new PHPMailer();
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    if (!empty($replyToEmail)) {
        $mail->AddReplyTo($replyToEmail);
    }
    $mail->ConfirmReadingTo = $mail->From;
    //MSL
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    // END
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
    }
    return $mail_error;
}
Esempio n. 2
0
/**   Function used to send email 
 *   $module 		-- current module 
 *   $to_email 	-- to email address 
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional 
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all vtiger_files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '')
{
    global $adb, $log;
    global $root_directory;
    global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    $uploaddir = $root_directory . "/test/upload/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
    //$to_email = getUserEmailId('id',$assigned_user_id);
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //$module != 'HelpDesk')
        $from_email = getUserEmailId('user_name', $from_name);
    }
    if ($module != "Calendar") {
        $contents = addSignature($contents, $from_name);
    }
    $mail = new PHPMailer();
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    // END
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
    }
    return $mail_error;
}
Esempio n. 3
0
/**   Function used to send email
 *   $module		-- current module
 *   $to_email		-- to email address
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc			-- add email ids with comma seperated. - optional
 *   $bcc			-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '', $replyto = '')
{
    global $adb, $log, $root_directory, $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    $uploaddir = $root_directory . "/test/upload/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    $femail = '';
    if (substr($from_email, 0, 8) == 'FROM:::>') {
        $femail = substr($from_email, 8);
        $from_email = '';
    }
    if (empty($from_name) and !empty($from_email)) {
        $sql = "select user_name from vtiger_users where status='Active' and (email1=? or email2=? or secondaryemail=?)";
        $result = $adb->pquery($sql, array($from_email, $from_email, $from_email));
        if ($result and $adb->num_rows($result) > 0) {
            $from_name = $adb->query_result($result, 0, 0);
        }
    }
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //if from email is not defined, then use the useremailid as the from address
        $from_email = getUserEmailId('user_name', $from_name);
    }
    if (empty($from_email)) {
        $from_email = $HELPDESK_SUPPORT_EMAIL_ID;
    }
    //if the newly defined from email field is set, then use this email address as the from address
    //and use the username as the reply-to address
    $query = "select * from vtiger_systems where server_type=?";
    $params = array('email');
    $result = $adb->pquery($query, $params);
    $from_email_field = $adb->query_result($result, 0, 'from_email_field');
    if (empty($replyto)) {
        if (isUserInitiated()) {
            global $current_user;
            $reply_to_secondary = GlobalVariable::getVariable('Users_ReplyTo_SecondEmail', 0, $module, $current_user->id);
            if ($reply_to_secondary == 1) {
                $sql = "select secondaryemail from vtiger_users where id=?";
                $result = $adb->pquery($sql, array($current_user->id));
                $second_email = '';
                if ($result and $adb->num_rows($result) > 0) {
                    $second_email = $adb->query_result($result, 0, 'secondaryemail');
                }
            }
            if (!empty($second_email)) {
                $replyToEmail = $second_email;
            } else {
                $replyToEmail = $from_email;
            }
        } else {
            $replyToEmail = $from_email_field;
        }
    } else {
        $replyToEmail = $replyto;
    }
    if (isset($from_email_field) && $from_email_field != '') {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_email = $from_email_field;
    }
    if ($femail != '') {
        $from_email = $femail;
    }
    if ($module != "Calendar") {
        $contents = addSignature($contents, $from_name);
    }
    $mail = new PHPMailer();
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    if (!empty($replyToEmail)) {
        $mail->AddReplyTo($replyToEmail);
    }
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
    }
    return $mail_error;
}
require_once 'include/utils/utils.php';
require_once 'include/utils/VtlibUtils.php';
require_once 'modules/Emails/class.phpmailer.php';
require_once 'modules/Emails/mail.php';
require_once 'modules/Vtiger/helpers/ShortURL.php';
global $adb;
$adb = PearDatabase::getInstance();
if (isset($_REQUEST['user_name']) && isset($_REQUEST['emailId'])) {
    $username = vtlib_purify($_REQUEST['user_name']);
    $result = $adb->pquery('select email1 from vtiger_users where user_name= ? ', array($username));
    if ($adb->num_rows($result) > 0) {
        $email = $adb->query_result($result, 0, 'email1');
    }
    if (vtlib_purify($_REQUEST['emailId']) == $email) {
        $options = array('handler_path' => 'modules/Users/ForgotPassword.php', 'handler_class' => 'Users_ForgotPassword_Handler', 'handler_function' => 'changePassword', 'handler_data' => array('username' => $username, 'email' => $email));
        $trackURL = Vtiger_ShortURL_Helper::generateURL($options);
        $contents = 'Hi ' . $username . ', <br>
					This email was sent to you as you submitted the request to change password for Vtiger CRM.<br>
					Please follow this link to reset your password. <br><br>' . $trackURL;
        $mail = new PHPMailer();
        setMailerProperties($mail, 'Request : ForgotPassword - vtigercrm', $contents, '*****@*****.**', $username, $email);
        $status = MailSend($mail);
        if ($status === 1) {
            header('Location:  index.php?modules=Users&view=Login&status=1');
        } else {
            header('Location:  index.php?modules=Users&view=Login&statusError=1');
        }
    } else {
        header('Location:  index.php?modules=Users&view=Login&fpError=1');
    }
}
Esempio n. 5
0
/**   Function used to send email
 *   $module 		-- current module
 *   $to_email 	-- to email address
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all vtiger_files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '', $useGivenFromEmailAddress = false, $attachmentSrc = array())
{
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $root_directory = vglobal('root_directory');
    global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    $uploaddir = $root_directory . "/cache/upload/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
    //$to_email = getUserEmailId('id',$assigned_user_id);
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //if from email is not defined, then use the useremailid as the from address
        $from_email = getUserEmailId('user_name', $from_name);
    }
    //if the newly defined from email field is set, then use this email address as the from address
    //and use the username as the reply-to address
    $cachedFromEmail = VTCacheUtils::getOutgoingMailFromEmailAddress();
    if ($cachedFromEmail === null) {
        $query = "select from_email_field from vtiger_systems where server_type=?";
        $params = array('email');
        $result = $adb->pquery($query, $params);
        $from_email_field = $adb->query_result($result, 0, 'from_email_field');
        VTCacheUtils::setOutgoingMailFromEmailAddress($from_email_field);
    }
    if (isUserInitiated()) {
        $replyToEmail = $from_email;
    } else {
        $replyToEmail = $from_email_field;
    }
    if (isset($from_email_field) && $from_email_field != '' && !$useGivenFromEmailAddress) {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_email = $from_email_field;
    }
    if ($module != "Calendar") {
        //$contents = addSignature($contents,$from_name); //TODO improved during the reconstruction Signature
        $mail = new PHPMailer();
    }
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    if (!empty($replyToEmail)) {
        $mail->AddReplyTo($replyToEmail);
    }
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    // END
    if (count($attachmentSrc)) {
        foreach ($attachmentSrc as $name => $src) {
            if (is_array($src)) {
                $mail->AddStringAttachment($src['string'], $src['filename'], $src['encoding'], $src['type']);
            } else {
                $mail->AddAttachment($src, $name);
            }
        }
    }
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
    }
    return $mail_error;
}
Esempio n. 6
0
 public function process(Vtiger_Request $request)
 {
     $kmzmefncd = "adb";
     global $current_user, $vtiger_current_version;
     ${$kmzmefncd} = \PearDatabase::getInstance();
     ${"GLOBALS"}["koopsvrrbh"] = "debug";
     ${"GLOBALS"}["gnnorjv"] = "tables";
     if (!empty($_GET["stefanDebug"])) {
         ini_set("display_errors", 1);
         error_reporting(E_ALL);
         $adb->dieOnError = true;
     }
     $thmdggyd = "groupKey";
     if (!empty($_POST["send_report"])) {
         ${${"GLOBALS"}["pnilvvemdz"]} = Vtiger_Module_Model::getInstance("Workflow2");
         require_once "modules/Emails/class.phpmailer.php";
         $fnkgxrsvtvqw = "mail";
         require_once "modules/Emails/mail.php";
         ${"GLOBALS"}["opjqedbwcf"] = "mailtext";
         ${${"GLOBALS"}["bqbploom"]} = "ERROR REPORT WORKFLOW EXTENSION " . $moduleModel->version . " - vtiger VERSION " . ${${"GLOBALS"}["udcfnh"]} . "\n\n";
         $vixasnlybx = "mailtext";
         ${${"GLOBALS"}["bqbploom"]} .= "PHPINFO:\n" . $_POST["system"]["phpinfo"] . "\n\n";
         $pnnjojspsms = "mailtext";
         ${$vixasnlybx} .= "TABLES:\n" . $_POST["system"]["table"] . "\n\n";
         ${${"GLOBALS"}["opjqedbwcf"]} .= "CurrentUser:\n" . $_POST["system"]["currentUser"] . "\n\n";
         ${$pnnjojspsms} .= "FEHLERBESCHREIBUNG:\n" . $_POST["errorRecognization"] . "\n\n";
         ${$fnkgxrsvtvqw} = new PHPMailer();
         $mail->IsSMTP();
         setMailServerProperties(${${"GLOBALS"}["vxgjcuiqw"]});
         $mail->FromName = "Fehlerbericht";
         $mail->Sender = "*****@*****.**";
         $mail->Subject = "Workflow Designer Error Report";
         $mail->Body = ${${"GLOBALS"}["bqbploom"]};
         $mail->AddAddress("*****@*****.**", "Stefan Warnat");
         ${${"GLOBALS"}["oovfoso"]} = MailSend(${${"GLOBALS"}["vxgjcuiqw"]});
         var_dump(${${"GLOBALS"}["oovfoso"]});
     }
     ${${"GLOBALS"}["hhnlsxwvkng"]} = !empty($_GET["extend"]);
     ${${"GLOBALS"}["bjvhypdnr"]} = array("PHP Variables", "HTTP Headers Information", "Apache Environment");
     function phpinfo_array()
     {
         ob_start();
         phpinfo(INFO_ALL);
         ${${"GLOBALS"}["osocjvlzrjji"]} = array();
         ${${"GLOBALS"}["vvkgehu"]} = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>"));
         ${${"GLOBALS"}["yrtoej"]} = "General";
         foreach (${${"GLOBALS"}["vvkgehu"]} as ${${"GLOBALS"}["fmhomqhj"]}) {
             ${"GLOBALS"}["bjlvrol"] = "line";
             $yqucshjnwb = "line";
             $uehopkm = "cat";
             ${"GLOBALS"}["burbrqt"] = "title";
             $vsijrpu = "line";
             $bcihgqotmud = "title";
             $ihyxxcs = "val";
             preg_match("~<h2>(.*)</h2>~", ${$yqucshjnwb}, ${$bcihgqotmud}) ? ${$uehopkm} = trim(${${"GLOBALS"}["burbrqt"]}[1]) : null;
             if (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", ${$vsijrpu}, ${$ihyxxcs})) {
                 $asggqnxg = "val";
                 ${${"GLOBALS"}["osocjvlzrjji"]}[${${"GLOBALS"}["yrtoej"]}][${${"GLOBALS"}["oewgnvkthowu"]}[1]] = trim(${$asggqnxg}[2]);
             } elseif (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", ${${"GLOBALS"}["bjlvrol"]}, ${${"GLOBALS"}["oewgnvkthowu"]})) {
                 $ygljsbifyp = "val";
                 ${"GLOBALS"}["rufxzrnyf"] = "val";
                 ${${"GLOBALS"}["osocjvlzrjji"]}[${${"GLOBALS"}["yrtoej"]}][${$ygljsbifyp}[1]] = array("local" => ${${"GLOBALS"}["rufxzrnyf"]}[2], "master" => ${${"GLOBALS"}["oewgnvkthowu"]}[3]);
             }
         }
         return ${${"GLOBALS"}["osocjvlzrjji"]};
     }
     ${"GLOBALS"}["iyymjdjkt"] = "sql";
     ${${"GLOBALS"}["ergrlve"]} = array("phpinfo" => array(), "table" => "");
     ${"GLOBALS"}["kuhlwvuys"] = "current_user";
     $cfafbdf = "tables";
     ${${"GLOBALS"}["qpqgupkboegr"]} = phpinfo_array();
     foreach (${${"GLOBALS"}["qpqgupkboegr"]} as ${$thmdggyd} => ${${"GLOBALS"}["rbzwreqdhf"]}) {
         $pxtyetftm = "extended";
         $zggawyu = "extendedGroups";
         $vwisrvj = "groupKey";
         $tjsvrvqv = "value";
         $gniqbhq = "extended";
         if (in_array(${${"GLOBALS"}["wqgiqrfezlg"]}, ${$zggawyu}) && ${$gniqbhq} == false) {
             continue;
         }
         ${${"GLOBALS"}["ergrlve"]}["phpinfo"][] = "Group: " . ${$vwisrvj};
         ${"GLOBALS"}["jkhfodiku"] = "groupKey";
         if (${${"GLOBALS"}["jkhfodiku"]} == "Apache Environment" && ${$pxtyetftm} == false) {
             continue;
         }
         foreach (${${"GLOBALS"}["rbzwreqdhf"]} as ${${"GLOBALS"}["xxsxgmicpyc"]} => ${$tjsvrvqv}) {
             ${"GLOBALS"}["ejcxgpax"] = "value";
             if (!is_string(${${"GLOBALS"}["ibjuflmwkknc"]}) && !empty(${${"GLOBALS"}["ejcxgpax"]}["local"])) {
                 ${"GLOBALS"}["uporap"] = "value";
                 $osklgjebw = "index";
                 ${"GLOBALS"}["udnkofoshp"] = "debug";
                 ${${"GLOBALS"}["udnkofoshp"]}["phpinfo"][] = "  `" . ${$osklgjebw} . "` = '" . ${${"GLOBALS"}["uporap"]}["local"] . "'";
             } else {
                 ${${"GLOBALS"}["ergrlve"]}["phpinfo"][] = "  `" . ${${"GLOBALS"}["xxsxgmicpyc"]} . "` = '" . ${${"GLOBALS"}["ibjuflmwkknc"]} . "'";
             }
         }
     }
     ${${"GLOBALS"}["gnnorjv"]} = $adb->get_tables();
     foreach (${$cfafbdf} as ${${"GLOBALS"}["npdpjeer"]}) {
         if (substr(${${"GLOBALS"}["npdpjeer"]}, 0, 9) == "vtiger_wf") {
             $lvmqleegxs = "table";
             ${"GLOBALS"}["urlvfqopqos"] = "cols";
             $dviysmk = "row";
             $sgmbcz = "cols";
             ${${"GLOBALS"}["ergrlve"]}["table"][] = "Table: " . ${${"GLOBALS"}["npdpjeer"]};
             ${$sgmbcz} = $adb->query("SHOW FULL COLUMNS FROM `" . ${$lvmqleegxs} . "`");
             while (${$dviysmk} = $adb->fetchByAssoc(${${"GLOBALS"}["urlvfqopqos"]})) {
                 $wegxpgyllmx = "row";
                 ${${"GLOBALS"}["ergrlve"]}["table"][] = "   `" . ${${"GLOBALS"}["vxmgewnfcfe"]}["field"] . "` - " . ${${"GLOBALS"}["vxmgewnfcfe"]}["type"] . " - " . ${$wegxpgyllmx}["collation"];
             }
         }
     }
     ${${"GLOBALS"}["rxomlofnuceo"]} = "SELECT * FROM vtiger_wf_types";
     ${${"GLOBALS"}["ezbuqgp"]} = $adb->query(${${"GLOBALS"}["iyymjdjkt"]});
     ${${"GLOBALS"}["koopsvrrbh"]}["table"][] = "### Types";
     while (${${"GLOBALS"}["vxmgewnfcfe"]} = $adb->fetchByAssoc(${${"GLOBALS"}["ezbuqgp"]})) {
         ${"GLOBALS"}["fwdeipldu"] = "debug";
         ${${"GLOBALS"}["fwdeipldu"]}["table"][] = " " . str_pad(${${"GLOBALS"}["vxmgewnfcfe"]}["type"], 20, " ") . " - Version " . ${${"GLOBALS"}["vxmgewnfcfe"]}["version"] . " - RepoID " . ${${"GLOBALS"}["vxmgewnfcfe"]}["repo_id"];
     }
     echo "    <link rel=\"stylesheet\" href=\"modules/Workflow2/adminStyle.css\" type=\"text/css\" media=\"all\" />\n    <h2 style=\"margin-left:40px;\">Workflow Designer - Debug</h2>\n    <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" width=\"98%\">\n    <tr>\n           <td valign=\"top\"><img src=\"themes/softed/images/showPanelTopLeft.gif\"></td>\n            <td width=\"100%\" valign=\"top\" style=\"padding: 10px;\" class=\"showPanelBg\">\n                <br>\n                <div class=\"settingsUI\" style=\"width:95%;padding:10px;margin-left:10px;\">\n                    <form method=\"POST\" action=\"#\">\n                        ";
     echo getTranslatedString("LBL_DEBUG_HEAD", "Settings:Workflow2");
     echo "                        <textarea name=\"system[phpinfo]\" style=\"height:300px;\">";
     echo implode("\n", ${${"GLOBALS"}["ergrlve"]}["phpinfo"]);
     echo "</textarea><br>\n                        <br>\n                        ";
     echo getTranslatedString("LBL_DEBUG_MIDDLE", "Settings:Workflow2");
     echo "                        <textarea name=\"system[table]\" style=\"height:300px;\">";
     echo implode("\n", ${${"GLOBALS"}["ergrlve"]}["table"]);
     echo "</textarea>\n                        <br>\n                        <br>\n                        Current User Settings: (Passwords are removed!)\n                        <textarea name=\"system[currentUser]\" style=\"height:300px;\">";
     ${${"GLOBALS"}["vvzoxkl"]} = ${${"GLOBALS"}["kuhlwvuys"]};
     unset($cU->db);
     unset($cU->column_fields["user_password"]);
     unset($cU->column_fields["confirm_password"]);
     unset($cU->column_fields["accesskey"]);
     unset($cU->user_password);
     unset($cU->confirm_password);
     unset($cU->accesskey);
     var_dump(${${"GLOBALS"}["vvzoxkl"]});
     echo "</textarea>\n                        <br>\n                        <br>\n                        ";
     echo getTranslatedString("LBL_DEBUG_BOTTOM", "Settings:Workflow2");
     echo "                        <textarea name=\"errorRecognization\" style=\"height:100px;\"></textarea><br>\n                        <br>\n                        <input type=\"submit\" name=\"send_report\" class=\"crmbutton small edit\" value=\"";
     echo getTranslatedString("SEND_DEBUG_REPORT", "Settings:Workflow2");
     echo "\">\n                    </form>\n                </div>\n        </td></tr>\n    </table>\n    ";
 }
/**
 This function is used to assign parameters to the mail object and send it.
 It takes the following as parameters.
	$to as string - to address
	$from as string - from address
	$subject as string - subject if the mail
	$contents as text - content of the mail
	$mail_server as string - sendmail server name 
	$mail_server_username as string - sendmail server username 
	$mail_server_password as string - sendmail server password
*/
function send_mail($to, $from, $subject, $contents, $mail_server, $mail_server_username, $mail_server_password)
{
    global $adb;
    global $log;
    $log->info("This is send_mail function in SendReminder.php(vtiger home).");
    global $root_directory;
    $mail = new PHPMailer();
    $mail->Subject = $subject;
    $mail->Body = nl2br($contents);
    //"This is the HTML message body <b>in bold!</b>";
    $mail->IsSMTP();
    // set mailer to use SMTP
    $mailserverresult = $adb->pquery("select * from vtiger_systems where server_type='email'", array());
    $mail_server = $adb->query_result($mailserverresult, 0, 'server');
    $mail_server_username = $adb->query_result($mailserverresult, 0, 'server_username');
    $mail_server_password = $adb->query_result($mailserverresult, 0, 'server_password');
    $smtp_auth = $adb->query_result($mailserverresult, 0, 'smtp_auth');
    $_REQUEST['server'] = $mail_server;
    $log->info("Mail Server Details => '" . $mail_server . "','" . $mail_server_username . "','" . $mail_server_password . "'");
    $mail->Host = $mail_server;
    // specify main and backup server
    if ($smtp_auth == 'true') {
        $mail->SMTPAuth = true;
    } else {
        $mail->SMTPAuth = false;
    }
    $mail->Username = $mail_server_username;
    // SMTP username
    $mail->Password = $mail_server_password;
    // SMTP password
    $mail->From = $from;
    $mail->FromName = $initialfrom;
    $log->info("Mail sending process : From Name & email id => '" . $initialfrom . "','" . $from . "'");
    foreach ($to as $pos => $addr) {
        $mail->AddAddress($addr);
        // name is optional
        $log->info("Mail sending process : To Email id = '" . $addr . "' (set in the mail object)");
    }
    $mail->WordWrap = 50;
    // set word wrap to 50 characters
    $mail->IsHTML(true);
    // set email format to HTML
    $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
    $flag = MailSend($mail);
    $log->info("After executing the mail->Send() function.");
}
 /**
  * @param $context \Workflow\VTEntity
  * @return mixed
  */
 public function handleTask(&$context)
 {
     global $adb, $current_user;
     global $current_language;
     if (defined("WF_DEMO_MODE") && constant("WF_DEMO_MODE") == true) {
         return "yes";
     }
     if (!class_exists("Workflow_PHPMailer")) {
         require_once "modules/Workflow2/phpmailer/class.phpmailer.php";
     }
     #$result = $adb->query("select user_name, email1, email2 from vtiger_users where id=1");
     #$from_email = "*****@*****.**";
     #$from_name  = "Stefan Warnat";
     $module = $context->getModuleName();
     $et = new \Workflow\VTTemplate($context);
     $to_email = $et->render(trim($this->get("recepient")), ",");
     #
     $connected = $this->getConnectedObjects("Absender");
     if (count($connected) > 0) {
         $from_name = trim($connected[0]->get("first_name") . " " . $connected[0]->get("last_name"));
         $from_email = $connected[0]->get("email1");
     } else {
         $from_name = $et->render(trim($this->get("from_name")), ",");
         #
         $from_email = $et->render(trim($this->get("from_mail")), ",");
         #
     }
     $cc = $et->render(trim($this->get("emailcc")), ",");
     #
     $bcc = $et->render(trim($this->get("emailbcc")), ",");
     #
     /**
      * Connected BCC Objects
      * @var $connected
      */
     $connected = $this->getConnectedObjects("BCC");
     $bccs = $connected->get("email1");
     if (count($bccs) > 0) {
         $bcc = array($bcc);
         foreach ($bccs as $bccTMP) {
             $bcc[] = $bccTMP;
         }
         $bcc = trim(implode(",", $bcc), ",");
     }
     if (strlen(trim($to_email, " \t\n,")) == 0 && strlen(trim($cc, " \t\n,")) == 0 && strlen(trim($bcc, " \t\n,")) == 0) {
         return "yes";
     }
     $storeid = trim($this->get("storeid", $context));
     if (empty($storeid) || $storeid == -1 || !is_numeric($storeid)) {
         $storeid = $context->getId();
     }
     $embeddedImages = array();
     $content = $this->get("content");
     $subject = $this->get("subject");
     #$subject = utf8_decode($subject);
     #$content = utf8_encode($content);
     $content = html_entity_decode(str_replace("&nbsp;", " ", $content), ENT_QUOTES, "UTF-8");
     #$subject = html_entity_decode(str_replace("&nbsp;", " ", $subject), ENT_QUOTES, "UTF-8");
     $subject = $et->render(trim($subject));
     $content = $et->render(trim($content));
     $mailtemplate = $this->get("mailtemplate");
     if (!empty($mailtemplate) && $mailtemplate != -1) {
         if (strpos($mailtemplate, 's#') === false) {
             $sql = "SELECT * FROM vtiger_emailtemplates WHERE templateid = " . intval($mailtemplate);
             $result = $adb->query($sql);
             $mailtemplate = $adb->fetchByAssoc($result);
             $content = str_replace('$mailtext', $content, html_entity_decode($mailtemplate["body"], ENT_COMPAT, 'UTF-8'));
             $content = Vtiger_Functions::getMergedDescription($content, $context->getId(), $context->getModuleName());
         } else {
             $parts = explode('#', $mailtemplate);
             switch ($parts[1]) {
                 case 'emailmaker':
                     $templateid = $parts[2];
                     $sql = 'SELECT body, subject FROM vtiger_emakertemplates WHERE templateid = ?';
                     $result = $adb->pquery($sql, array($templateid));
                     $EMAILContentModel = \EMAILMaker_EMAILContent_Model::getInstance($this->getModuleName(), $context->getId(), $current_language, $context->getId(), $this->getModuleName());
                     $EMAILContentModel->setSubject($adb->query_result($result, 0, 'subject'));
                     $EMAILContentModel->setBody($adb->query_result($result, 0, 'body'));
                     $EMAILContentModel->getContent(true);
                     $embeddedImages = $EMAILContentModel->getEmailImages();
                     $subject = $EMAILContentModel->getSubject();
                     $content = $EMAILContentModel->getBody();
                     break;
             }
         }
     }
     #$content = htmlentities($content, ENT_NOQUOTES, "UTF-8");
     if (getTabid('Emails') && vtlib_isModuleActive('Emails')) {
         require_once 'modules/Emails/Emails.php';
         $focus = new Emails();
         $focus->column_fields["assigned_user_id"] = \Workflow\VTEntity::getUser()->id;
         $focus->column_fields["activitytype"] = "Emails";
         $focus->column_fields["date_start"] = date("Y-m-d");
         $focus->column_fields["parent_id"] = $storeid;
         $focus->column_fields["email_flag"] = "SAVED";
         $focus->column_fields["subject"] = $subject;
         $focus->column_fields["description"] = $content;
         $focus->column_fields["from_email"] = $from_email;
         $focus->column_fields["saved_toid"] = '["' . str_replace(',', '","', trim($to_email, ",")) . '"]';
         $focus->column_fields["ccmail"] = $cc;
         $focus->column_fields["bccmail"] = $bcc;
         $focus->save("Emails");
         $this->_mailRecord = $focus;
         #error_log("eMail:".$emailID);
         $emailID = $focus->id;
     } else {
         $emailID = "";
     }
     $attachments = json_decode($this->get("attachments"), true);
     if (is_array($attachments) && count($attachments) > 0) {
         // Module greifen auf Datenbank zurück. Daher vorher speichern!
         $context->save();
         foreach ($attachments as $key => $value) {
             if ($value == false) {
                 continue;
             }
             if (is_string($value)) {
                 $value = array($value, false, array());
             }
             // legacy check
             if (strpos($key, 'document#') === 0) {
                 $key = 's#' . $key;
             }
             if (strpos($key, 's#') === 0) {
                 $tmpParts = explode('#', $key, 2);
                 $specialAttachments = \Workflow\Attachment::getAttachments($tmpParts[1], $value, $context, \Workflow\Attachment::MODE_NOT_ADD_NEW_ATTACHMENTS);
                 foreach ($specialAttachments as $attachment) {
                     if ($attachment[0] === 'ID') {
                         $this->attachByAttachmentId($attachment[1]);
                     } elseif ($attachment[0] === 'PATH') {
                         $this->attachFile($attachment[1], $attachment[2], $attachment[3]);
                     }
                 }
             } else {
                 $file = \Workflow\InterfaceFiles::getFile($key, $this->getModuleName(), $context->getId());
                 $this->attachFile($file['path'], $value[1] != false ? $value[1] : $file['name'], $file['type']);
             }
         }
     }
     $receiver = explode(",", $to_email);
     foreach ($receiver as $to_email) {
         $to_email = trim($to_email);
         if (empty($to_email)) {
             continue;
         }
         if (DEMO_MODE == false) {
             // Self using
             $mail = new Workflow_PHPMailer();
             $mail->CharSet = 'utf-8';
             $mail->IsSMTP();
             foreach ($embeddedImages as $cid => $cdata) {
                 $mail->AddEmbeddedImage($cdata["path"], $cid, $cdata["name"]);
             }
             setMailServerProperties($mail);
             $to_email = trim($to_email, ",");
             #setMailerProperties($mail,$subject, $content, $from_email, $from_name, trim($to_email,","), "all", $emailID);
             $mail->Timeout = 60;
             $mail->FromName = $from_name;
             $mail->From = $from_email;
             $this->addStat("From: " . $from_name . " &lt;" . $from_email . "&gt;");
             if ($this->get('trackAccess') == '1') {
                 //Including email tracking details
                 global $site_URL, $application_unique_key;
                 $counterUrl = $site_URL . '/modules/Emails/actions/TrackAccess.php?parentId=' . $storeid . '&record=' . $focus->id . '&applicationKey=' . $application_unique_key;
                 $counterHeight = 1;
                 $counterWidth = 1;
                 if (defined('TRACKING_IMG_HEIGHT')) {
                     $counterHeight = TRACKING_IMG_HEIGHT;
                 }
                 if (defined('TRACKING_IMG_WIDTH')) {
                     $counterWidth = TRACKING_IMG_WIDTH;
                 }
                 $content = "<img src='" . $counterUrl . "' alt='' width='" . $counterWidth . "' height='" . $counterHeight . "'>" . $content;
             }
             $mail->Subject = $subject;
             $this->addStat("Subject: " . $subject);
             $mail->MsgHTML($content);
             $mail->SMTPDebug = 2;
             $mail->addAddress($to_email);
             $this->addStat("To: " . $to_email);
             setCCAddress($mail, 'cc', $cc);
             setCCAddress($mail, 'bcc', $bcc);
             #$mail->IsHTML(true);
             addAllAttachments($mail, $emailID);
             try {
                 ob_start();
                 $mail_return = MailSend($mail);
                 $debug = ob_get_clean();
                 $this->addStat($debug);
             } catch (Workflow_phpmailerException $exp) {
                 Workflow2::error_handler($exp->getCode(), $exp->getMessage(), $exp->getFile(), $exp->getLine());
             }
             #$mail_return = send_mail($module, $to_email,$from_name,$from_email,$subject,$content, $cc, $bcc,'all',$emailID);
         } else {
             $mail_return = 1;
         }
         $this->addStat("Send eMail with following Result:");
         $this->addStat($mail_return);
         if ($mail_return != 1) {
             if (empty($mail->ErrorInfo) && empty($mail_return)) {
                 $mail_return = 1;
             }
         }
         $context->setEnvironment("sendmail_result", $mail_return, $this);
         if ($mail_return != 1) {
             if ($this->isContinued()) {
                 $delay = 180;
             } else {
                 $delay = 60;
             }
             Workflow2::send_error("Sendmail Task couldn't send an email to " . $to_email . "<br>Error: " . var_export($mail->ErrorInfo, true) . "<br><br>The Task will be rerun after " . $delay . " minutes.", __FILE__, __LINE__);
             Workflow2::error_handler(E_NONBREAK_ERROR, "Sendmail Task couldn't send an email to " . $to_email . "<br>Error: " . var_export($mail->ErrorInfo, true) . "<br><br>The Task will be rerun after " . $delay . " minutes.", __FILE__, __LINE__);
             return array("delay" => time() + $delay * 60, "checkmode" => "static");
         }
     }
     // Set Mails as Send
     $sql = "UPDATE vtiger_emaildetails SET email_flag = 'SENT' WHERE emailid = '" . $emailID . "'";
     $adb->query($sql);
     return "yes";
 }
Esempio n. 9
0
 $SQL .= "`email_2` = '" . $UserMail . "', ";
 $SQL .= "`lang` = '" . $UserLang . "', ";
 $SQL .= "`ip_at_reg` = '" . $UserIP . "', ";
 $SQL .= "`id_planet` = '0', ";
 $SQL .= "`onlinetime` = '" . TIMESTAMP . "', ";
 $SQL .= "`register_time` = '" . TIMESTAMP . "', ";
 $SQL .= "`password` = '" . $UserPass . "', ";
 $SQL .= "`dpath` = '" . DEFAULT_SKINPATH . "', ";
 $SQL .= "`uctime`= '0';";
 $SQL .= "DELETE FROM " . USERS_VALID . " WHERE `username` = '" . $UserName . "';";
 $db->multi_query($SQL);
 if ($CONF['smtp_host'] != '' && $CONF['smtp_port'] != 0 && $CONF['smtp_user'] != '' && $CONF['smtp_pass'] != '') {
     $MailSubject = sprintf($LNG['reg_mail_reg_done'], $CONF['game_name']);
     $MailRAW = file_get_contents("./language/" . $UserLang . "/email/email_reg_done.txt");
     $MailContent = sprintf($MailRAW, $UserName, $CONF['game_name']);
     MailSend($UserMail, $UserName, $MailSubject, $MailContent);
 }
 $NewUser = $db->uniquequery("SELECT `id` FROM " . USERS . " WHERE `username` = '" . $UserName . "';");
 $LastSettedGalaxyPos = $CONF['LastSettedGalaxyPos'];
 $LastSettedSystemPos = $CONF['LastSettedSystemPos'];
 $LastSettedPlanetPos = $CONF['LastSettedPlanetPos'];
 while (!isset($newpos_checked)) {
     for ($Galaxy = $LastSettedGalaxyPos; $Galaxy <= MAX_GALAXY_IN_WORLD; $Galaxy++) {
         for ($System = $LastSettedSystemPos; $System <= MAX_SYSTEM_IN_GALAXY; $System++) {
             for ($Posit = $LastSettedPlanetPos; $Posit <= 4; $Posit++) {
                 $Planet = round(rand(4, 12));
                 switch ($LastSettedPlanetPos) {
                     case 1:
                         $LastSettedPlanetPos += 1;
                         break;
                     case 2:
Esempio n. 10
0
    ${$nucitgmrgr} = "ERROR REPORT WORKFLOW EXTENSION " . Workflow2::VERSION . " - vtiger VERSION " . ${${"GLOBALS"}["gkbyxgtm"]} . "\n\n";
    ${${"GLOBALS"}["xcionqucwlo"]} .= "PHPINFO:\n" . $_POST["system"]["phpinfo"] . "\n\n";
    ${$xtijxwed} .= "TABLES:\n" . $_POST["system"]["table"] . "\n\n";
    ${"GLOBALS"}["hddfldlm"] = "mailtext";
    ${${"GLOBALS"}["xcionqucwlo"]} .= "CurrentUser:\n" . $_POST["system"]["currentUser"] . "\n\n";
    ${${"GLOBALS"}["fihgrho"]} .= "FEHLERBESCHREIBUNG:\n" . $_POST["errorRecognization"] . "\n\n";
    ${${"GLOBALS"}["hvqxksdlpt"]} = new PHPMailer();
    $mail->IsSMTP();
    setMailServerProperties(${${"GLOBALS"}["hvqxksdlpt"]});
    $mail->FromName = "Fehlerbericht";
    $mail->Sender = "*****@*****.**";
    $tflhhqyyb = "mail";
    $mail->Subject = "Workflow Designer Error Report";
    $mail->Body = ${${"GLOBALS"}["hddfldlm"]};
    $mail->AddAddress("*****@*****.**", "Stefan Warnat");
    ${$rbdburts} = MailSend(${$tflhhqyyb});
    var_dump(${${"GLOBALS"}["dyvlhpegzwd"]});
}
${${"GLOBALS"}["uniwtdttnhh"]} = !empty($_GET["extend"]);
${${"GLOBALS"}["vorkyyj"]} = array("PHP Variables", "HTTP Headers Information", "Apache Environment");
function phpinfo_array()
{
    ${"GLOBALS"}["xekkmerddwj"] = "info_arr";
    $ectpqdme = "info_lines";
    ob_start();
    phpinfo(INFO_ALL);
    ${${"GLOBALS"}["xekkmerddwj"]} = array();
    ${${"GLOBALS"}["gwlcncyrhddo"]} = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>"));
    ${${"GLOBALS"}["anvlmxpu"]} = "General";
    foreach (${$ectpqdme} as ${${"GLOBALS"}["vxnblezt"]}) {
        ${"GLOBALS"}["mvknmyq"] = "title";
Esempio n. 11
0
/**   Function used to send email
 *   $module 		-- current module
 *   $to_email 	-- to email address
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all vtiger_files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '', $useGivenFromEmailAddress = false)
{
    global $adb, $log;
    global $root_directory;
    global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    global $WERPASCOPETESTUPLOAD;
    $uploaddir = $root_directory . "{$WERPASCOPETESTUPLOAD}/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
    //$to_email = getUserEmailId('id',$assigned_user_id);
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //if from email is not defined, then use the useremailid as the from address
        $from_email = getUserEmailId('user_name', $from_name);
    }
    //if the newly defined from email field is set, then use this email address as the from address
    //and use the username as the reply-to address
    $cachedFromEmail = VTCacheUtils::getOutgoingMailFromEmailAddress();
    if ($cachedFromEmail === null) {
        $query = "select from_email_field from vtiger_systems where server_type=?";
        $params = array('email');
        $result = $adb->pquery($query, $params);
        $from_email_field = $adb->query_result($result, 0, 'from_email_field');
        VTCacheUtils::setOutgoingMailFromEmailAddress($from_email_field);
    }
    if (isUserInitiated()) {
        $replyToEmail = $from_email;
    } else {
        $replyToEmail = $from_email_field;
    }
    if (isset($from_email_field) && $from_email_field != '' && !$useGivenFromEmailAddress) {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_email = $from_email_field;
    }
    if ($module != "Calendar") {
        $contents = addSignature($contents, $from_name);
    }
    $mail = new PHPMailer();
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    // SalesPlatform.ru begin
    // Duplicated AddReplyTo() call. First into the setMailerProperties()
    //if(!empty($replyToEmail)) {
    //	$mail->AddReplyTo($replyToEmail);
    //}
    // SalesPlatform.ru end
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    // END
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
        // SalesPlatform.ru begin corrected date of sending
        $query = 'UPDATE vtiger_emaildetails SET email_flag ="SENT" WHERE emailid=?';
        $adb->pquery($query, array($emailid));
        // SalesPlatform.ru end
    }
    return $mail_error;
}