#!/usr/bin/perl
use strict;

if ( -f '/etc/mailmanurlexclude' ) {
	print "[*] Applying mailman fixes.\n";
	open(my $DAT, '<', '/etc/mailmanurlexclude');
		while(<$DAT>) {
			if ( /^([a-zA-Z0-9\.\_\-]+):([a-zA-Z0-9\.\-]+)$/ ) {
				my ( $list, $host ) = ( $1, $2 );
				print "\t- $list -> $host\n";
				system("/usr/local/cpanel/3rdparty/mailman/bin/withlist -l -r fix_url $list --urlhost=$host >> /dev/null");
			}
		}
	close($DAT);
}
