Howdy folks,
I looked at a few mail list managers and finally settled on mlmmj because it seems to work best with Zentyal. Basically it's a four step process (note, the script would need to be changed if you use zarafa):
* sudo apt-get install mlmmj
* Add to /etc/crontab: 0 */2 * * * root "find /var/spool/mlmmj -mindepth 1 -maxdepth 1 -type d -exec /usr/bin/mlmmj-maintd -F -d {} \;"
* Save script below as executable /etc/zentyal/hooks/mail.postsetconf
* sudo service zentyal mail restart
The script is:
#!/usr/bin/perl -w
use strict;
# Rewrites postfix config files to support mlmmj after zentyal resets
my $Main = '/etc/postfix/main.cf';
my $Master = '/etc/postfix/master.cf';
my @Lines;
open(FILE, "<", $Master);
@Lines = <FILE>;
close(FILE);
for my $Line (@Lines) {
if ($Line =~ /mlmmj/i) {
print("File already processed!\n");
exit(0);
}
}
open(FILE, ">", $Master);
for my $Line (@Lines) {
if ($Line =~ /smtp\-amavis/i) {
print(FILE "mlmmj unix - n n - - " .
"pipe flags=ORhu user=list argv=/usr/bin/mlmmj-recieve -F -L " .
"/var/spool/mlmmj/\${nexthop}\n");
}
print(FILE $Line);
}
close(FILE);
@Lines = ();
open(FILE, "<", $Main);
@Lines = <FILE>;
close(FILE);
open(FILE, ">", $Main);
for my $Line (@Lines) {
if ($Line =~ /^virtual_alias_maps/i) {
print(FILE "virtual_alias_maps = ldap:valiases, " .
"hash:/var/spool/mlmmj/virtual\n");
print(FILE "mlmmj_destination_recipient_limit = 1\n");
print(FILE "transport_maps = hash:/var/spool/mlmmj/transport\n");
} else { print(FILE $Line); }
}
close(FILE);