function SMTP_NOTIFICATIONS_NOTIF() { $sock = new sockets(); $tpl = new templates(); $sock = new sockets(); $ini = new Bs_IniHandler(); $datas = trim($sock->GET_INFO("SmtpNotificationConfig")); $ini->loadString($datas); $smtp_sender = $ini->_params["SMTP"]["smtp_sender"]; $recipient = $ini->_params["SMTP"]["smtp_dest"]; if ($GLOBALS["VERBOSE"]) { echo "Build PHPMailer<br>\n"; } $mail = new PHPMailer(true); $mail->IsSendmail(); $mail->AddAddress($recipient, $recipient); $mail->AddReplyTo($smtp_sender, $smtp_sender); $mail->From = $smtp_sender; $mail->FromName = $smtp_sender; $mail->Subject = "This is a test notification message"; $mail->Body = "This is a test notification message"; $content = $mail->Send(true); $msmtp = new system_msmtp($recipient, $content); if ($GLOBALS["VERBOSE"]) { echo "Build SEND system_msmtp({$recipient}, {$content})<br>\n"; } if ($msmtp->Send()) { echo $tpl->_ENGINE_parse_body("<center style='font-size:50px'>{success}</center>"); return; } echo $tpl->_ENGINE_parse_body("<center style='font-size:50px'>{failed2}</center>\n\t<textarea style='margin-top:5px;font-family:Courier New;\nfont-weight:bold;width:99%;height:250px;border:5px solid #8E8E8E;\noverflow:auto;font-size:18px !important' id='text-'>{$msmtp->logs}</textarea>\t\t\n\t\t\t\n\t\t\t\n\t"); }
function xnotify($subject, $file) { $unix = new unix(); $msmtp = new system_msmtp(null, null); if ($msmtp->ENABLED == 0) { events("Send eMail disabled...", __FUNCTION__, __LINE__); return; } $mail = new PHPMailer(true); $mail->IsSendmail(); $mail->AddAddress($msmtp->recipient, $msmtp->recipient); $mail->AddReplyTo($msmtp->recipient, $msmtp->recipient); $mail->From = $msmtp->smtp_sender; $mail->FromName = $unix->hostname_g(); $mail->Subject = $subject; $mail->Body = $subject; $mail->AddAttachment($file, basename($file)); $content = $mail->Send(true); $msmtp = new system_msmtp(null, $content); if (!$msmtp->Send()) { events("Send eMail Failed...", __FUNCTION__, __LINE__); squid_admin_mysql(0, "Fatal: Unable to send email notification", "Subject: {$subject}\n{$msmtp->logs}", __FILE__, __LINE__); return; } events("Send eMail success...", __FUNCTION__, __LINE__); }