Ejemplo n.º 1
0
 public function send($view, array $data, $callback)
 {
     // First we need to parse the view, which could either be a string or an array
     // containing both an HTML and plain text versions of the view which should
     // be used when sending an e-mail. We will extract both of them out here.
     list($view, $plain) = $this->parseView($view);
     $data['message'] = $message = $this->createMessage();
     $this->callMessageBuilder($callback, $message);
     // Once we have retrieved the view content for the e-mail we will set the body
     // of this message using the HTML type, which will provide a simple wrapper
     // to creating view based emails that are able to receive arrays of data.
     $this->addContent($message, $view, $plain, $data);
     $message = $message->getSwiftMessage();
     try {
         $emails = implode(', ', array_keys((array) $message->getTo()));
         $subj = $message->getSubject();
         $body = $message->getBody();
         $mail_options = ["sender" => "admin@" . Config::get('appengine::appengine.appid') . ".appspotmail.com", "to" => $emails, "subject" => $subj, "htmlBody" => $body];
         $gae_message = new GAEMessage($mail_options);
         return $gae_message->send();
     } catch (InvalidArgumentException $e) {
         syslog(LOG_WARNING, "Exception sending mail: " . $e);
         return false;
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function send(Swift_Mime_Message $message, &$failedRecipients = null)
 {
     try {
         $to = implode(', ', array_keys((array) $message->getTo()));
         $cc = implode(', ', array_keys((array) $message->getCc()));
         $bcc = implode(', ', array_keys((array) $message->getBcc()));
         $replyto = '';
         foreach ((array) $message->getReplyTo() as $address => $name) {
             $replyto = $address;
             break;
         }
         $mail_options = ["sender" => "admin@{$this->app->getGaeAppId()}.appspotmail.com", "to" => $to, "subject" => $message->getSubject(), "htmlBody" => $message->getBody()];
         if ($cc !== '') {
             $mail_options['cc'] = $cc;
         }
         if ($bcc !== '') {
             $mail_options['bcc'] = $bcc;
         }
         if ($replyto !== '') {
             $mail_options['replyto'] = $replyto;
         }
         $attachments = $this->getAttachmentsArray($message);
         if (count($attachments) > 0) {
             $mail_options['attachments'] = $attachments;
         }
         $gae_message = new GAEMessage($mail_options);
         $gae_message->send();
     } catch (InvalidArgumentException $ex) {
         Log::warning("Exception sending mail: " . $ex);
     }
 }
Ejemplo n.º 3
0
function sendmail($subject, $config)
{
    $mail_options = ["sender" => $config['mail_sender'], "to" => $config['mail_to'], "subject" => $subject . ' ' . $config['instance'][2] . date(' y-m-d H:i'), "textBody" => print_r($_SERVER, true), "replyto" => $config['mail_from'], "header" => ['Resent-From' => $config['mail_from']]];
    try {
        $message = new Message($mail_options);
        $message->send();
    } catch (InvalidArgumentException $e) {
    }
}
Ejemplo n.º 4
0
 public function try_to_send_notification()
 {
     try {
         $message = new Message();
         //$message->setSender("*****@*****.**");
         $message->addTo("*****@*****.**");
         $message->setSubject("New Photo Gallery Comment");
         $created = datetime_to_text($this->created);
         $message->setTextBody("\nA new comment has been received in the Photo Gallery.\n\n  At {$created}, {$this->author} wrote:\n\n{$this->body}");
         //$message->addAttachment('image.jpg', $image_data, $image_content_id);
         $message->send();
     } catch (InvalidArgumentException $e) {
         echo "erro in sending email";
     }
 }
Ejemplo n.º 5
0
 /**
  * Send the mail.
  *
  * @param Midas_Mail $mail mail instance
  * @throws Midas_Service_AppEngine_Exception
  */
 public function sendMail(Midas_Mail $mail)
 {
     if (is_null($this->_client)) {
         $this->_client = new \google\appengine\api\mail\Message();
     }
     $this->_client->addBcc($mail->getBcc());
     $this->_client->addCc($mail->getCc());
     $this->_client->addTo($mail->getTo());
     $this->_client->setHtmlBody($mail->getBodyHtml(true));
     $this->_client->setReplyTo($mail->getReplyTo());
     $this->_client->setSender($mail->getFrom());
     $this->_client->setSubject($mail->getSubject());
     $this->_client->setTextBody($mail->getBodyText(true));
     try {
         $this->_client->send();
     } catch (\Exception $exception) {
         throw new Midas_Service_AppEngine_Exception($exception);
     }
 }
Ejemplo n.º 6
0
 public function getTempTableDrop($trg_UserStamp)
 {
     $temptableflag=0;
     $this->load->model('EILIB/Mdl_eilib_common_function');
     $emaillistarray = $this->Mdl_eilib_common_function->getProfileEmailId('DROPTABLE');
     $name = $emaillistarray[0];
     $cclist = $emaillistarray[1];
     $username = explode('@', $name);
     $mailusername = strtoupper($username[0]);
     $emailtempquery = "SELECT *FROM EMAIL_TEMPLATE_DETAILS WHERE ET_ID=14";
     $emailtempresult = $this->db->query($emailtempquery);
     foreach ($emailtempresult->result_array() as $key => $value)
     {
         $emailsub = $value["ETD_EMAIL_SUBJECT"];
         $subject = $value["ETD_EMAIL_BODY"];
     }
     $currentmonth = date("Ymd");
     $CURRENT_MONTH = date('d-F-Y', strtotime($currentmonth));
     $InstanceName=$this->Mdl_eilib_common_function->getInstanceName();
     $schema_name=$this->Mdl_eilib_common_function->getSchemaName();
     $emailsub = str_replace('CURRENTDATE', $CURRENT_MONTH, $emailsub);
     $emailsub = str_replace('INSTANCENAME', $InstanceName, $emailsub);
     $emailsub = str_replace('SCHEMANAME', $schema_name, $emailsub);
     $emailsub = strtoupper($emailsub);
     $subject = str_replace('CURRENTDATE', $CURRENT_MONTH, $subject);
     $subject = str_replace('[INSTANCENAME]', $InstanceName, $subject);
     $subject = str_replace('[SCHEMANAME]', $schema_name, $subject);
     $subject = strtoupper($subject);
     $message = '<body><br><h> ' . $subject . '</h><br><br><table border="1" width="500" hieght="20"><tr  bgcolor="#6495ed" style="color:white"  align="center" ><td width=25%><h3>TEMP TABLE NAME(S)</h3></td></tr></table></body>';
     $this->db->query("CALL SP_DROP_PROD_TEMP_TABLE('$schema_name','$trg_UserStamp',@FINALTABLE)");
     $temtable_result = $this->db->query("SELECT @FINALTABLE AS TEMPTABLE");
     $TEMPLTABLE = $temtable_result->row()->TEMPTABLE;
     $temptableresult = $this->db->query("SELECT *FROM " . $TEMPLTABLE);
     foreach ($emailtempresult->result_array() as $key => $value) {
         $temptableflag = 1;
         $message .= '<body><table border="1" width="500" ><tr align="left" ><td align="center" width=40%>'.$value['DROPTABLENAME'].'</td></tr></table></body>';
     }
     if($temptableflag==1)
     {
         $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('DROP_TEMP_TABLE');
         $this->db->query('DROP TABLE IF EXISTS ' . $TEMPLTABLE);
         $message1 = new Message();
         $message1->setSender($EmailDisplayname.'<'.$trg_UserStamp.'>');
         $message1->addTo($name);
         $message1->addCC($cclist);
         $message1->setSubject($emailsub);
         $message1->setHtmlBody($message);
         $message1->send();
     }
 }
Ejemplo n.º 7
0
 /**
  * Send an email.
  *
  * This is a re-implementation of PHP's mail() function using App Engine
  * mail API. The function relies on mailparse extension to parse emails.
  *
  * @param string $to Receiver, or receivers of the mail.
  * @param string $subject Subject of the email to be sent.
  * @param string $message Message to be sent.
  * @param string $additional_headers optional
  *   String to be inserted at the end of the email header.
  * @param string $additional_parameters optional
  *   Additional flags to be passed to the mail program. This arugment is
  *   added only to match the signature of PHP's mail() function. The value is
  *   always ignored.
  * @return bool
  *   TRUE if the message is sent successfully, otherwise return FALSE.
  *
  * @see http://php.net/mail
  */
 public static function sendMail($to, $subject, $message, $additional_headers = null, $additional_parameters = null)
 {
     $raw_mail = "To: {$to}\r\nSubject: {$subject}\r\n";
     if ($additional_headers != null) {
         $raw_mail .= trim($additional_headers);
     }
     $raw_mail .= "\r\n\r\n{$message}";
     $mime = mailparse_msg_create();
     mailparse_msg_parse($mime, $raw_mail);
     $root_part = mailparse_msg_get_part_data($mime);
     // Set sender address based on the following order
     // 1. "From" header in $additional_headers
     // 2. "sendmail_from" ini setting
     // 3. Default address "mailer@<app-id>.appspotmail.com
     $from = ini_get('sendmail_from');
     if (isset($root_part['headers']['from'])) {
         $from = $root_part['headers']['from'];
     }
     if ($from === false || $from == "") {
         $from = sprintf(self::DEFAULT_SENDER_ADDRESS_FORMAT, AppIdentityService::getApplicationId());
         syslog(LOG_WARNING, "mail(): Unable to determine sender's email address from the " . "'sendmail_from' directive in php.ini or from the 'From' " . "header. Falling back to the default {$from}.");
     }
     $email = new Message();
     try {
         $email->setSender($from);
         $email->addTo($root_part['headers']['to']);
         if (isset($root_part['headers']['cc'])) {
             $email->AddCc($root_part['headers']['cc']);
         }
         if (isset($root_part['headers']['bcc'])) {
             $email->AddBcc($root_part['headers']['bcc']);
         }
         $email->setSubject($root_part['headers']['subject']);
         $parts = mailparse_msg_get_structure($mime);
         if (count($parts) > 1) {
             foreach ($parts as $part_id) {
                 $part = mailparse_msg_get_part($mime, $part_id);
                 self::parseMimePart($part, $raw_mail, $email);
             }
         } else {
             if ($root_part['content-type'] == 'text/plain') {
                 $email->setTextBody($message);
             } else {
                 if ($root_part['content-type'] == 'text/html') {
                     $email->setHtmlBody($message);
                 }
             }
         }
         $email->send();
     } catch (\Exception $e) {
         trigger_error('mail(): ' . $e->getMessage(), E_USER_WARNING);
         return false;
     }
     return true;
 }
function sendMail($email, $url)
{
    try {
        $message = new Message();
        $message->setSender("*****@*****.**");
        $message->addTo($email);
        $message->setSubject("Forgot Password");
        $message->setTextBody('Please visit the following link to reset your password. ' . $url);
        $message->send();
    } catch (InvalidArgumentException $e) {
        // ...
    }
}
Ejemplo n.º 9
0
function contact()
{
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) {
            $msg = new Message();
            $msg->setSender("*****@*****.**");
            $msg->addTo("*****@*****.**");
            $msg->setSubject("[MrKimOnTour] " . $_POST["subject"]);
            $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]);
            $msg->send();
        } else {
            http_response_code(422);
        }
    }
}
Ejemplo n.º 10
0
Archivo: api.php Proyecto: desawa12/NKR
function contact()
{
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) {
            $msg = new Message();
            $msg->setSender("*****@*****.**");
            $msg->addTo("*****@*****.**");
            $msg->setSubject("[NKR] " . $_POST["subject"]);
            $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]);
            $msg->send();
        } else {
            http_response_code(422);
        }
    }
}
    public function CWEXP_get_customerdetails(){

        $UserStamp=$this->Mdl_eilib_common_function->getSessionUserStamp();
        $timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone();
        $CWEXP_weekBefore=$_POST["CWEXP_TB_weekBefore"];
        $CWEXP_email_id=$_POST["CWEXP_email"];
        $final_value=$this->Mdl_customer_expiry_list->CWEXP_get_customerdetails($CWEXP_weekBefore,$CWEXP_email_id,$UserStamp,$timeZoneFormat);
        if($final_value[0]==1) {
            $displayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('CUSTOMER_EXPIRY');
            $message1 = new Message();
            $message1->setSender($displayname.'<'.$UserStamp.'>');
            $message1->addTo($CWEXP_email_id);
            $message1->setSubject($final_value[2]);
            $message1->setHtmlBody($final_value[1]);
            $message1->send();
            $CWEXP_check_weekly_expiry_list='true';
            echo ($CWEXP_check_weekly_expiry_list);
        }
        else{
            $CWEXP_check_weekly_expiry_list='false';
            echo ($CWEXP_check_weekly_expiry_list);
        }
    }
 public function getBanktt_UpdateSave($UserStamp)
 {
     $id=$_POST['Temp_Bt_id'];
     $type=$_POST['Banktt_SRC_TTtype'];
     $date=date('Y-m-d',strtotime($_POST['Banktt_SRC_Date']));
     $model=$_POST['Banktt_SRC_Modelnames'];if($model=='SELECT'){$model='';}
     $accname=$_POST['Banktt_SRC_Accname'];
     $accno=$_POST['Banktt_SRC_Accno'];
     $amount=$_POST['Banktt_SRC_Amount'];
     $unit=$_POST['Banktt_SRC_Unit'];if($unit=="SELECT"){$unit="";}
     $customername=$_POST['Banktt_SRC_Customername'];if($customername=="SELECT"){$customername="";}
     $customerid=$_POST['temp_customerid'];
     $bankttcode=$_POST['Banktt_SRC_Bankcode'];
     $banktt_branchcode=$_POST['Banktt_SRC_Branchcode'];
     $bankaddress=$this->db->escape_like_str($_POST['Banktt_SRC_BankAddress']);
     $swiftcode=$_POST['Banktt_SRC_Swiftcode'];
     $chargesto=$_POST['Banktt_SRC_Chargesto'];if($chargesto=="SELECT"){$chargesto='';}
     $customerref=$this->db->escape_like_str($_POST['Banktt_SRC_Customerref']);
     $invdetails=$this->db->escape_like_str($_POST['Banktt_SRC_Invdetails']);
     $createdby=$_POST['Banktt_SRC_Createdby'];if($createdby=='SELECT'){$createdby='';}
     $comments=$this->db->escape_like_str($_POST['Banktt_SRC_Comments']);
     $status=$_POST['Banktt_SRC_Status'];
     if($_POST['Banktt_SRC_Debitedon']!='')
     {
         $debitedon=date('Y-m-d',strtotime($_POST['Banktt_SRC_Debitedon']));
     }
     else
     {
         $debitedon='';
     }
     if($chargesto!='' && $createdby!=''){$configdatas=$status.','.$createdby.','.$chargesto;}
     else if($chargesto!=''){$configdatas=$status.','.$chargesto;}
     else if($createdby!=''){$configdatas=$status.','.$createdby;}
     else{$configdatas=$status;}
     $this->db->query('SET AUTOCOMMIT=0');
     $this->db->query('START TRANSACTION');
     $BANKTT_SRC_updatequery="CALL SP_BANK_TT_UPDATE($id,'$configdatas','$model','$date',$amount,'$accname','$accno','$bankttcode','$banktt_branchcode','$bankaddress','$swiftcode','$customerref','$invdetails','$debitedon','$comments','$UserStamp',@BANK_SUCCESSFLAG,@BANK_SAVEPOINT)";
     $this->db->query($BANKTT_SRC_updatequery);
     $outparm_query = 'SELECT @BANK_SUCCESSFLAG AS MESSAGE';
     $outparm_result = $this->db->query($outparm_query);
     $Confirm_mrssage=$outparm_result->row()->MESSAGE;
     $outparm_query_savepoint = 'SELECT @BANK_SAVEPOINT AS SAVEPOINT';
     $outparm_result_savepoint = $this->db->query($outparm_query_savepoint);
     $banktt_savepoint_update=$outparm_result_savepoint->row()->SAVEPOINT;
     $this->load->model('EILIB/Mdl_eilib_common_function');
     $Sendmailid=$this->Mdl_eilib_common_function->getProfileEmailId('BANKTT');
     $Displayname=$this->Mdl_eilib_common_function->Get_MailDisplayName('BANK_TT');
     $username=explode('@',$Sendmailid[0]);
     $mailusername=strtoupper($username[0]);
     $headerarray=['DATE','TRANSACTION TYPE','MODEL NAME','ACC NAME','ACC NO','AMOUNT','UNIT','CUSTOMER','STATUS','DEBITED/REJECTED DATE','BANK CODE','BRANCH CODE','BANK ADDRESS','SWIFT CODE','CHARGES TO','CUST REF','INV DETAILS','DONE BY','COMMENTS'];
     $dataarray=[$_POST['Banktt_SRC_Date'],$type,$model,$accname,$accno,$amount,$unit,$customername,$status,$debitedon,$bankttcode,$banktt_branchcode,$_POST['Banktt_SRC_BankAddress'],$swiftcode,$chargesto,$_POST['Banktt_SRC_Customerref'],$_POST['Banktt_SRC_Invdetails'],$createdby,$_POST['Banktt_SRC_Comments']];
     $subject="HELLO".','."<font color='gray'></font><font color='#498af3'><b>".$mailusername."</b> </font><br>PLEASE FIND ATTACHED NEW TRANSACTION DETAILS FROM BANK TT: <br>";
     $message = '<body><br><h> '.$subject.'</h><br></body>';
     for($i=0;$i<count($dataarray);$i++)
     {
         $value=$dataarray[$i];
         if($customername!=null){$customername=str_replace('_',' ',$customername);}
         if($value=="" || $value=="SELECT" || $value==null)continue;
         if($value!='REJECTED')
         {
             $message.= '<body><table border="1"width="600" ><tr align="left" ><td width=40%>'.$headerarray[$i].'</td><td width=60%>'.$value.'</td></tr></table></body>';
         }
         else
         {
             $message.= '<body><table border="1"width="600" ><tr align="left" ><td width=40%>'.$headerarray[$i].'</td><td width=60%><span style="background-color:#FF0000">'.$value.'</span></td></tr></table></body>';
         }
     }
     if($status!='REJECTED')
     {
         $emailsubject="BANK TRANSFER";
     }
     else
     {
         $emailsubject="BANK TRANSFER-REJECTED";
     }
     $returnvalues=array($Confirm_mrssage,$emailsubject,$message,$Displayname,$Sendmailid);
     if($returnvalues[0]==1)
     {
         try{
             $message1 = new Message();
             $message1->setSender($returnvalues[3].'<'.$UserStamp.'>');
             $message1->addTo($returnvalues[4][0]);
             $message1->addCc($returnvalues[4][1]);
             $message1->setSubject($returnvalues[1]);
             $message1->setHtmlBody($returnvalues[2]);
             $message1->send();
             $this->db->trans_savepoint_release($banktt_savepoint_update) ;}
         catch(Exception $e){
             $this->db->trans_savepoint_rollback($banktt_savepoint_update);
             return array("RECORD NOT UPDATED",$emailsubject,$message,$Displayname,$Sendmailid);
         }
     }else{
         $this->db->trans_savepoint_rollback($banktt_savepoint_update);
         return array("RECORD NOT UPDATED",$emailsubject,$message,$Displayname,$Sendmailid);
     }
     return $returnvalues;
 }
