Owncloud/Nextcloud mailinglist generator
Generate an exim forward file to create mailing lists for each owncloud/nextcloud group.
This perl script creates an exim forwardfile
$HOME/.forward, based on the users and groups in an owncloud/nextcloud installation. It uses the Owncloud User Provisioning API to access information about users and groups. An optional system.filter (see example file in repository) can be used with exim to modify mails before forwarding them.
For each group groupname, it creates a mailinglist, i.e., mails sent to firstname.lastname@example.org are forwarded to each member of the group groupname. You can also define, that a mailinglist is private, which means, that only members of the group are allowed to send mail to email@example.com. A catch-all definition is possible, that sends all mail to domain.com which does not match any group to a specific recipient.
Script usage is as follows:
generate-mailinglists.pl --user|-u <username> --pass|-p <password> --host|-h <hostname> [--catch-all <email>] [--private <private-list-id>] [--verbose|-v] [--help|-?]
usernameis an owncloud admin user (required)
passwordis the corresponding password (required)
hostnameis the owncloud hostname (required)
private-list-iddefines an specific group as private (optional, can be specified multiple times)
generate-mailinglists.pl -u admin -p secret -h owncloud.domain.com --private intern --private workgroup
To periodically update the forward file just put the script in your cronfile.