SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'kara-indonesia.com'; // Specify main and backup SMTP servers $mail->Port = 25; // TCP port to connect to $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'noreplay@kara-indonesia.com'; // SMTP username $mail->Password = 'September2018'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); //Recipients $mail->setFrom('noreplay@kara-indonesia.com', 'Kara Island'); $db = getDB(); $sql0 = "select email from tblMstSubcribe where apps = 'kara_island' and subcribe = '1'"; $stmt0 = $db->prepare($sql0); $stmt0->execute(); while ($email = $stmt0->fetch()) { $mail->addAddress($email[0]); } $db = null; $mail->addAddress('ozzy.qani@gmail.com'); //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Summary Report'; // $mail->Body = "

Dengan Hormat,

Bersamaan dengan Email ini dikirimkan rekap penjualan Outlet Kara Island Gandaria City pada tanggal " . date('d/m/Y')."
Adapun rincian penjualan tersebut adalah sebagai berikut :
MASIH STACK NENG IKI... ;-(
ItemsQuantity
"; $mail->Body = ''; $mail->Body .= ""; $mail->Body .= "
"; $db = getDB(); $sql3 = "EXEC spSalesSamurry '".date_format($dates, 'Y-m-d')."','".date_format($dates, 'Y-m-d')."'"; $stmt3 = $db->prepare($sql3); $stmt3->execute(); $row3 = $stmt3->fetch(); $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= ""; $db = null; $mail->Body .= ""; $db = getDB(); $sql4 = "select ItemID, ItemName, SUM(Qnty), UOMName from vwDOTunai where TransDate = '".date_format($dates, 'Y-m-d')."' and Status = 1 Group By ItemID, ItemName, UOMName"; $stmt4 = $db->prepare($sql4); $stmt4->execute(); while ($row4 = $stmt4->fetch()){ $ItemName = strtolower($row4[1]); $mail->Body .= ""; } $db = null; $mail->Body .= ""; $mail->Body .= "
Summary Report
All Outlet
"; $mail->Body .= "
Cashier :
"; $db = getDB(); $sql = "select name from vwDOTunaiHdr where TransDate = '".date_format($dates, 'Y-m-d')."' Group by name"; $stmt = $db->prepare($sql); $stmt->execute(); while ($row = $stmt->fetch()) { $mail->Body .= $row[0] . "
"; } $db = null; $mail->Body .= "Date :". date_format($dates, 'd-m-Y') ."
From "; $db = getDB(); $sql1 = "select top 1 created_date from pos_tbl_transaksi_saldo WHERE tanggal='".date_format($dates, 'Y-m-d')."' ORDER BY created_date asc "; $stmt1 = $db->prepare($sql1); $stmt1->execute(); while ($row1 = $stmt1->fetch()) { $jam1 = date_create($row1[0]); $mail->Body .= date_format($jam1, 'H:i:s') . " to "; } $db = null; $db = getDB(); $sql2 = "select top 1 created_date, updated_date from pos_tbl_transaksi_saldo WHERE tanggal='".date_format($dates, 'Y-m-d')."' ORDER BY created_date desc "; $stmt2 = $db->prepare($sql2); $stmt2->execute(); while ($row2 = $stmt2->fetch()){ $jam2 = date_create($row2[0]); $mail->Body .= date_format($jam2, 'H:i:s'); } $db = null; $mail->Body .= "
EDC / PaymentTotal
CASH ". number_format($row3[1]) . "
BNI ". number_format($row3[2]) . "
BCA ". number_format($row3[3]) . "
OVO ". number_format($row3[4]) . "
ItemQuantity
". ucfirst($ItemName) . " ". number_format($row4[2]) . " ". strtolower($row4[3]) . "

Download aplikasi Point Of Sale Kara Island

"; //$mail->Body = $some_page_contents; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; }