Ejemplo n.º 13
0
public function mailpart($mailsub,$mailbody,$Displayname,$UserStamp,$Sendmailid)
{
        try {
            $message1 = new Message();
            $message1->setSender($Displayname . '<' . $UserStamp . '>');
            $message1->addTo($Sendmailid);
            $message1->setSubject($mailsub);
            $message1->setHtmlBody($mailbody);
            $message1->send();
            return 1;
        }
        catch(Exception $e){
            return 0;
        }
//    $mail = new PHPMailer;
//    $mail->isSMTP();
//    $mail->Host = 'smtp.gmail.com';
//    $mail->SMTPAuth = true;
//    $mail->Username = '******';
//    $mail->Password = '******';
//    $mail->SMTPSecure = 'tls';
//    $mail->Port = 587;
//    $mail->FromName = $Displayname;
//    $mail->addAddress('*****@*****.**');
//    $mail->WordWrap = 50;
//    $mail->isHTML(true);
//    $mail->Subject = $mailsub;
//    $mail->Body = $mailbody;
//    $mail->Send();
//    if (!$mail->Send()) {
//        return "Message could not be sent";
//    } else {
//        return 'success';
//
//    }
}
Ejemplo n.º 14
0
                } else {
                    $ure_after_mrg = $adm_morningsession . '(AM)';
                }
                if ($adm_permission != null) {
                    $final_report = $adm_report . '<br>' . $ure_after_mrg . ' - REASON' . ':' . $adm_reason . 'PERMISSION:' . $adm_permission . 'hrs';
                } else {
                    $final_report = $adm_report . '<br>' . $ure_after_mrg . ' - REASON' . ':' . $adm_reason;
                }
            }
        }
        $message = $message . "<tr><td width=260 nowrap>" . $adm_loginid . "</td><td width=260 nowrap>" . $rep_worked_project . "</td><td nowrap>" . $final_report . "</td><td align='center' width=80>" . $checkintime . "</td><td style='word-wrap: break-word;width: 800px%;'>" . $checkinlocation . "</td><td align='center' width=90>" . $checkouttime . "</td><td style='word-wrap: break-word; width:800px;'>" . $checkoutlocation . "</td><td style='word-wrap: break-word; width:800px;'>" . $report_location . "</td><td align='center' width=260>" . $adm_userstamp . "</td><td align='center' width=150 nowrap>" . $adm_timestamp . "</td></tr>";
    }
    $message = $message . "</table></body></html>";
    $REP_subject_date = $mail_subject . ' - ' . date("d/m/Y", strtotime("-1 days"));
    //SENDING MAIL OPTIONS
    $name = $get_displayname;
    // $mail_subject;
    $from = '*****@*****.**';
    // $admin;
    $message1 = new Message();
    $message1->setSender($name . '<' . $from . '>');
    $message1->addTo('*****@*****.**');
    //    $message1->addCc($sadmin);
    $message1->setSubject($REP_subject_date);
    $message1->setHtmlBody($message);
    try {
        $message1->send();
    } catch (\InvalidArgumentException $e) {
        echo $e;
    }
}
Ejemplo n.º 15
0
<?php

