forked from redmine-git-hosting/redmine_git_hosting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail_notifications.py
35 lines (23 loc) · 863 Bytes
/
mail_notifications.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env python3
import sys
import os
import git_multimail
# It is possible to modify the output templates here; e.g.:
git_multimail.FOOTER_TEMPLATE = """\
-- \n\
This email was generated by the wonderful git-multimail tool from JBox Web.
"""
# Specify which "git config" section contains the configuration for
# git-multimail:
config = git_multimail.Config('multimailhook')
# check if hook is enabled
enabled = config.get_bool('enabled')
if enabled:
# Select the type of environment:
environment = git_multimail.GitoliteEnvironment(config=config)
# Choose the method of sending emails based on the git config:
mailer = git_multimail.choose_mailer(config, environment)
# Read changes from stdin and send notification emails:
git_multimail.run_as_post_receive_hook(environment, mailer)
else:
print(" multimailhook is disabled")