## Re2o - Mailing This service uses Re2o API to generate mailing member files. ## Requirements * python3 * requirements in https://gitlab.federez.net/re2o/re2oapi ## Configuration You need to copy the config.ini.example file into config.ini. ### Re2o section The re2o section defines parameter to connect to re2o api. | Parameter | Description | Default value | |-------------|-------------------------------|--------------------| | `hostname` | hostname of the re2o instance | `re2o.example.net` | | `username` | username for re2o api | `my_api_username` | | `password` | password for re2o api | `my_api_password` | ### Mailman section | Parameter | Description | Default value | |--------------|-------------------------------------------|----------------------------------------------------------------------------------------------------| | `url` | url for mailman api | `localhost:8001` | | `username` | username for mailman api | `restadmin` | | `password` | password for mailman api | `restpassword` | | `domain` | domain for mailing lists | `example.net` | | `roster_url` | roster url for getting and deleting email | None (`http://{mailman_url}/3.1/lists/{list_name}@{domain}/roster/member` will be used by default) | ### Sections for mailing-lists For each mailing-list you want to synchronise, you need to create a section. The section name should be one of the mailing retourned by re2o. Re2o returns : * mails for all the adherents (`adherents`) * mails for each group * mails for each club For each section, you can have two parameters : | Parameter | Description | Default value | |-------------|-------------------------------------------------------------------------------------------|---------------| | `activate` | If yes, the mailing will be synchronised. `no` is equivalent to no section at all | `no` | | `list_name` | list name (without domain) on mailman. If not given, the section name is taken by default | section name | ### Example ``` [Re2o] hostname = re2o.rezometz.org username = service-daemon password = secret [Mailman] url = localhost:8001 username = restadmin password = secret domain = rezometz.org [adherents] activate = yes [rezo] activate = yes [rezotage] activate = yes list_name = rezo-admin ``` 3 mailings are generated : one which is adherents@rezometz.org with all adherents, one which is is rezo@rezometz.org with the group rezo and the last one is rezo-admin@rezometz.org with the group rezotage. ## Setup with a cron You can setup an automatic regeneration with, for instance, the following command : ``` * */2 * * * root python3 /usr/local/mailing/main.py; python3 /usr/local/mailing/sync_adherents_mailman.py ``` in `/etc/cron.d/mailing`. The two scripts are executed every two hours in this case (to limit the number of requests on mailman api even if the second script is executed only if the first regenerates files).