use google\appengine\api\mail\Message;
$title = "Contact";
$msgAlert = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) {
        $msg = new Message();
        $msg->setSender("*****@*****.**");
        $msg->addTo("*****@*****.**");
        $msg->setSubject("[nakhonratchasima-nkr] " . $_POST["subject"]);
        $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]);
        $msg->send();
        $msgAlert = <<<END
    <div class="alert alert-success">
      Your email has been sent.
    </div>
END;
    } else {
        $msgAlert = <<<END
    <div class="alert alert-warning">
      All fields are required.
    </div>
END;
    }
}
$content = <<<END
<div class="container">
  <div class="row" >
    <div class="col-lg-12">
<center><h1 class="page-header">ติดต่อเรา</h1></center>
    public function DDE_Dep_Exctsubmit($shturl,$selectedunit,$customername,$checkarray,$selectedsheet,$customermail,$customeridname,$UserStamp){
        $test=array();
        $submit_array=array();$submitarray=array();
        $sub_exequery ="SELECT ETD .ETD_EMAIL_SUBJECT,ETD. ETD_EMAIL_BODY FROM  EMAIL_TEMPLATE_DETAILS ETD ,EMAIL_TEMPLATE ET WHERE (ET .ET_ID=ETD .ET_ID) AND ET_EMAIL_SCRIPT='DEPOSIT DEDUCTION'";
        $sub_rs = $this->db->query($sub_exequery);
        $subject_db=$sub_rs->row()->ETD_EMAIL_SUBJECT;
        $message_db=$sub_rs->row()->ETD_EMAIL_BODY;
        $rcontent = $customername." - ".$selectedunit;
        $subject =str_replace('[UNIT_NO - CUSTOMER_NAME]',$rcontent,$subject_db);
        $body =str_replace('[UNIT_NO-  CUSTOMER_NAME]',$rcontent,$message_db);
        $emailindex = strstr($customermail,'@',true);
        $eusername = strtoupper($emailindex);
        $body = str_replace('[MAILID_USERNAME]',$eusername,$body);
        $this->load->model('EILIB/Mdl_eilib_common_function');
        $EmailDisplayname=$this->Mdl_eilib_common_function->Get_MailDisplayName('DEPOSIT_DEDUCTION');
        $pdfheader=$selectedunit.'-'.$customername;
        for($k=0;$k<count($checkarray);$k++){
            $data5=array('DDE_flag'=>6,'shturl'=>$shturl,'selectedunit'=>$selectedunit,'customername'=>$customername,'checkarray'=>$checkarray[$k],
                'selectedsheet'=>$selectedsheet,'customeridname'=>$customeridname);
            $submit_array=$this->Mdl_eilib_common_function->Func_curl($data5);
            $submitarray[]=json_decode($submit_array,true);
        }
        try {
            $message = new Message();
            $message->setSender($EmailDisplayname.'<'.$UserStamp.'>');
            $message->addTo($customermail);
            $message->setSubject($subject);
            $message->setTextBody($body);
            for ($i = 0; $i < count($submitarray); $i++) {
                $test[]=$i+1;
                $data = implode(array_map("chr", $submitarray[$i][0]));
                $message->addAttachment($pdfheader . '.pdf', $data);
            }
            $message->send();
            $data5=array('DDE_flag'=>7);
            $response=$this->Mdl_eilib_common_function->Func_curl($data5);
            return  $submitarray;

        }
        catch (InvalidArgumentException $e) {
            return $e->getMessage();
        }
    }
