// it is for smtp mail sending
                 if ($_SESSION["sess_smtpsettings"] == 1) {
                     $var_smtpserver = $_SESSION["sess_smtpserver"];
                     $var_port = $_SESSION["sess_smtpport"];
                     SMTPMail($row["vDeptMail"], $var_email, $var_smtpserver, $var_port, $var_subject, $var_body, $vAttacharr);
                 } else {
                     $mime->send_mail();
                 }
             } else {
                 $mailHeader = implode("|", $arr_header);
                 /*
                  * Mail sending will be done based on the time set by the staff
                  * using cron to send the mail
                  */
                 $attachment = $var_uploaded_files;
                 $mailDataId = saveMailData($var_emailescalation, $var_fromMail, $mailHeader, $var_subject, $var_body, $sendAtSave, $actionLogId, $personalnotes, $attachment);
                 /*
                  * 
                  */
             }
             //Send replay mail to user ends ******************
         }
         //loop ends for mail
     }
     //if ends for mail
 }
 if ($sendat == '') {
     $replyMailStatus = "Y";
 } else {
     $replyMailStatus = "N";
 }
                 // it is for smtp mail sending
                 if ($_SESSION["sess_smtpsettings"] == 1) {
                     $var_smtpserver = $_SESSION["sess_smtpserver"];
                     $var_port = $_SESSION["sess_smtpport"];
                     SMTPMail($row["vDeptMail"], $var_email, $var_smtpserver, $var_port, $var_subject, $var_body, $vAttacharr, $var_cc);
                 } else {
                     $mime->send_mail();
                 }
             } else {
                 $mailHeader = implode("|", $arr_header);
                 /*
                  * Mail sending will be done based on the time set by the staff
                  * using cron to send the mail
                  */
                 $attachment = $var_uploaded_files;
                 $mailDataId = saveMailData($var_email, $row["vDeptMail"], $mailHeader, $var_subject, $var_body, $sendAtSave, $actionLogId, $personalnotes, $attachment);
             }
             //Send replay mail to user ends ******************
         }
         //loop ends for mail
     }
     //if ends for mail
 }
 if ($sendat == '') {
     $replyMailStatus = "Y";
 } else {
     $replyMailStatus = "N";
 }
 //insert into reply table
 if ($var_hold == '' || $var_hold == 0) {
     $sql = "insert into sptbl_replies(nReplyId,nTicketId,nStaffId,vStaffLogin,";