$body .= $val . "\n"; } } else { die; } if (trim($from == null)) { die; } if (trim($subject == null)) { die; } if (trim($body == null)) { die; } $ldap = new clladp(); $ld = $ldap->ldap_connection; $bind = $ldap->ldapbind; $suffix = $ldap->suffix; $arr = array("mail", "displayname"); if ($ou != null) { $prefix = "ou={$ou},"; } $sr = @ldap_search($ld, "{$prefix}dc=organizations,{$suffix}", '(objectclass=userAccount)', $arr); if ($sr) { $hash = ldap_get_entries($ld, $sr); for ($i = 0; $i < $hash["count"]; $i++) { $mail = $hash[$i]["mail"][0]; $displayname = $hash[$i]["displayname"][0]; SendMailNotifWithSendMail($body, $subject, $from, $mail); } }
write_syslog("wants pflogsumm reporting but no recipients set", __FILE__); die; } while (list($num, $email) = each($rec)) { if (trim($email) == null) { continue; } $recipients[$email] = $email; } if (!is_array($recipients)) { write_syslog("wants pflogsumm reporting but no recipients set", __FILE__); die; } if (!is_file("{$maillog}")) { write_syslog("wants pflogsumm reporting but cannot stat maillog or mail.log", __FILE__); die; } system("/usr/sbin/pflogsumm -d today --verbose_msg_detail {$maillog} >/tmp/pflogsumm 2>&1"); $reporting = file_get_contents("/tmp/pflogsumm"); write_syslog("pflogsumm reporting generated for " . count($recipients) . " recipients with " . strlen($reporting) . " bytes length", __FILE__); @unlink("/tmp/pflogsumm"); while (list($num, $email) = each($recipients)) { if (trim($email) == null) { continue; } if ($use_send_mail == 1) { SendMailNotifWithSendMail($reporting, $subject, $smtp_sender, $email, $debug); } else { SendMailNotif($reporting, $subject, $smtp_sender, $email, $debug); } }