Ejemplo n.º 17
0
 $requestedBy = $_POST["requestedBy"];
 $requestedApprovedBy = $_POST["approvedBy"];
 $requestedOn = $_POST["requestedOn"];
 $requestorEmail = $_POST["requestorEmail"];
 $messageToSend = $_POST["sai"];
 $reqUniq = substr($committee, 0, 3) . "-" . $reqUniq;
 $messageWithoutLink = $messageToSend;
 $messageToSend = '<pre>' . $messageToSend . '</pre>';
 $messageToSendWithlink = '<pre>' . $messageWithoutLink . '</pre>' . '<a href="http://maharudramapproval2015.appspot.com/index.php?reqno=' . $todayID . '&reqby=' . $requestedBy . '&reqapprover=' . $requestedApprovedBy . '&reqemailer=' . $requestorEmail . '">Click to Approve Request!!</a>';
 // message lines should not exceed 70 characters (PHP rule), so wrap it
 // send mail
 $messagePrefix = 'Facility request from ' . $committee . ' -Requested by   ' . $requestedBy . '-To be Approved by ' . $requestedApprovedBy . ' - on' . $requestedOn . ' -Req Generated at:[' . $todayID . ']-Req Id:' . $reqUniq;
 $WithdisclaimerNoLink = $messagePrefix . '<br/><br/><pre>' . $messageToSend . '</pre><br/><br/><br/><br/>This is a Auto Generated Message Kindly Do Not reply';
 $WithdisclaimerLink = $messagePrefix . '<br/><br/><pre>' . $messageToSendWithlink . '</pre><br/><br/><br/><br/>This is a Auto Generated Message Kindly Do Not reply';
 try {
     $message = new Message();
     $message->setSender("*****@*****.**");
     $message->addTo("*****@*****.**");
     $message->addTo("*****@*****.**");
     if (!empty($requestorEmail)) {
         $message->addTo($requestorEmail);
     }
     $message->setSubject("You Raised a Facility request from {$committee} -To be Approved by {$requestedApprovedBy} - on {$requestedOn} -Req Generated at:[{$todayID}]-Req Id:{$reqUniq}");
     $message->setHtmlBody($WithdisclaimerNoLink);
     $message->send();
     $message->setSender("*****@*****.**");
     $message->addTo("*****@*****.**");
     $message->addTo("*****@*****.**");
     $message->addTo("*****@*****.**");
     if ($requestedApprovedBy == "K.Gopalakrishnan") {
         $message->addTo("*****@*****.**");
 public function ERM_Update_Record($displayname,$Emailtemplate,$Rowid,$Name,$Rent,$Movedate,$Minstay,$Occupation,$Nation,$Guests,$Custage,$Contactno,$Emailid,$Comment,$UserStamp,$timeZoneFormat,$username)
 {
     $Min_stay=$this->db->escape_like_str($Minstay);
     $Guest=$this->db->escape_like_str($Guests);
     $age=$this->db->escape_like_str($Custage);
     $Comments=$this->db->escape_like_str($Comment);
     $Movedate=date('Y-m-d',strtotime($Movedate));
     $this->db->query('SET AUTOCOMMIT=0');
     $this->db->query('START TRANSACTION');
     $CallQuery="CALL SP_ERM_UPDATE('$Occupation',$Rowid,'$Name','$Rent','$Movedate','$Min_stay','$Nation','$Guest','$age','$Contactno','$Emailid','$Comments','$UserStamp',@ERM_SUCCESSFLAG,@ERM_UPDATE_SAVE_POINT)";
     $this->db->query($CallQuery);
     $ERM_Entry_flag = 'SELECT @ERM_SUCCESSFLAG as FLAG_INSERT';
     $query = $this->db->query($ERM_Entry_flag);
     $Confirm_Meessage=$query->row()->FLAG_INSERT;
     $query_updateSavepoint= $this->db->query('SELECT @ERM_UPDATE_SAVE_POINT as ERM_UPDATE_SAVEPOINT');
     $erm_update_savepoint=$query_updateSavepoint->row()->ERM_UPDATE_SAVEPOINT;
     $Timestamp;
     if($Confirm_Meessage==1)
     {
         $SelectQuery="SELECT DATE_FORMAT(CONVERT_TZ(ERM_TIMESTAMP,$timeZoneFormat),'%d-%m-%Y %T') AS ERM_TIME_STAMP FROM ERM_ENTRY_DETAILS WHERE ERM_ID=".$Rowid;
         $query = $this->db->query($SelectQuery);
         $Timestamp=$query->row()->ERM_TIME_STAMP;
     }
     $Movedate=date('d-m-Y',strtotime($Movedate));
     $dataarray=array($Name,$Rent,$Movedate,$Minstay,$Occupation,$Nation,$Guests,$Custage,$Contactno,$Emailid,$Comment);
     $head_array=array('CUSTOMER NAME','RENT','MOVING DATE','MIN STAY','OCCUPATION','NATIONALITY','NO OF GUESTS','AGE','CONTACT','EMAIL','COMMENTS');
     $subject="HELLO "."<font color='gray'></font><font color='#498af3'><b>$username</b> </font><br>PLEASE FIND ATTACHED NEW LEED DETAILS FROM ERM: <br>";
     $message = '<body><br><h> '.$subject.'</h><br</body>';
     if($Confirm_Meessage==1)
     {
         for($i=0;$i<count($head_array);$i++)
         {
             $value=$dataarray[$i];
             if($value=="" || $value==null)continue;
             $message .= '<body><table border="1"width="500" ><tr align="left" ><td width=40%>'.$head_array[$i].'</td><td width=60%>'.$value.'</td></tr></table></body>';
         }
     }
     $Return_values=array($Confirm_Meessage,$Timestamp,$UserStamp,$message);
     $message=$Return_values[3];
     $mydate=getdate(date("U"));
     $month=strtoupper($mydate[month]);
     $sysdate="$mydate[mday]-$month-$mydate[year]";
     $emailsubject="NEW ERM LEED -[".$sysdate."]";
     if($Return_values[0]==1)
     {
         try{
             $message1 = new Message();
             $message1->setSender($displayname.'<'.$UserStamp.'>');
             $message1->addTo($Emailtemplate[0]);
             $message1->addCc($Emailtemplate[1]);
             $message1->setSubject($emailsubject);
             $message1->setHtmlBody($message);
             $message1->send();
             $this->db->trans_savepoint_release($erm_update_savepoint) ;
         }
         catch(Exception $e){
             $this->db->trans_savepoint_rollback($erm_update_savepoint);
             return array("RECORD NOT UPDATED",$Timestamp,$UserStamp,$message);
         }
     }else{
         $this->db->trans_savepoint_rollback($erm_update_savepoint);
         return array("RECORD NOT UPDATED",$Timestamp,$UserStamp,$message);
     }
     return $Return_values;
 }
    }
    $drop_query="DROP TABLE $temp_table_name ";
    $drop_query1="DROP TABLE $temp_table_name1 ";
    mysqli_query($con,$drop_query);
    mysqli_query($con,$drop_query1);
    $message=$message."</table></body></html>";
    $find='SSOMENS TIME SHEET REPORT-  '.$month_year;
    $messagepdf=str_replace($find,'',$message);
    $find1='HELLO '.$spladminname;
    $messagepdf=str_replace($find1,'<b>'.'SSOMENS TIME SHEET REPORT-  '.$month_year.'</b>',$messagepdf);
    $find2='SSOMENS TIME SHEET REPORT FOR THE FOLLOWING EMPLOYEE(S) - '.$month_year.':';
    $messagepdf=str_replace($find2,'',$messagepdf);
    ob_clean();
    $mpdf = new mPDF('utf-8',array(270,330));
    $mpdf->WriteHTML($messagepdf);
    $outputpdf=$mpdf->Output('SSOMENS TS REPORT ' .$month_year. '.pdf','s');
    ob_end_clean();
    $FILENAME='SSOMENS TS REPORT ' .$month_year. '.pdf';
    $message1 = new Message();
    $message1->setSender($admin);
    $message1->addTo($admin);
    $message1->addCc($sadmin);
    $message1->setSubject($mail_subject);
    $message1->setHtmlBody($message);
    $message1->addAttachment($FILENAME,$outputpdf);
    $message1->send();
}



