Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.147.77.51
<?php
class send_mail
{
function __construct($aobj_context)
{
session_start();
$this->user_id = $_SESSION['user_id'];
$this->user_id=empty($this->user_id)?1:$this->user_id;
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->aobj_context=$aobj_context;
require_once($aobj_context->main_src."/src/cmailer_new.php");
}
function SendManualMail($to,$subject,$message,$replay_to=null,$cc=null,$bcc=null,$attachment_arr=null)
{
$body_msg= mysql_escape_string($message);
$cc_arr=explode(",",$cc);
$unique_mail_arr=array();
if(count($cc_arr)>0)
{
foreach($cc_arr as $v)
{
if(!empty($v) && !in_array($v,$unique_mail_arr))
{
$larr_mail_cc[$cc_cnt]['email']=$v;
$cc_cnt++;
array_push($unique_mail_arr,$v);
}
}
}
$attachment=$attachment_arr[attachment_path];
$attachment_name=$attachment_arr[attachment_name];
$new_cc=implode($unique_mail_arr,",");
$insert_qry="insert into out_box_mails(to_mail,cc_mail,SUBJECT,body,send_mail,attachment_name,attachment_path,created_by,created_date)
values('{$to}','{$new_cc}','{$subject}','{$body_msg}','0','{$attachment_name}','{$attachment}',{$this->user_id},now())
";
//echo "<pre>". $insert_qry; die();
$obj_qry = $this->aobj_context->mobj_db->Execute($insert_qry);
return;
/* $cc_cnt=0;
$to_arr=explode(",",$to);
$i=0;
$unique_mail_arr=array();
foreach($to_arr as $v)
{
if(!in_array($v,$unique_mail_arr))
{
$larr_mail_to[$i]['email']=$v;
$i++;
array_push($unique_mail_arr,$v);
}
}
$cc_arr=explode(",",$cc);
if(count($cc_arr)>0)
{
foreach($cc_arr as $v)
{
if(!empty($v) && !in_array($v,$unique_mail_arr))
{
$larr_mail_cc[$cc_cnt]['email']=$v;
$cc_cnt++;
array_push($unique_mail_arr,$v);
}
}
}
//$larr_mail_bcc[0]['email']="natesha.s@tarkasoft.com";
$message=str_ireplace("\n","<br>",$message);
$mailer_info['subject'] =$subject ;
$mailer_info['to'] = $larr_mail_to;
if(count($larr_mail_cc)>0)
$mailer_info['cc'] = $larr_mail_cc;
$mailer_info['from']['email'] = "GEretiralsquery@ramco.com";
$mailer_info['from']['name'] = "Pf Helpdesk";
$mailer_info['body'] =$message ;
if(!empty($attachment_arr))
$mailer_info['attachments'] =$attachment_arr;
//echo "<pre>".print_r($mailer_info); die();
try
{
$obj_mailer = new CMailer($mailer_info);
$cnt=($obj_mailer->send_mail());
$data="Your Meassage has been submitted,We will get back to you soon..({$cnt})";
//echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
}
catch (Exception $e)
{
$data="Failed to send message". $e->getMessage();
//echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
} */
}
}
?>
|