$Now-$MailPostsSquelch) { fclose($fp); return; } continue; } Lock(2); array_push($mailpost, $p."\n"); if ($t<$oldestpost) $oldestpost=$t; } fclose($fp); if ($oldestpost > $Now-$MailPostsDelay) { Lock(0); return; } $MailPostsFunction($MailPostsTo,$MailPostsSubject, str_replace('$MailPostsList',join('',$mailpost),$MailPostsMessage), $MailPostsHeaders); $fp = @fopen($MailPostsFile,"w"); if ($fp) { fputs($fp,"$Now #lastmailed\n"); fclose($fp); } Lock(0); function MailPostsSendmail($to,$subject,$msg,$headers) { if (preg_match('/From: .*?([-.\w]+@[-.\w]+)/',$headers,$match)) $from="-f".$match[1]; $mailer = popen("/usr/lib/sendmail -t -i $from","w"); fwrite($mailer,"To: $to\nSubject: $subject\n$headers\n\n$msg"); pclose($mailer); }