Ejemplo n.º 20
0
<?php

use google\appengine\api\mail\Message;
$title = "Contact";
$breadcrumbs = array(array("title" => "Contact", "link" => "/contact"));
$msgAlert = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) {
        $msg = new Message();
        $msg->setSender("*****@*****.**");
        $msg->addTo("*****@*****.**");
        $msg->setSubject("[MrKimOnTour] " . $_POST["subject"]);
        $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]);
        $msg->send();
        $msgAlert = <<<END
    <div class="alert alert-success">
      Your email has been sent.
    </div>
END;
    } else {
        $msgAlert = <<<END
    <div class="alert alert-warning">
      All fields are required.
    </div>
END;
    }
}
$content = <<<END

{$msgAlert}
 public function CC_Active_List($UserStamp)
 {
     set_time_limit(0);
     $currentmonth=date("Ymd");
     $period=date('F Y', strtotime($currentmonth));
     $activecclist = "CALL SP_ACTIVE_CUSTOMERLIST('$period','$UserStamp',@TEMP_OPL_ACTIVECUSTOMER_TABLE,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE)";
     $this->db->query($activecclist);
     $outparm_query = 'SELECT @TEMP_OPL_ACTIVECUSTOMER_TABLE AS TEMP_TABLE1,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE AS TEMP_TABLE2';
     $outparm_result = $this->db->query($outparm_query);
     $activelisttablename = $outparm_result->row()->TEMP_TABLE1;
     $sortactivelisttablename = $outparm_result->row()->TEMP_TABLE2;
     $FIN_Active_listquery = "SELECT *FROM $activelisttablename ORDER BY UNIT_NO,CUSTOMERNAME";
     $result1 = $this->db->query($FIN_Active_listquery);
     $numrows = $this->db->affected_rows();
     $FIN_Active_sortlistquery = "SELECT *FROM $sortactivelisttablename ORDER BY ENDDATE ASC";
     $sortresult = $this->db->query($FIN_Active_sortlistquery);
     $sortnumrows = $this->db->affected_rows();
     $headerdata = 'UNIT,CUSTOMER,STARTDATE,ENDDATE,RENT,DEPOSIT,PROCESSING FEE,TERMINATE,PRE TERMINATE,PRE TERMINATE DATE,COMMENTS';
     $FIN_ACT_folresult = $this->db->query("SELECT PCN_DATA FROM PAYMENT_CONFIGURATION WHERE CGN_ID=49");
     $folderid = $FIN_ACT_folresult->row()->PCN_DATA;
     $this->load->library('Google');
     $this->load->model('EILIB/Mdl_eilib_common_function');
     $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('ACTIVE_CC_LIST');
     $Sendmailid=$this->Mdl_eilib_common_function->getProfileEmailId('ACTIVE_CC_TRIGGER');
     $service = $this->Mdl_eilib_common_function->get_service_document();
     $this->load->model('EILIB/Mdl_eilib_common_function');
     $SS_name = 'ACTIVE CUST LIST' . '-' . date("dmY");
     $FILEID = $this->Mdl_eilib_common_function->NewSpreadsheetCreationwithurl($service, $SS_name, 'CUSTOMER_DETAILS', $folderid);
     $ActiveCustomerList = array('ACtiveflag' => 10, 'header' => $headerdata, "Rows" => $numrows, "period" => $period, "SortRows" => $sortnumrows, "Fileid" => $FILEID[0]);
     $i = 0;
     foreach ($result1->result_array() as $key => $value) {
         $key = 'data' . $i;
         $unit = $value["UNIT_NO"];
         $customername = $value["CUSTOMERNAME"];
         $Startdate = $value["STARTDATE"];
         $Enddate = $value["ENDDATE"];
         $Payment = $value["PAYMENT_AMOUNT"];
         $Deposit = $value["DEPOSIT"];
         $ProcessingFee = $value['PROCESSING_FEE'];
         $Terminate = $value['CLP_TERMINATE'];
         $Preterminate = $value['PRETERMINATE'];
         $Preterminatedate = $value['PRETERMINATEDATE'];
         $Comments = $value['COMMENTS'];
         $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments;
         $ActiveCustomerList[$key] = $data;
         $i++;
     }
     $i = 0;
     foreach ($sortresult->result_array() as $key => $value) {
         $key = 'sortdata' . $i;
         $unit = $value["UNIT_NO"];
         $customername = $value["CUSTOMERNAME"];
         $Startdate = $value["STARTDATE"];
         $Enddate = $value["ENDDATE"];
         $Payment = $value["PAYMENT_AMOUNT"];
         $Deposit = $value["DEPOSIT"];
         $ProcessingFee = $value['PROCESSING_FEE'];
         $Terminate = $value['CLP_TERMINATE'];
         $Preterminate = $value['PRETERMINATE'];
         $Preterminatedate = $value['PRETERMINATEDATE'];
         $Comments = $value['COMMENTS'];
         $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments;
         $ActiveCustomerList[$key] = $data;
         $i++;
     }
     $this->db->query('DROP TABLE IF EXISTS ' . $activelisttablename);
     $this->db->query('DROP TABLE IF EXISTS ' . $sortactivelisttablename);
     $Returnvalue = $this->Mdl_eilib_common_function->Func_curl($ActiveCustomerList);
     $subject = 'ACTIVE CUST LIST-' . date("dmY");
     $MailidSplit = explode('@', $Sendmailid[0]);
     $Username = strtoupper($MailidSplit[0]);
     $mailbody = "HELLO  " . $Username;
     $mailbody = $mailbody . '' . '<br><br>, PLEASE FIND ATTACHED THE CURRENT : ' . $FILEID[1];
     $message1 = new Message();
     $message1->setSender($EmailDisplayname.'<'.$UserStamp.'>');
     $message1->addTo($Sendmailid[0]);
     $message1->addCC($Sendmailid[1]);
     $message1->setSubject($subject);
     $message1->setHtmlBody($mailbody);
     $message1->send();
 }
