Skip to content

Commit f78f7cc

Browse files
committed
talk to amavis with lmtp if detected: closes #4792
1 parent 2120766 commit f78f7cc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

install/lib/installer_base.lib.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,17 +927,26 @@ public function configure_postfix($options = '') {
927927
//* mysql-virtual_uids.cf
928928
$this->process_postfix_config('mysql-virtual_uids.cf');
929929

930+
// test if lmtp if available
931+
$configure_lmtp = $this->get_postfix_service('lmtp','unix');
932+
930933
//* postfix-dkim
931934
$filename='tag_as_originating.re';
932935
$full_file_name=$config_dir.'/'.$filename;
933936
if(is_file($full_file_name)) copy($full_file_name, $full_file_name.'~');
934937
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/postfix-'.$filename.'.master', 'tpl/postfix-'.$filename.'.master');
938+
if($configure_lmtp) {
939+
$content = preg_replace('/amavis:/', 'lmtp:', $content);
940+
}
935941
wf($full_file_name, $content);
936942

937943
$filename='tag_as_foreign.re';
938944
$full_file_name=$config_dir.'/'.$filename;
939945
if(is_file($full_file_name)) copy($full_file_name, $full_file_name.'~');
940946
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/postfix-'.$filename.'.master', 'tpl/postfix-'.$filename.'.master');
947+
if($configure_lmtp) {
948+
$content = preg_replace('/amavis:/', 'lmtp:', $content);
949+
}
941950
wf($full_file_name, $content);
942951

943952
//* Changing mode and group of the new created config files.
@@ -1423,14 +1432,17 @@ public function configure_amavis() {
14231432

14241433
// TODO: chmod and chown on the config file
14251434

1435+
// test if lmtp if available
1436+
$configure_lmtp = $this->get_postfix_service('lmtp','unix');
14261437

14271438
// Adding the amavisd commands to the postfix configuration
14281439
// Add array for no error in foreach and maybe future options
14291440
$postconf_commands = array ();
14301441

14311442
// Check for amavisd -> pure webserver with postfix for mailing without antispam
14321443
if ($conf['amavis']['installed']) {
1433-
$postconf_commands[] = 'content_filter = amavis:[127.0.0.1]:10024';
1444+
$content_filter_service = ($configure_lmtp) ? 'lmtp' : 'amavis';
1445+
$postconf_commands[] = "content_filter = ${content_filter_service}:[127.0.0.1]:10024";
14341446
$postconf_commands[] = 'receive_override_options = no_address_mappings';
14351447
}
14361448

0 commit comments

Comments
 (0)