function notiDL($appName, $appPosID) { $sysEmail = "*****@*****.**"; $sysPswd = "eemelreq"; $deptName = getDeptNamebyPosID($appPosID); $posName = getPosName($appPosID); $dlQuery = "SELECT dl.DL_NAME, dl.DL_EMAIL\n\t\t\t\t\tFROM deptldr dl, department d, position p\n\t\t\t\t\tWHERE d.DEPT_ID = dl.DL_DEPTID\n\t\t\t\t\tAND d.DEPT_ID = p.POS_DEPTID\n\t\t\t\t\tAND p.POS_ID = {$appPosID}"; $dlRes = mysql_query($dlQuery) or die(mysql_error()); if (mysql_num_rows($dlRes) > 0) { while ($dlRow = mysql_fetch_array($dlRes)) { $mail = NULL; $dlName = $dlRow['DL_NAME']; $dlEmail = $dlRow['DL_EMAIL']; include "SMTP/class.phpmailer.php"; $bodyString = "<b> Permohonan Emel Kerajaan Pahang </b> <br/><br/>\n\t\t\t\t\t\t\t En./Cik./Pn. " . $dlName . ", <br/>\n\t\t\t\t\t\t\t Pemberitahuan tentang permohonan baru daripada: <br/>\n\t\t\t\t\t\t\t Nama: {$appName} <br/>\n\t\t\t\t\t\t\t Jabatan: {$deptName} <br/>\n\t\t\t\t\t\t\t Jawatan: {$posName} <br/>\n\t\t\t\t\t\t\t Sila log masuk ke http://192.168.1.154/eemelReq untuk tindakan lanjut. <br/><br/>\n\t\t\t\t\t\t\t Terima Kasih.\n\t\t\t\t\t\t\t "; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->IsHTML(true); $mail->Username = $sysEmail; $mail->Password = $sysPswd; $mail->SetFrom("{$sysEmail}"); $mail->Subject = "Permohonan Baru"; $mail->Body = $bodyString; $mail->AddAddress($dlEmail); if (!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { // echo "Email has been sent to $appEmail"; } } } }
<!--main content start--> <section id="main-content"> <section class="wrapper"> <?php echo $msg; ?> <?php if (isset($_GET['appID'])) { $appID = $_GET['appID']; $appQuery = "SELECT APP_ID, APP_POSID, APP_NAME, APP_IC, APP_EMAIL, APP_STATLDR, APP_STATAD \n FROM application WHERE APP_ID = {$appID}"; $appRes = mysql_query($appQuery) or die(mysql_error()); if (mysql_num_rows($appRes) > 0) { $appRow = mysql_fetch_array($appRes); $appPosID = $appRow['APP_POSID']; $appPosName = getPosName($appPosID); $appDeptName = getDeptNamebyPosID($appPosID); $appName = $appRow['APP_NAME']; $appIC = $appRow['APP_IC']; $appEmail = $appRow['APP_EMAIL']; $appStatDL = $appRow['APP_STATLDR']; $appStatAD = $appRow['APP_STATAD']; $apptable = "<table class='table table-hover'>\n <tr class='info'>\n <td> Nama: </td>\n <td> {$appName} </td>\n </tr>\n <tr class='info'>\n <td> No. IC</td>\n <td> {$appIC}</td>\n </tr>\n <tr class='info'>\n <td> Emel: </td>\n <td> {$appEmail}</td>\n </tr>\n <tr class='info'>\n <td> Jabatan: </td>\n <td> {$appDeptName} </td>\n </tr>\n <tr class='info'>\n <td> Jawatan:</td>\n <td> {$appPosName} </td>\n </tr>\n <tr class='info'>\n <td> Status Ketua Jabatan: </td>\n <td> <span class='label label-success'> {$appStatDL} </span></td>\n </tr>\n <tr class='success'>\n <td colspan='2'>\n <center><a href='#myModal' data-toggle='modal' class='btn btn-xs btn-success'>APPROVE</a></center>\n </td>\n </tr>\n </table>"; echo $apptable; } else { echo "Tiada Permohonan Ditemui"; } } ?> <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" id="myModal" class="modal fade">