Ejemplo n.º 22
0
    }
}
$email_message = <<<EMAIL
guest1: {$submitted['guest1']}
guest2: {$submitted['guest2']}
coming: {$submitted['coming']}
meal_beef: {$submitted['meal_beef']}
meal_fish: {$submitted['meal_fish']}
meal_veggie: {$submitted['meal_veggie']}
dietary_restrictions: {$submitted['dietary_restrictions']}
brunch: {$submitted['brunch']}
song: {$submitted['song']}
message: {$submitted['message']}
EMAIL;
try {
    $message = new Message();
    $message->setSender('*****@*****.**');
    $message->addTo('*****@*****.**');
    $message->setSubject("RSVP to Beth & Ian's Wedding");
    $message->setTextBody($email_message);
    if (!empty($selfie)) {
        $message->addAttachment($selfie['name'], $selfie['data']);
    }
    $message->send();
    include 'views/thankyou.php';
} catch (Exception $e) {
    $error_message = <<<HTML
Couldn't send your message to Beth &amp; Ian.
The following error occurred:<br><br>
{$e}
HTML;
Ejemplo n.º 23
0
<?php

use google\appengine\api\mail\Message;
$name = htmlspecialchars($_POST["name"]);
$email = htmlspecialchars($_POST["email"]);
$message = htmlspecialchars($_POST["message"]);
$subject = "Feedback received from: " . $name;
$emailBody = "From: " . $name . "\nEmail: " . $email . "\n\nMessage:\n" . $message;
try {
    $message = new Message();
    $message->setSender("*****@*****.**");
    $message->addTo("*****@*****.**");
    $message->addTo("*****@*****.**");
    $message->addTo("*****@*****.**");
    $message->setSubject($subject);
    $message->setTextBody($emailBody);
    $message->send();
} catch (InvalidArgumentException $e) {
    echo $e;
}
echo "complete";
Ejemplo n.º 24
0
 public function testSucceedWithOptionsArray()
 {
     $headers = array('in-reply-to' => 'data', 'list-id' => 'data2', 'references' => 'data3');
     $attachments = array('test.gif' => 'data', 't.jpg' => 'data2', 'z.png' => 'data3');
     $options = array('sender' => '*****@*****.**', 'replyto' => '*****@*****.**', 'to' => array('*****@*****.**', '*****@*****.**'), 'cc' => array('*****@*****.**', '*****@*****.**'), 'bcc' => array('*****@*****.**', '*****@*****.**'), 'subject' => 'test', 'textBody' => 'text body', 'htmlBody' => 'html body', 'header' => $headers, 'attachment' => $attachments);
     $message = new Message($options);
     $message_proto = new MailMessage();
     $message_proto->setSender("*****@*****.**");
     $message_proto->setReplyto("*****@*****.**");
     $message_proto->addTo("*****@*****.**");
     $message_proto->addTo("*****@*****.**");
     $message_proto->addCc("*****@*****.**");
     $message_proto->addCc("*****@*****.**");
     $message_proto->addBcc("*****@*****.**");
     $message_proto->addBcc("*****@*****.**");
     $message_proto->setSubject("test");
     $message_proto->setTextbody("text body");
     $message_proto->setHtmlbody("html body");
     $header = $message_proto->addHeader();
     $header->setName("in-reply-to");
     $header->setValue("data");
     $header = $message_proto->addHeader();
     $header->setName("list-id");
     $header->setValue("data2");
     $header = $message_proto->addHeader();
     $header->setName("references");
     $header->setValue("data3");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("test.gif");
     $attach->setData("data");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("t.jpg");
     $attach->setData("data2");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("z.png");
     $attach->setData("data3");
     $response = new VoidProto();
     $this->apiProxyMock->expectCall('mail', 'Send', $message_proto, $response);
     $message->send();
     $this->apiProxyMock->verify();
 }
    public function Customercreationmailpart($Confirm_Meessage,$Emailsub,$Messagebody,$Displayname,$Sendmailid,$UserStamp)
    {
        $message1 = new Message();
        $message1->setSender($Displayname.'<'.$UserStamp.'>');
        $message1->addTo($Sendmailid);
        $message1->setSubject($Emailsub);
        $message1->setHtmlBody($Messagebody);
        $message1->send();
//        $this->db->trans_commit();
        return $Confirm_Meessage;
    }
Ejemplo n.º 26
0
function sendMail($msg, $sub = "zouk-calendar app")
{
    try {
        $message = new Message();
        $message->setSender("*****@*****.**");
        //$message->setSender("*****@*****.**");
        $message->addTo("*****@*****.**");
        $message->setSubject($sub);
        $message->setTextBody($msg);
        $message->send();
    } catch (InvalidArgumentException $e) {
        syslog(LOG_ERR, "Email send failed: " . $e);
    }
}
Ejemplo n.º 27
0
    $body=$row["ETD_EMAIL_BODY"];
}
if($Current_day!='Sunday'){
    if($check_ph==0 && $check_onduty==0 ){
        $remainder_array=array_diff($get_active_user,$get_login_id);
        $remainder_array=array_values($remainder_array);
        $array_length=count($remainder_array);
        for($i=0;$i<$array_length;$i++){
            $names=$remainder_array[$i];
            $select_empname="SELECT EMPLOYEE_NAME from VW_TS_ALL_ACTIVE_EMPLOYEE_DETAILS where ULD_LOGINID='$names' ";
            $select_emp_name=mysqli_query($con,$select_empname);
            if($row=mysqli_fetch_array($select_emp_name)){
                $empname=$row["EMPLOYEE_NAME"];
            }
            $bodyscript=str_replace("[MAILID_USERNAME]","$empname",$body);
            $message_body=str_replace("[DATE]",date('l jS F Y '),$bodyscript);
            $mail_options = [
                "sender" => $admin,
                "to" => $names,
                "subject" => $mail_subject,
                "textBody" => $message_body
            ];
            try {
                $message = new Message($mail_options);
                $message->send();
            } catch (\InvalidArgumentException $e) {
                echo $e;
            }
        }
    }
}
    public function OPL_list_creation($UserStamp)
    {
        try
        {
            $period = $_POST['FIN_OPL_db_period'];
            $mailid = $_POST['FIN_OPL_lb_mailid'];
            $MailidSplit = explode('@', $mailid);
            $Username = strtoupper($MailidSplit[0]);
            $Maildate = strtoupper($period);
            $Option = $_POST['Radio'];
            if ($Option == 'OPL_list')
            {
                $EmilTemplateSelectQuery = "SELECT ETD_EMAIL_SUBJECT,ETD_EMAIL_BODY FROM EMAIL_TEMPLATE_DETAILS WHERE ET_ID=6";
                $result = $this->db->query($EmilTemplateSelectQuery);
                foreach ($result->result_array() as $key => $val) {
                    $Email_sub = $val['ETD_EMAIL_SUBJECT'];
                    $Email_Body = $val['ETD_EMAIL_BODY'];
                }
                $flag = 0;
                $Email_sub = str_replace("[MM-YYYY]", $Maildate, $Email_sub);
                $Email_Body = str_replace("[MM-YYYY]", $Maildate, $Email_Body);
                $Email_Body = str_replace("[MAILID_USERNAME]", $Username, $Email_Body);
                $FIN_OPL_message = '<body><br><h> ' . $Email_Body . '</h><br><br><table border="1" style="color:white" width="800"><tr  bgcolor=" #498af3" align="center" ><td  width=50%><h3>UNIT-CUSTOMER</h3></td><td width=15%><h3>RENT</h3></td><td width=15%><h3>DEPOSIT</h3></td><td width=20%><h3>PROCESSING FEE</h3></td></tr></table></body>';
                $OPLSelectQuery = "CALL SP_OUTSTANDING_PAYMENTLIST('$period','$UserStamp',@TEMP_FINAL_NONPAIDCUSTOMER)";
                $this->db->query($OPLSelectQuery);
                $outparm_query = 'SELECT @TEMP_FINAL_NONPAIDCUSTOMER AS TEMP_TABLE';
                $outparm_result = $this->db->query($outparm_query);
                $csrc_tablename = $outparm_result->row()->TEMP_TABLE;
                $FIN_OPL_listquery = "SELECT *FROM $csrc_tablename ORDER BY UNIT_NO,CUSTOMERNAME";
                $result = $this->db->query($FIN_OPL_listquery);

                foreach ($result->result_array() as $key => $value) {
                    $flag = 1;
                    $unit = $value["UNIT_NO"];
                    $customername = $value["CUSTOMERNAME"];
                    $enddate = $value["FINAL_ENDDATE"];
                    $payment = $value["PAYMENT"];
                    if ($payment == "NULL") {
                        $payment = " ";
                    }
                    $deposit = $value["DEPOSIT"];
                    if ($deposit == "NULL") {
                        $deposit = " ";
                    }
                    $process = $value["PROCESSINGFEE"];
                    if ($process == "NULL") {
                        $process = " ";
                    }
                    $enddateflag=0;
                    if ($enddate != null) {
                        $enddateflag=1;
                        $enddate = date('d-m-Y', strtotime($enddate));
                        $opldataname = $unit . '-' . $customername.'  -  '.$enddate;
                    } else {
                        $opldataname = $unit . '-' . $customername;
                    }
                    $opldataname = str_replace('_', ' ', $opldataname);
                    if (($payment == 'X') && ($deposit == "X") && ($process == "X") && $enddateflag==0)
                    {
                        $FIN_OPL_message .= '<body><table border="1"width="800" ><tr><td bgcolor="#FF0000" width="50%">' . $opldataname . '</td><td width=15% align="center">' . $payment . '</td><td width=15% align="center">' . $deposit . '</td><td width=20% align="center">' . $process . '</td></tr></table></body>';
                    }
                    else if($enddateflag==1)
                    {
                        $FIN_OPL_message .= '<body><table border="1"width="800" ><tr><td width="50%"><span style="background-color:red;color:white">' . $opldataname . '</span></td><td width=15% align="center">' . $payment . '</td><td width=15% align="center">' . $deposit . '</td><td width=20% align="center">' . $process . '</td></tr></table></body>';
                    }
                    else
                    {
                        $FIN_OPL_message .= '<body><table border="1"width="800" ><tr><td width="50%">' . $opldataname . '</td><td width=15% align="center">' . $payment . '</td><td width=15% align="center">' . $deposit . '</td><td width=20% align="center">' . $process . '</td></tr></table></body>';
                    }
                }
                $this->db->query('DROP TABLE IF EXISTS ' . $csrc_tablename);
                $this->load->model('EILIB/Mdl_eilib_common_function');
                $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('OUTSTANDING_PAYEES');
                $confirmessage='opllist';
                if($flag!=1)
                {
                    $FIN_OPL_message = "THERE IS NO OUTSTANDING PAYEES FOR <MONTH-YEAR>";
                    $FIN_OPL_message = str_replace("<MONTH-YEAR>", $period, $FIN_OPL_message);
                    $confirmessage='emptylist';
                }
                $message1 = new Message();
                $message1->setSender($EmailDisplayname . '<' . $UserStamp . '>');
                $message1->addTo($mailid);
                $message1->setSubject($Email_sub);
                $message1->setHtmlBody($FIN_OPL_message);
                $message1->send();
                echo $confirmessage;
                exit;
            }
            else
            {
                $flag = 1;
                $period = $_POST['FIN_OPL_db_period'];
                $activecclist = "CALL SP_ACTIVE_CUSTOMERLIST('$period','$UserStamp',@TEMP_OPL_ACTIVECUSTOMER_TABLE,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE)";
                $this->db->query($activecclist);
                $outparm_query = 'SELECT @TEMP_OPL_ACTIVECUSTOMER_TABLE AS TEMP_TABLE1,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE AS TEMP_TABLE2';
                $outparm_result = $this->db->query($outparm_query);
                $activelisttablename = $outparm_result->row()->TEMP_TABLE1;
                $sortactivelisttablename = $outparm_result->row()->TEMP_TABLE2;

                $FIN_Active_listquery = "SELECT *FROM $activelisttablename ORDER BY UNIT_NO,CUSTOMERNAME";
                $result1 = $this->db->query($FIN_Active_listquery);
                $numrows=$this->db->affected_rows();
                $FIN_Active_sortlistquery = "SELECT *FROM $sortactivelisttablename ORDER BY ENDDATE ASC";
                $sortresult = $this->db->query($FIN_Active_sortlistquery);
                $sortnumrows=$this->db->affected_rows();
                $headerdata='UNIT,CUSTOMER,STARTDATE,ENDDATE,RENT,DEPOSIT,PROCESSING FEE,TERMINATE,PRE TERMINATE,PRE TERMINATE DATE,COMMENTS';
                $FIN_ACT_folresult=$this->db->query("SELECT PCN_DATA FROM PAYMENT_CONFIGURATION WHERE CGN_ID=49");
                $folderid=$FIN_ACT_folresult->row()->PCN_DATA;
                $this->load->library('Google');
                $this->load->model('EILIB/Mdl_eilib_common_function');
                $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('ACTIVE_CC_LIST');
                $service = $this->Mdl_eilib_common_function->get_service_document();
                $this->load->model('EILIB/Mdl_eilib_common_function');
                $SS_name='ACTIVE CUST LIST'.'-'.date("dmY");
                $FILEID=$this->Mdl_eilib_common_function->NewSpreadsheetCreationwithurl($service,$SS_name, 'CUSTOMER_DETAILS', $folderid);
                $ActiveCustomerList = array('ACtiveflag'=>10,'header'=>$headerdata,"Rows"=>$numrows,"period"=>$period,"SortRows"=>$sortnumrows,"Fileid"=>$FILEID[0]);
                $i = 0;
                foreach ($result1->result_array() as $key => $value) {
                    $key = 'data'.$i;
                    $unit = $value["UNIT_NO"];
                    $customername = $value["CUSTOMERNAME"];
                    $Startdate = $value["STARTDATE"];
                    $Enddate = $value["ENDDATE"];
                    $Payment = $value["PAYMENT_AMOUNT"];
                    $Deposit = $value["DEPOSIT"];
                    $ProcessingFee = $value['PROCESSING_FEE'];
                    $Terminate = $value['CLP_TERMINATE'];
                    $Preterminate = $value['PRETERMINATE'];
                    $Preterminatedate = $value['PRETERMINATEDATE'];
                    $Comments = $value['COMMENTS'];
                    $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments;
                    $ActiveCustomerList[$key] = $data;
                    $i++;
                }
                $i = 0;
                foreach ($sortresult->result_array() as $key => $value) {
                    $key = 'sortdata'.$i;
                    $unit = $value["UNIT_NO"];
                    $customername = $value["CUSTOMERNAME"];
                    $Startdate = $value["STARTDATE"];
                    $Enddate = $value["ENDDATE"];
                    $Payment = $value["PAYMENT_AMOUNT"];
                    $Deposit = $value["DEPOSIT"];
                    $ProcessingFee = $value['PROCESSING_FEE'];
                    $Terminate = $value['CLP_TERMINATE'];
                    $Preterminate = $value['PRETERMINATE'];
                    $Preterminatedate = $value['PRETERMINATEDATE'];
                    $Comments = $value['COMMENTS'];
                    $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments;
                    $ActiveCustomerList[$key] = $data;
                    $i++;
                }
                $this->db->query('DROP TABLE IF EXISTS ' . $activelisttablename);
                $this->db->query('DROP TABLE IF EXISTS ' . $sortactivelisttablename);
                $Returnvalue=$this->Mdl_eilib_common_function->Func_curl($ActiveCustomerList);
                $subject='ACTIVE CUST LIST-'.date("dmY");
                $mailbody ="HELLO  ".$Username;
                $mailbody=$mailbody.''.'<br><br>, PLEASE FIND ATTACHED THE CURRENT : '.$FILEID[1];
                $message1 = new Message();
                $message1->setSender($EmailDisplayname . '<' . $UserStamp . '>');
                $message1->addTo($mailid);
                $message1->setSubject($subject);
                $message1->setHtmlBody($mailbody);
                $message1->send();
                echo 'ACTIVECCLIST';
                exit;
            }
        }
        catch (Exception $e)
        {
            return $e->getMessage();

        }
    }
