@@ -776,10 +776,15 @@ public function process_postfix_config($configfile) {
776776
777777 exec ('postconf -h recipient_delimiter 2>/dev/null ' , $ out );
778778 if (strlen ($ out [0 ]) > 0 ) {
779- $ recipient_delimiter = $ this ->db ->escape ( str_replace ('% ' , '%% ' , $ out [0 ]) );
780- $ addr_no_extension = "CONCAT(SUBSTRING_INDEX('%u', ' $ {recipient_delimiter}', 1), '@%d') " ;
779+ // build string like: CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX('%u', '%%', 1), '+', 1), '@%d')
780+ $ addr_cleanup = "'%u' " ;
781+ foreach (str_split ($ out [0 ]) as $ delim ) {
782+ $ recipient_delimiter = $ this ->db ->escape ( str_replace ('% ' , '%% ' , $ delim ) );
783+ $ addr_cleanup = "SUBSTRING_INDEX( $ {addr_cleanup}, ' $ {recipient_delimiter}', 1) " ;
784+ }
785+ $ no_addr_extension = "CONCAT( $ {addr_cleanup}, '@%d') " ;
781786 } else {
782- $ addr_no_extension = "'%s ' " ;
787+ $ no_addr_extension = "'' " ;
783788 }
784789 unset($ out );
785790
@@ -790,7 +795,7 @@ public function process_postfix_config($configfile) {
790795 $ content = str_replace ('{mysql_server_database} ' , $ conf ['mysql ' ]['database ' ], $ content );
791796 $ content = str_replace ('{mysql_server_ip} ' , $ conf ['mysql ' ]['ip ' ], $ content );
792797 $ content = str_replace ('{server_id} ' , $ conf ['server_id ' ], $ content );
793- $ content = str_replace ('{address_without_extension} ' , $ addr_no_extension , $ content );
798+ $ content = str_replace ('{address_without_extension} ' , $ no_addr_extension , $ content );
794799 wf ($ full_file_name , $ content );
795800
796801 //* Changing mode and group of the new created config file
0 commit comments