Skip to content

Commit

Permalink
Fixed a buf for email alert
Browse files Browse the repository at this point in the history
  • Loading branch information
falon committed Jan 24, 2017
1 parent 83c9d84 commit 5764de1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions computeMySMTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
$pslist=parse_ini_file('dnsbl.conf', TRUE);
$items=readList($pslist['lists']['list']);
$ips = parse_ini_file('mySMTP.conf');
foreach ( $ips['ip'] as $ip )
$send = FALSE;
foreach ( $ips['ip'] as $ip ) {
$result["$ip"] = checkList($ip, $items, $alert);
if ( $alert ) $send = TRUE;
}
file_put_contents(__DIR__.'/result.json',json_encode($result));

syslog (LOG_INFO, "The check for your SMTP servers has been written.");

if ( $alert ) {
if ( $send ) {
/* At least one IP is listed. I send a notification mail */
$opt = parse_ini_file('email.conf', TRUE);
syslog (LOG_EMERG, "At least one of your IP is blocklisted. See urgently at last report {$opt['others']['link']}");
Expand Down

0 comments on commit 5764de1

Please sign in to comment.