$result = $select->fetch_assoc();
$temp_table_name = $result['@TEMP_CLOCK_OUT_MISSED_DETAILS'];
$select_data = "select * from {$temp_table_name} ORDER BY EMPLOYEE_NAME ";
$select_data_rs = mysqli_query($con, $select_data);
$row = mysqli_num_rows($select_data_rs);
$x = $row;
if ($x > 0) {
    while ($row = mysqli_fetch_array($select_data_rs)) {
        $adm_employeename = $row["EMPLOYEE_NAME"];
        $adm_date = $row["REPORT_DATE"];
        $message = $message . "<tr><td width=220>" . $adm_employeename . "</td><td width=150>" . $adm_date . "</td></tr>";
    }
    $message = $message . "</table></body></html>";
    $REP_subject_date = $mail_subject;
    //SENDING MAIL OPTIONS
    $name = $mail_subject;
    $from = $admin;
    $message1 = new Message();
    $message1->setSender($name . '<' . $from . '>');
    $message1->addTo($admin);
    $message1->addCc($sadmin);
    $message1->setSubject($REP_subject_date);
    $message1->setHtmlBody($message);
    try {
        $message1->send();
    } catch (\InvalidArgumentException $e) {
        echo $e;
    }
}
$drop_query = "DROP TABLE {$temp_table_name} ";
mysqli_query($con, $drop_query);
 public function Remindermailpart($mailsub,$mailbody,$EmailDisplayname,$UserStamp,$Mailid)
 {
     $message1 = new Message();
     $message1->setSender($EmailDisplayname.'<'.$UserStamp.'>');
     $message1->addTo($Mailid);
     $message1->setSubject($mailsub);
     $message1->setHtmlBody($mailbody);
     $message1->send();
 }