@@ -1071,6 +1071,14 @@ public function remove_postfix_service( $service, $type ) {
10711071 return true ;
10721072 }
10731073
1074+ public function get_postfix_version () {
1075+ //* Get postfix version
1076+ exec ('postconf -d mail_version 2>&1 ' , $ out );
1077+ $ postfix_version = preg_replace ('/.*=\s*/ ' , '' , $ out [0 ]);
1078+ unset($ out );
1079+ return $ postfix_version ;
1080+ }
1081+
10741082 public function configure_postfix ($ options = '' ) {
10751083 global $ conf ,$ autoinstall ;
10761084 $ cf = $ conf ['postfix ' ];
@@ -1080,10 +1088,7 @@ public function configure_postfix($options = '') {
10801088 $ this ->error ("The postfix configuration directory ' $ config_dir' does not exist. " );
10811089 }
10821090
1083- //* Get postfix version
1084- exec ('postconf -d mail_version 2>&1 ' , $ out );
1085- $ postfix_version = preg_replace ('/.*=\s*/ ' , '' , $ out [0 ]);
1086- unset($ out );
1091+ $ postfix_version = $ this ->get_postfix_version ();
10871092
10881093 //* Install virtual mappings
10891094 foreach (glob ('tpl/mysql-virtual_*.master ' ) as $ filename ) {
@@ -1482,8 +1487,7 @@ public function configure_dovecot() {
14821487
14831488 $ config_dir = $ conf ['postfix ' ]['config_dir ' ];
14841489 $ quoted_config_dir = preg_quote ($ config_dir , '| ' );
1485- $ postfix_version = `postconf -d mail_version 2>/dev/null `;
1486- $ postfix_version = preg_replace ( '/mail_version\s*=\s*(.*)\s*/ ' , '$1 ' , $ postfix_version );
1490+ $ postfix_version = $ this ->get_postfix_version ();
14871491
14881492 //* Configure master.cf and add a line for deliver
14891493 if (!$ this ->get_postfix_service ('dovecot ' , 'unix ' )) {
@@ -1725,6 +1729,7 @@ public function configure_amavis() {
17251729 break ;
17261730 }
17271731 }
1732+ $ postfix_version = $ this ->get_postfix_version ();
17281733 # postfix < 3.3 needs this when using reject_unverified_recipient:
17291734 if (version_compare ($ postfix_version , 3.3 , '< ' )) {
17301735 $ postconf_commands [] = "enable_original_recipient = yes " ;
0 commit comments