function postfix_templates() { $mainTPL = new bounces_templates(); $main = new maincf_multi("master"); $mainTemplates = new bounces_templates(); $conf = null; $double_bounce_sender = $main->GET("double_bounce_sender"); $address_verify_sender = $main->GET("address_verify_sender"); $twobounce_notice_recipient = $main->GET("2bounce_notice_recipient"); $error_notice_recipient = $main->GET("error_notice_recipient"); $delay_notice_recipient = $main->GET("delay_notice_recipient"); $empty_address_recipient = $main->GET("empty_address_recipient"); $sock = new sockets(); $PostfixPostmaster = $sock->GET_INFO("PostfixPostmaster"); if (trim($PostfixPostmaster) == null) { $PostfixPostmaster = "postmaster"; } if ($double_bounce_sender == null) { $double_bounce_sender = "double-bounce"; } if ($address_verify_sender == null) { $address_verify_sender = "\$double_bounce_sender"; } if ($twobounce_notice_recipient == null) { $twobounce_notice_recipient = "postmaster"; } if ($error_notice_recipient == null) { $error_notice_recipient = $PostfixPostmaster; } if ($delay_notice_recipient == null) { $delay_notice_recipient = $PostfixPostmaster; } if ($empty_address_recipient == null) { $empty_address_recipient = $PostfixPostmaster; } if (is_array($mainTemplates->templates_array)) { while (list($template, $nothing) = each($mainTemplates->templates_array)) { $array = unserialize(base64_decode($main->GET_BIGDATA($template))); if (!is_array($array)) { $array = $mainTemplates->templates_array[$template]; } $tp = explode("\n", $array["Body"]); $Body = null; while (list($a, $line) = each($tp)) { if (trim($line) == null) { continue; } $Body = $Body . $line . "\n"; } $conf = $conf . "\n{$template} = <<EOF\n"; $conf = $conf . "Charset: {$array["Charset"]}\n"; $conf = $conf . "From: {$array["From"]}\n"; $conf = $conf . "Subject: {$array["Subject"]}\n"; $conf = $conf . "\n"; $conf = $conf . "{$Body}"; $conf = $conf . "\n\n"; $conf = $conf . "EOF\n"; } } @file_put_contents("/etc/postfix/bounce.template.cf", $conf); $notify_class = unserialize(base64_decode($main->GET_BIGDATA("notify_class"))); if ($notify_class["notify_class_software"] == 1) { $not[] = "software"; } if ($notify_class["notify_class_resource"] == 1) { $not[] = "resource"; } if ($notify_class["notify_class_policy"] == 1) { $not[] = "policy"; } if ($notify_class["notify_class_delay"] == 1) { $not[] = "delay"; } if ($notify_class["notify_class_2bounce"] == 1) { $not[] = "2bounce"; } if ($notify_class["notify_class_bounce"] == 1) { $not[] = "bounce"; } if ($notify_class["notify_class_protocol"] == 1) { $not[] = "protocol"; } postconf("notify_class", @implode(",", $not)); postconf("double_bounce_sender", "{$double_bounce_sender}"); postconf("address_verify_sender", "{$address_verify_sender}"); postconf("2bounce_notice_recipient", $twobounce_notice_recipient); postconf("error_notice_recipient", $error_notice_recipient); postconf("delay_notice_recipient", $delay_notice_recipient); postconf("empty_address_recipient", $empty_address_recipient); postconf("bounce_template_file", "/etc/postfix/bounce.template.cf"); }
function smtpd_milters() { if ($GLOBALS["EnablePostfixMultiInstance"] == 1) { echo "Starting......: " . date("H:i:s") . " Postfix EnablePostfixMultiInstance is enabled...\n"; shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.postfix-multi.php --from-main-reconfigure"); return; } $main = new main_cf(); echo "Starting......: " . date("H:i:s") . " Postfix building milters...\n"; $milter_array = $main->BuildMilters(true); while (list($key, $value) = each($milter_array)) { echo "Starting......: " . date("H:i:s") . " Postfix setting key `{$key}`...\n"; postconf($key, $value); } }