Group emails
while not a perfect solution it works with local OD domains and you are free to use it to your needs all the credit shall go to the original author , i just put some modifications in order to get it in working order with SLS.
!/bin/bash
Group Email Enabler is a simple script which fixes a shortcoming in OS X Server 10.6
by allowing each WGM group to automatically become an email list for it's members.
#
Jeff Johnson jdj@mac.com
#
To install
1. save this file as
/usr/sbin/group_email.sh
2. sudo chmod +x /usr/sbin/group_email.sh
3. touch /private/var/log/group_email.log
4. adjust /etc/postfix/main.cf, add the following to "alias_maps="
hash:/etc/postfix/group_aliases
5. add the following to /etc/crontab (you may need to create /etc/crontab)
*/15 * * * * root /usr/sbin/group_email.sh >> /private/var/log/group_email.log
To use
When the script runs, it searches for any WGM group in /LDAPv3/127.0.0.1 the word "mail"
within the comment field. Postfix aliases with group members are then created.
#
If you create a group called 'employees' and put all staff in that group, you will
then have an email setup of employees@domain.com
#
Be sure all mail groups contain at least one member
Would like to add/modify
1. needs error trapping. a group without members returns an error.
2. support for non-local LDAP
clear current aliases
echo "" > /etc/postfix/group_aliases
Get list of groups with 'mail' in the comment field
gr=dscl . -list /Groups Comment | grep mail | awk '{print $1}'
for group in $gr do echo $group: dscl . -read /Groups/$group 'GroupMembership' | cut -d : -f 2 | grep -v "No such key" >> /etc/postfix/group_aliases done
/usr/sbin/postalias /etc/postfix/group_aliases /usr/bin/newaliases exit 0
Hoping this helps you as much as it helped me.
Best Regards,
Bertrand STERN
MacPro Octocore, Mac OS X (10.6.6)